Skip to content

BLAS 1::team dot

Nathan Ellingwood edited this page Nov 12, 2019 · 1 revision

KokkosBlas::dot()

Header File: KokkosBlas1_team_dot.hpp

Usage: result = KokkosBlas::Experimental::dot(team,x,y);

Multiplies each value of x(i) with y(i) and computes the total within a parallel kernel using a TeamPolicy execution policy

Interface Single Vector only

template <class TeamType, class XVector, class YVector>
typename Kokkos::Details::InnerProductSpaceTraits<typename XVector::non_const_value_type>::dot_type
KOKKOS_INLINE_FUNCTION dot (const TeamType& team, const XVector& x, const YVector& y)

Parameters:

  • TeamType: A Kokkos::TeamPolicy<...>::member_type
  • VectorX: A rank-1 Kokkos::View
  • VectorY: A rank-1 Kokkos::View

Requirements:

  • Y.rank == 1 or X.rank == 1
  • Y.extent(0) == X.extent(0)

Example

#include<Kokkos_Core.hpp>
#include<KokkosBlas1_team_dot.hpp>

int main(int argc, char* argv[]) {
   Kokkos::initialize();

   int N = atoi(argv[1]);

   Kokkos::View<double*> x("X",N);
   Kokkos::View<double*> y("Y",N);
   Kokkos::deep_copy(x,3.0);
   Kokkos::deep_copy(y,2.0);
   
   using policy = Kokkos::TeamPolicy<>;
   using member_type = typename policy::member_type;

   Kokkos::parallel_for("TeamDotDemoUsage", policy(1, Kokkos::AUTO), KOKKOS_LAMBDA (const member_type& team) {
     double result = KokkosBlas::Experimental::dot(team, x, y);
   });

   Kokkos::finalize();
}
Clone this wiki locally