Skip to content

Commit

Permalink
HIP unit-test: removing unecessary guards from Blas team tests
Browse files Browse the repository at this point in the history
After removing the CUDA_LAMBDA guard an issue with the TeamPolicy
in the tests was discovered and fixed.
As a reminder: TeamPolicy is templated on execution_space, not
               on device or memory_space, see Kokkos wiki:
               https://github.com/kokkos/kokkos/wiki/Kokkos%3A%3ATeamPolicy
  • Loading branch information
lucbv committed Oct 29, 2020
1 parent 7bdfe10 commit 82efdab
Show file tree
Hide file tree
Showing 18 changed files with 66 additions and 68 deletions.
14 changes: 8 additions & 6 deletions unit_test/blas/Test_Blas1_team_abs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ namespace Test {
template<class ViewTypeA, class ViewTypeB, class Device>
void impl_test_team_abs(int N) {

typedef Kokkos::TeamPolicy<Device> team_policy ;
typedef typename team_policy::member_type team_member ;
using execution_space = typename Device::execution_space;
using team_policy = Kokkos::TeamPolicy<execution_space>;
using team_member = typename team_policy::member_type;

//Launch M teams of the maximum number of threads per team
int M = 4;
Expand Down Expand Up @@ -48,7 +49,7 @@ namespace Test {
typename ViewTypeA::HostMirror h_x = Kokkos::subview(h_b_x,Kokkos::ALL(),0);
typename ViewTypeB::HostMirror h_y = Kokkos::subview(h_b_y,Kokkos::ALL(),0);

Kokkos::Random_XorShift64_Pool<typename Device::execution_space> rand_pool(13718);
Kokkos::Random_XorShift64_Pool<execution_space> rand_pool(13718);

Kokkos::fill_random(b_x,rand_pool,ScalarA(1));
Kokkos::fill_random(b_y,rand_pool,ScalarB(1));
Expand Down Expand Up @@ -86,8 +87,9 @@ namespace Test {
template<class ViewTypeA, class ViewTypeB, class Device>
void impl_test_team_abs_mv(int N, int K) {

typedef Kokkos::TeamPolicy<Device> team_policy ;
typedef typename team_policy::member_type team_member ;
using execution_space = typename Device::execution_space;
using team_policy = Kokkos::TeamPolicy<execution_space>;
using team_member = typename team_policy::member_type;

//Launch K teams of the maximum number of threads per team
const team_policy policy( K, Kokkos::AUTO );
Expand Down Expand Up @@ -115,7 +117,7 @@ namespace Test {
typename ViewTypeA::HostMirror h_x = h_vfA_type::view(h_b_x);
typename ViewTypeB::HostMirror h_y = h_vfB_type::view(h_b_y);

Kokkos::Random_XorShift64_Pool<typename Device::execution_space> rand_pool(13718);
Kokkos::Random_XorShift64_Pool<execution_space> rand_pool(13718);

Kokkos::fill_random(b_x,rand_pool,ScalarA(1));
Kokkos::fill_random(b_y,rand_pool,ScalarB(1));
Expand Down
14 changes: 8 additions & 6 deletions unit_test/blas/Test_Blas1_team_axpby.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ namespace Test {
template<class ViewTypeA, class ViewTypeB, class Device>
void impl_test_team_axpby(int N) {

typedef Kokkos::TeamPolicy<Device> team_policy ;
typedef typename team_policy::member_type team_member ;
using execution_space = typename Device::execution_space;
using team_policy = Kokkos::TeamPolicy<execution_space>;
using team_member = typename team_policy::member_type;

//Launch M teams of the maximum number of threads per team
int M = 4;
Expand Down Expand Up @@ -50,7 +51,7 @@ namespace Test {
typename ViewTypeA::HostMirror h_x = Kokkos::subview(h_b_x,Kokkos::ALL(),0);
typename ViewTypeB::HostMirror h_y = Kokkos::subview(h_b_y,Kokkos::ALL(),0);

Kokkos::Random_XorShift64_Pool<typename Device::execution_space> rand_pool(13718);
Kokkos::Random_XorShift64_Pool<execution_space> rand_pool(13718);

Kokkos::fill_random(b_x,rand_pool,ScalarA(10));
Kokkos::fill_random(b_y,rand_pool,ScalarB(10));
Expand Down Expand Up @@ -88,8 +89,9 @@ namespace Test {
template<class ViewTypeA, class ViewTypeB, class Device>
void impl_test_team_axpby_mv(int N, int K) {

typedef Kokkos::TeamPolicy<Device> team_policy ;
typedef typename team_policy::member_type team_member ;
using execution_space = typename Device::execution_space;
using team_policy = Kokkos::TeamPolicy<execution_space>;
using team_member = typename team_policy::member_type;

//Launch K teams of the maximum number of threads per team
const team_policy policy( K, Kokkos::AUTO );
Expand All @@ -116,7 +118,7 @@ namespace Test {
typename ViewTypeA::HostMirror h_x = h_vfA_type::view(h_b_x);
typename ViewTypeB::HostMirror h_y = h_vfB_type::view(h_b_y);

Kokkos::Random_XorShift64_Pool<typename Device::execution_space> rand_pool(13718);
Kokkos::Random_XorShift64_Pool<execution_space> rand_pool(13718);

Kokkos::fill_random(b_x,rand_pool,ScalarA(10));
Kokkos::fill_random(b_y,rand_pool,ScalarB(10));
Expand Down
16 changes: 9 additions & 7 deletions unit_test/blas/Test_Blas1_team_axpy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
namespace Test {
template<class ViewTypeA, class ViewTypeB, class Device>
void impl_test_team_axpy(int N) {

typedef Kokkos::TeamPolicy<Device> team_policy ;
typedef typename team_policy::member_type team_member ;

using execution_space = typename Device::execution_space;
using team_policy = Kokkos::TeamPolicy<execution_space>;
using team_member = typename team_policy::member_type;

//Launch M teams of the maximum number of threads per team
int M = 4;
Expand Down Expand Up @@ -49,7 +50,7 @@ namespace Test {
typename ViewTypeA::HostMirror h_x = Kokkos::subview(h_b_x,Kokkos::ALL(),0);
typename ViewTypeB::HostMirror h_y = Kokkos::subview(h_b_y,Kokkos::ALL(),0);

Kokkos::Random_XorShift64_Pool<typename Device::execution_space> rand_pool(13718);
Kokkos::Random_XorShift64_Pool<execution_space> rand_pool(13718);

Kokkos::fill_random(b_x,rand_pool,ScalarA(10));
Kokkos::fill_random(b_y,rand_pool,ScalarB(10));
Expand Down Expand Up @@ -87,8 +88,9 @@ namespace Test {
template<class ViewTypeA, class ViewTypeB, class Device>
void impl_test_team_axpy_mv(int N, int K) {

typedef Kokkos::TeamPolicy<Device> team_policy ;
typedef typename team_policy::member_type team_member ;
using execution_space = typename Device::execution_space;
using team_policy = Kokkos::TeamPolicy<execution_space>;
using team_member = typename team_policy::member_type;

//Launch K teams of the maximum number of threads per team
const team_policy policy( K, Kokkos::AUTO );
Expand All @@ -115,7 +117,7 @@ namespace Test {
typename ViewTypeA::HostMirror h_x = h_vfA_type::view(h_b_x);
typename ViewTypeB::HostMirror h_y = h_vfB_type::view(h_b_y);

Kokkos::Random_XorShift64_Pool<typename Device::execution_space> rand_pool(13718);
Kokkos::Random_XorShift64_Pool<execution_space> rand_pool(13718);

Kokkos::fill_random(b_x,rand_pool,ScalarA(10));
Kokkos::fill_random(b_y,rand_pool,ScalarB(10));
Expand Down
12 changes: 7 additions & 5 deletions unit_test/blas/Test_Blas1_team_dot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ namespace Test {
template<class ViewTypeA, class ViewTypeB, class Device>
void impl_test_team_dot(int N) {

typedef Kokkos::TeamPolicy<Device> team_policy ;
using execution_space = typename Device::execution_space;
using team_policy = Kokkos::TeamPolicy<execution_space>;
typedef typename team_policy::member_type team_member ;

//Launch M teams of the maximum number of threads per team
Expand Down Expand Up @@ -41,7 +42,7 @@ namespace Test {
typename ViewTypeA::HostMirror h_a = Kokkos::subview(h_b_a,Kokkos::ALL(),0);
typename ViewTypeB::HostMirror h_b = Kokkos::subview(h_b_b,Kokkos::ALL(),0);

Kokkos::Random_XorShift64_Pool<typename Device::execution_space> rand_pool(13718);
Kokkos::Random_XorShift64_Pool<execution_space> rand_pool(13718);

Kokkos::fill_random(b_a,rand_pool,ScalarA(10));
Kokkos::fill_random(b_b,rand_pool,ScalarB(10));
Expand Down Expand Up @@ -118,8 +119,9 @@ namespace Test {
template<class ViewTypeA, class ViewTypeB, class Device>
void impl_test_team_dot_mv(int N, int K) {

typedef Kokkos::TeamPolicy<Device> team_policy ;
typedef typename team_policy::member_type team_member ;
using execution_space = typename Device::execution_space;
using team_policy = Kokkos::TeamPolicy<execution_space>;
using team_member = typename team_policy::member_type;

//Launch K teams of the maximum number of threads per team
const team_policy policy( K, Kokkos::AUTO );
Expand All @@ -145,7 +147,7 @@ namespace Test {
typename ViewTypeA::HostMirror h_a = h_vfA_type::view(h_b_a);
typename ViewTypeB::HostMirror h_b = h_vfB_type::view(h_b_b);

Kokkos::Random_XorShift64_Pool<typename Device::execution_space> rand_pool(13718);
Kokkos::Random_XorShift64_Pool<execution_space> rand_pool(13718);

Kokkos::fill_random(b_a,rand_pool,ScalarA(10));
Kokkos::fill_random(b_b,rand_pool,ScalarB(10));
Expand Down
16 changes: 9 additions & 7 deletions unit_test/blas/Test_Blas1_team_mult.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
namespace Test {
template<class ViewTypeA, class ViewTypeB, class ViewTypeC, class Device>
void impl_test_team_mult(int N) {

typedef Kokkos::TeamPolicy<Device> team_policy ;
typedef typename team_policy::member_type team_member ;

using execution_space = typename Device::execution_space;
using team_policy = Kokkos::TeamPolicy<execution_space>;
using team_member = typename team_policy::member_type;

//Launch M teams of the maximum number of threads per team
int M = 4;
Expand Down Expand Up @@ -59,7 +60,7 @@ namespace Test {
typename ViewTypeB::HostMirror h_y = Kokkos::subview(h_b_y,Kokkos::ALL(),0);
typename ViewTypeC::HostMirror h_z = Kokkos::subview(h_b_z,Kokkos::ALL(),0);

Kokkos::Random_XorShift64_Pool<typename Device::execution_space> rand_pool(13718);
Kokkos::Random_XorShift64_Pool<execution_space> rand_pool(13718);

Kokkos::fill_random(b_x,rand_pool,ScalarA(10));
Kokkos::fill_random(b_y,rand_pool,ScalarB(10));
Expand Down Expand Up @@ -105,8 +106,9 @@ namespace Test {
template<class ViewTypeA, class ViewTypeB, class ViewTypeC, class Device>
void impl_test_team_mult_mv(int N, int K) {

typedef Kokkos::TeamPolicy<Device> team_policy ;
typedef typename team_policy::member_type team_member ;
using execution_space = typename Device::execution_space;
using team_policy = Kokkos::TeamPolicy<execution_space>;
using team_member = typename team_policy::member_type;

//Launch K teams of the maximum number of threads per team
const team_policy policy( K, Kokkos::AUTO );
Expand Down Expand Up @@ -142,7 +144,7 @@ namespace Test {
typename ViewTypeB::HostMirror h_y = h_vfB_type::view(h_b_y);
typename ViewTypeC::HostMirror h_z = h_vfC_type::view(h_b_z);

Kokkos::Random_XorShift64_Pool<typename Device::execution_space> rand_pool(13718);
Kokkos::Random_XorShift64_Pool<execution_space> rand_pool(13718);

Kokkos::fill_random(b_x,rand_pool,ScalarA(10));
Kokkos::fill_random(b_y,rand_pool,ScalarB(10));
Expand Down
7 changes: 4 additions & 3 deletions unit_test/blas/Test_Blas1_team_nrm2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ namespace Test {
template<class ViewTypeA, class Device>
void impl_test_team_nrm2(int N, int K) {

typedef Kokkos::TeamPolicy<Device> team_policy ;
typedef typename team_policy::member_type team_member ;
using execution_space = typename Device::execution_space;
using team_policy = Kokkos::TeamPolicy<execution_space>;
using team_member = typename team_policy::member_type;

//Launch K teams of the maximum number of threads per team
const team_policy policy( K, Kokkos::AUTO );
Expand All @@ -29,7 +30,7 @@ namespace Test {

typename ViewTypeA::HostMirror h_a = h_vfA_type::view(h_b_a);

Kokkos::Random_XorShift64_Pool<typename Device::execution_space> rand_pool(13718);
Kokkos::Random_XorShift64_Pool<execution_space> rand_pool(13718);

Kokkos::fill_random(b_a,rand_pool,ScalarA(10));

Expand Down
14 changes: 8 additions & 6 deletions unit_test/blas/Test_Blas1_team_scal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ namespace Test {
template<class ViewTypeA, class ViewTypeB, class Device>
void impl_test_team_scal(int N) {

typedef Kokkos::TeamPolicy<Device> team_policy ;
typedef typename team_policy::member_type team_member ;
using execution_space = typename Device::execution_space;
using team_policy = Kokkos::TeamPolicy<execution_space>;
using team_member = typename team_policy::member_type;

//Launch M teams of the maximum number of threads per team
int M = 4;
Expand Down Expand Up @@ -52,7 +53,7 @@ namespace Test {
typename ViewTypeA::HostMirror h_x = Kokkos::subview(h_b_x,Kokkos::ALL(),0);
typename ViewTypeB::HostMirror h_y = Kokkos::subview(h_b_y,Kokkos::ALL(),0);

Kokkos::Random_XorShift64_Pool<typename Device::execution_space> rand_pool(13718);
Kokkos::Random_XorShift64_Pool<execution_space> rand_pool(13718);

Kokkos::fill_random(b_x,rand_pool,ScalarA(1));
Kokkos::fill_random(b_y,rand_pool,ScalarB(1));
Expand Down Expand Up @@ -98,8 +99,9 @@ namespace Test {
template<class ViewTypeA, class ViewTypeB, class Device>
void impl_test_team_scal_mv(int N, int K) {

typedef Kokkos::TeamPolicy<Device> team_policy ;
typedef typename team_policy::member_type team_member ;
using execution_space = typename Device::execution_space;
using team_policy = Kokkos::TeamPolicy<execution_space>;
using team_member = typename team_policy::member_type;

//Launch K teams of the maximum number of threads per team
const team_policy policy( K, Kokkos::AUTO );
Expand Down Expand Up @@ -127,7 +129,7 @@ namespace Test {
typename ViewTypeA::HostMirror h_x = h_vfA_type::view(h_b_x);
typename ViewTypeB::HostMirror h_y = h_vfB_type::view(h_b_y);

Kokkos::Random_XorShift64_Pool<typename Device::execution_space> rand_pool(13718);
Kokkos::Random_XorShift64_Pool<execution_space> rand_pool(13718);

Kokkos::fill_random(b_x,rand_pool,ScalarA(1));
Kokkos::fill_random(b_y,rand_pool,ScalarB(1));
Expand Down
16 changes: 9 additions & 7 deletions unit_test/blas/Test_Blas1_team_update.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
namespace Test {
template<class ViewTypeA, class ViewTypeB, class ViewTypeC, class Device>
void impl_test_team_update(int N) {

typedef Kokkos::TeamPolicy<Device> team_policy ;
typedef typename team_policy::member_type team_member ;

using execution_space = typename Device::execution_space;
using team_policy = Kokkos::TeamPolicy<execution_space>;
using team_member = typename team_policy::member_type;

//Launch M teams of the maximum number of threads per team
int M = 4;
Expand Down Expand Up @@ -60,7 +61,7 @@ namespace Test {
typename ViewTypeB::HostMirror h_y = Kokkos::subview(h_b_y,Kokkos::ALL(),0);
typename ViewTypeC::HostMirror h_z = Kokkos::subview(h_b_z,Kokkos::ALL(),0);

Kokkos::Random_XorShift64_Pool<typename Device::execution_space> rand_pool(13718);
Kokkos::Random_XorShift64_Pool<execution_space> rand_pool(13718);

Kokkos::fill_random(b_x,rand_pool,ScalarA(10));
Kokkos::fill_random(b_y,rand_pool,ScalarB(10));
Expand Down Expand Up @@ -108,8 +109,9 @@ namespace Test {
template<class ViewTypeA, class ViewTypeB, class ViewTypeC, class Device>
void impl_test_team_update_mv(int N, int K) {

typedef Kokkos::TeamPolicy<Device> team_policy ;
typedef typename team_policy::member_type team_member ;
using execution_space = typename Device::execution_space;
using team_policy = Kokkos::TeamPolicy<execution_space>;
using team_member = typename team_policy::member_type;

//Launch K teams of the maximum number of threads per team
const team_policy policy( K, Kokkos::AUTO );
Expand Down Expand Up @@ -143,7 +145,7 @@ namespace Test {
typename ViewTypeB::HostMirror h_y = h_vfB_type::view(h_b_y);
typename ViewTypeC::HostMirror h_z = h_vfC_type::view(h_b_z);

Kokkos::Random_XorShift64_Pool<typename Device::execution_space> rand_pool(13718);
Kokkos::Random_XorShift64_Pool<execution_space> rand_pool(13718);

Kokkos::fill_random(b_x,rand_pool,ScalarA(10));
Kokkos::fill_random(b_y,rand_pool,ScalarB(10));
Expand Down
7 changes: 4 additions & 3 deletions unit_test/blas/Test_Blas2_team_gemv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ namespace Test {
template<class ViewTypeA, class ViewTypeX, class ViewTypeY, class Device>
void impl_test_team_gemv(const char* mode, int N, int M) {

typedef Kokkos::TeamPolicy<Device> team_policy ;
typedef typename team_policy::member_type team_member ;
using execution_space = typename Device::execution_space;
using team_policy = Kokkos::TeamPolicy<execution_space>;
using team_member = typename team_policy::member_type;

//Launch K teams of the maximum number of threads per team
int K = 4;
Expand Down Expand Up @@ -58,7 +59,7 @@ namespace Test {
typename ViewTypeX::HostMirror h_x = Kokkos::subview(h_b_x,Kokkos::ALL(),0);
typename ViewTypeY::HostMirror h_y = Kokkos::subview(h_b_y,Kokkos::ALL(),0);

Kokkos::Random_XorShift64_Pool<typename Device::execution_space> rand_pool(13718);
Kokkos::Random_XorShift64_Pool<execution_space> rand_pool(13718);

Kokkos::fill_random(b_x,rand_pool,ScalarX(10));
Kokkos::fill_random(b_y,rand_pool,ScalarY(10));
Expand Down
2 changes: 0 additions & 2 deletions unit_test/hip/Test_HIP_Blas1_team_abs.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#include<Test_HIP.hpp>
#ifdef KOKKOS_ENABLE_CUDA_LAMBDA
#include<Test_Blas1_team_abs.hpp>
#endif
2 changes: 0 additions & 2 deletions unit_test/hip/Test_HIP_Blas1_team_axpby.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#include<Test_HIP.hpp>
#ifdef KOKKOS_ENABLE_CUDA_LAMBDA
#include<Test_Blas1_team_axpby.hpp>
#endif
2 changes: 0 additions & 2 deletions unit_test/hip/Test_HIP_Blas1_team_axpy.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#include<Test_HIP.hpp>
#ifdef KOKKOS_ENABLE_CUDA_LAMBDA
#include<Test_Blas1_team_axpy.hpp>
#endif
2 changes: 0 additions & 2 deletions unit_test/hip/Test_HIP_Blas1_team_dot.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#include<Test_HIP.hpp>
#ifdef KOKKOS_ENABLE_CUDA_LAMBDA
#include<Test_Blas1_team_dot.hpp>
#endif
2 changes: 0 additions & 2 deletions unit_test/hip/Test_HIP_Blas1_team_mult.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#include<Test_HIP.hpp>
#ifdef KOKKOS_ENABLE_CUDA_LAMBDA
#include<Test_Blas1_team_mult.hpp>
#endif
2 changes: 0 additions & 2 deletions unit_test/hip/Test_HIP_Blas1_team_nrm2.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#include<Test_HIP.hpp>
#ifdef KOKKOS_ENABLE_CUDA_LAMBDA
#include<Test_Blas1_team_nrm2.hpp>
#endif
2 changes: 0 additions & 2 deletions unit_test/hip/Test_HIP_Blas1_team_scal.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#include<Test_HIP.hpp>
#ifdef KOKKOS_ENABLE_CUDA_LAMBDA
#include<Test_Blas1_team_scal.hpp>
#endif
2 changes: 0 additions & 2 deletions unit_test/hip/Test_HIP_Blas1_team_update.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#include<Test_HIP.hpp>
#ifdef KOKKOS_ENABLE_CUDA_LAMBDA
#include<Test_Blas1_team_update.hpp>
#endif
2 changes: 0 additions & 2 deletions unit_test/hip/Test_HIP_Blas2_team_gemv.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#include<Test_HIP.hpp>
#ifdef KOKKOS_ENABLE_CUDA_LAMBDA
#include<Test_Blas2_team_gemv.hpp>
#endif

0 comments on commit 82efdab

Please sign in to comment.