diff --git a/CHANGELOG.md b/CHANGELOG.md index a6d2da6..7c72bc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. ### Removed - Superfluous OpenMP 4.5 map(to:) clauses on kernel target regions. +- Kokkos namespace not used by default so the API is easier to spot. ### Fixed - Kokkos now compiles and links separately to fix complication with Kokkos 2.05.00. diff --git a/KOKKOSStream.cpp b/KOKKOSStream.cpp index 45f4dff..f53d1db 100644 --- a/KOKKOSStream.cpp +++ b/KOKKOSStream.cpp @@ -7,8 +7,6 @@ #include "KOKKOSStream.hpp" -using namespace Kokkos; - template KOKKOSStream::KOKKOSStream( const unsigned int ARRAY_SIZE, const int device_index) @@ -16,12 +14,12 @@ KOKKOSStream::KOKKOSStream( { Kokkos::initialize(); - d_a = new View("d_a", ARRAY_SIZE); - d_b = new View("d_b", ARRAY_SIZE); - d_c = new View("d_c", ARRAY_SIZE); - hm_a = new View::HostMirror(); - hm_b = new View::HostMirror(); - hm_c = new View::HostMirror(); + d_a = new Kokkos::View("d_a", ARRAY_SIZE); + d_b = new Kokkos::View("d_b", ARRAY_SIZE); + d_c = new Kokkos::View("d_c", ARRAY_SIZE); + hm_a = new Kokkos::View::HostMirror(); + hm_b = new Kokkos::View::HostMirror(); + hm_c = new Kokkos::View::HostMirror(); *hm_a = create_mirror_view(*d_a); *hm_b = create_mirror_view(*d_b); *hm_c = create_mirror_view(*d_c); @@ -30,16 +28,16 @@ KOKKOSStream::KOKKOSStream( template KOKKOSStream::~KOKKOSStream() { - finalize(); + Kokkos::finalize(); } template void KOKKOSStream::init_arrays(T initA, T initB, T initC) { - View a(*d_a); - View b(*d_b); - View c(*d_c); - parallel_for(array_size, KOKKOS_LAMBDA (const long index) + Kokkos::View a(*d_a); + Kokkos::View b(*d_b); + Kokkos::View c(*d_c); + Kokkos::parallel_for(array_size, KOKKOS_LAMBDA (const long index) { a[index] = initA; b[index] = initB; @@ -66,11 +64,11 @@ void KOKKOSStream::read_arrays( template void KOKKOSStream::copy() { - View a(*d_a); - View b(*d_b); - View c(*d_c); + Kokkos::View a(*d_a); + Kokkos::View b(*d_b); + Kokkos::View c(*d_c); - parallel_for(array_size, KOKKOS_LAMBDA (const long index) + Kokkos::parallel_for(array_size, KOKKOS_LAMBDA (const long index) { c[index] = a[index]; }); @@ -80,12 +78,12 @@ void KOKKOSStream::copy() template void KOKKOSStream::mul() { - View a(*d_a); - View b(*d_b); - View c(*d_c); + Kokkos::View a(*d_a); + Kokkos::View b(*d_b); + Kokkos::View c(*d_c); const T scalar = startScalar; - parallel_for(array_size, KOKKOS_LAMBDA (const long index) + Kokkos::parallel_for(array_size, KOKKOS_LAMBDA (const long index) { b[index] = scalar*c[index]; }); @@ -95,11 +93,11 @@ void KOKKOSStream::mul() template void KOKKOSStream::add() { - View a(*d_a); - View b(*d_b); - View c(*d_c); + Kokkos::View a(*d_a); + Kokkos::View b(*d_b); + Kokkos::View c(*d_c); - parallel_for(array_size, KOKKOS_LAMBDA (const long index) + Kokkos::parallel_for(array_size, KOKKOS_LAMBDA (const long index) { c[index] = a[index] + b[index]; }); @@ -109,12 +107,12 @@ void KOKKOSStream::add() template void KOKKOSStream::triad() { - View a(*d_a); - View b(*d_b); - View c(*d_c); + Kokkos::View a(*d_a); + Kokkos::View b(*d_b); + Kokkos::View c(*d_c); const T scalar = startScalar; - parallel_for(array_size, KOKKOS_LAMBDA (const long index) + Kokkos::parallel_for(array_size, KOKKOS_LAMBDA (const long index) { a[index] = b[index] + scalar*c[index]; }); @@ -124,12 +122,12 @@ void KOKKOSStream::triad() template T KOKKOSStream::dot() { - View a(*d_a); - View b(*d_b); + Kokkos::View a(*d_a); + Kokkos::View b(*d_b); T sum = 0.0; - parallel_reduce(array_size, KOKKOS_LAMBDA (const long index, double &tmp) + Kokkos::parallel_reduce(array_size, KOKKOS_LAMBDA (const long index, double &tmp) { tmp += a[index] * b[index]; }, sum);