From 82efdab933c2531ae044800a17b20133f1688c74 Mon Sep 17 00:00:00 2001 From: Luc Berger-Vergiat Date: Thu, 29 Oct 2020 08:29:53 -0600 Subject: [PATCH] HIP unit-test: removing unecessary guards from Blas team tests 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 --- unit_test/blas/Test_Blas1_team_abs.hpp | 14 ++++++++------ unit_test/blas/Test_Blas1_team_axpby.hpp | 14 ++++++++------ unit_test/blas/Test_Blas1_team_axpy.hpp | 16 +++++++++------- unit_test/blas/Test_Blas1_team_dot.hpp | 12 +++++++----- unit_test/blas/Test_Blas1_team_mult.hpp | 16 +++++++++------- unit_test/blas/Test_Blas1_team_nrm2.hpp | 7 ++++--- unit_test/blas/Test_Blas1_team_scal.hpp | 14 ++++++++------ unit_test/blas/Test_Blas1_team_update.hpp | 16 +++++++++------- unit_test/blas/Test_Blas2_team_gemv.hpp | 7 ++++--- unit_test/hip/Test_HIP_Blas1_team_abs.cpp | 2 -- unit_test/hip/Test_HIP_Blas1_team_axpby.cpp | 2 -- unit_test/hip/Test_HIP_Blas1_team_axpy.cpp | 2 -- unit_test/hip/Test_HIP_Blas1_team_dot.cpp | 2 -- unit_test/hip/Test_HIP_Blas1_team_mult.cpp | 2 -- unit_test/hip/Test_HIP_Blas1_team_nrm2.cpp | 2 -- unit_test/hip/Test_HIP_Blas1_team_scal.cpp | 2 -- unit_test/hip/Test_HIP_Blas1_team_update.cpp | 2 -- unit_test/hip/Test_HIP_Blas2_team_gemv.cpp | 2 -- 18 files changed, 66 insertions(+), 68 deletions(-) diff --git a/unit_test/blas/Test_Blas1_team_abs.hpp b/unit_test/blas/Test_Blas1_team_abs.hpp index 87ebef5065..179fa24546 100644 --- a/unit_test/blas/Test_Blas1_team_abs.hpp +++ b/unit_test/blas/Test_Blas1_team_abs.hpp @@ -9,8 +9,9 @@ namespace Test { template void impl_test_team_abs(int N) { - typedef Kokkos::TeamPolicy team_policy ; - typedef typename team_policy::member_type team_member ; + using execution_space = typename Device::execution_space; + using team_policy = Kokkos::TeamPolicy; + using team_member = typename team_policy::member_type; //Launch M teams of the maximum number of threads per team int M = 4; @@ -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 rand_pool(13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(b_x,rand_pool,ScalarA(1)); Kokkos::fill_random(b_y,rand_pool,ScalarB(1)); @@ -86,8 +87,9 @@ namespace Test { template void impl_test_team_abs_mv(int N, int K) { - typedef Kokkos::TeamPolicy team_policy ; - typedef typename team_policy::member_type team_member ; + using execution_space = typename Device::execution_space; + using team_policy = Kokkos::TeamPolicy; + 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 ); @@ -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 rand_pool(13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(b_x,rand_pool,ScalarA(1)); Kokkos::fill_random(b_y,rand_pool,ScalarB(1)); diff --git a/unit_test/blas/Test_Blas1_team_axpby.hpp b/unit_test/blas/Test_Blas1_team_axpby.hpp index 7e8d9eac10..d5cea134a8 100644 --- a/unit_test/blas/Test_Blas1_team_axpby.hpp +++ b/unit_test/blas/Test_Blas1_team_axpby.hpp @@ -9,8 +9,9 @@ namespace Test { template void impl_test_team_axpby(int N) { - typedef Kokkos::TeamPolicy team_policy ; - typedef typename team_policy::member_type team_member ; + using execution_space = typename Device::execution_space; + using team_policy = Kokkos::TeamPolicy; + using team_member = typename team_policy::member_type; //Launch M teams of the maximum number of threads per team int M = 4; @@ -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 rand_pool(13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(b_x,rand_pool,ScalarA(10)); Kokkos::fill_random(b_y,rand_pool,ScalarB(10)); @@ -88,8 +89,9 @@ namespace Test { template void impl_test_team_axpby_mv(int N, int K) { - typedef Kokkos::TeamPolicy team_policy ; - typedef typename team_policy::member_type team_member ; + using execution_space = typename Device::execution_space; + using team_policy = Kokkos::TeamPolicy; + 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 ); @@ -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 rand_pool(13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(b_x,rand_pool,ScalarA(10)); Kokkos::fill_random(b_y,rand_pool,ScalarB(10)); diff --git a/unit_test/blas/Test_Blas1_team_axpy.hpp b/unit_test/blas/Test_Blas1_team_axpy.hpp index 507e7b4a01..ed31f86a96 100644 --- a/unit_test/blas/Test_Blas1_team_axpy.hpp +++ b/unit_test/blas/Test_Blas1_team_axpy.hpp @@ -8,9 +8,10 @@ namespace Test { template void impl_test_team_axpy(int N) { - - typedef Kokkos::TeamPolicy team_policy ; - typedef typename team_policy::member_type team_member ; + + using execution_space = typename Device::execution_space; + using team_policy = Kokkos::TeamPolicy; + using team_member = typename team_policy::member_type; //Launch M teams of the maximum number of threads per team int M = 4; @@ -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 rand_pool(13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(b_x,rand_pool,ScalarA(10)); Kokkos::fill_random(b_y,rand_pool,ScalarB(10)); @@ -87,8 +88,9 @@ namespace Test { template void impl_test_team_axpy_mv(int N, int K) { - typedef Kokkos::TeamPolicy team_policy ; - typedef typename team_policy::member_type team_member ; + using execution_space = typename Device::execution_space; + using team_policy = Kokkos::TeamPolicy; + 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 ); @@ -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 rand_pool(13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(b_x,rand_pool,ScalarA(10)); Kokkos::fill_random(b_y,rand_pool,ScalarB(10)); diff --git a/unit_test/blas/Test_Blas1_team_dot.hpp b/unit_test/blas/Test_Blas1_team_dot.hpp index 158dcf5733..0e3891a31f 100644 --- a/unit_test/blas/Test_Blas1_team_dot.hpp +++ b/unit_test/blas/Test_Blas1_team_dot.hpp @@ -8,7 +8,8 @@ namespace Test { template void impl_test_team_dot(int N) { - typedef Kokkos::TeamPolicy team_policy ; + using execution_space = typename Device::execution_space; + using team_policy = Kokkos::TeamPolicy; typedef typename team_policy::member_type team_member ; //Launch M teams of the maximum number of threads per team @@ -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 rand_pool(13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(b_a,rand_pool,ScalarA(10)); Kokkos::fill_random(b_b,rand_pool,ScalarB(10)); @@ -118,8 +119,9 @@ namespace Test { template void impl_test_team_dot_mv(int N, int K) { - typedef Kokkos::TeamPolicy team_policy ; - typedef typename team_policy::member_type team_member ; + using execution_space = typename Device::execution_space; + using team_policy = Kokkos::TeamPolicy; + 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 ); @@ -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 rand_pool(13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(b_a,rand_pool,ScalarA(10)); Kokkos::fill_random(b_b,rand_pool,ScalarB(10)); diff --git a/unit_test/blas/Test_Blas1_team_mult.hpp b/unit_test/blas/Test_Blas1_team_mult.hpp index f369e8c137..3ecdf9638a 100644 --- a/unit_test/blas/Test_Blas1_team_mult.hpp +++ b/unit_test/blas/Test_Blas1_team_mult.hpp @@ -8,9 +8,10 @@ namespace Test { template void impl_test_team_mult(int N) { - - typedef Kokkos::TeamPolicy team_policy ; - typedef typename team_policy::member_type team_member ; + + using execution_space = typename Device::execution_space; + using team_policy = Kokkos::TeamPolicy; + using team_member = typename team_policy::member_type; //Launch M teams of the maximum number of threads per team int M = 4; @@ -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 rand_pool(13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(b_x,rand_pool,ScalarA(10)); Kokkos::fill_random(b_y,rand_pool,ScalarB(10)); @@ -105,8 +106,9 @@ namespace Test { template void impl_test_team_mult_mv(int N, int K) { - typedef Kokkos::TeamPolicy team_policy ; - typedef typename team_policy::member_type team_member ; + using execution_space = typename Device::execution_space; + using team_policy = Kokkos::TeamPolicy; + 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 ); @@ -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 rand_pool(13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(b_x,rand_pool,ScalarA(10)); Kokkos::fill_random(b_y,rand_pool,ScalarB(10)); diff --git a/unit_test/blas/Test_Blas1_team_nrm2.hpp b/unit_test/blas/Test_Blas1_team_nrm2.hpp index 4c654c7eae..ac83cad9c2 100644 --- a/unit_test/blas/Test_Blas1_team_nrm2.hpp +++ b/unit_test/blas/Test_Blas1_team_nrm2.hpp @@ -8,8 +8,9 @@ namespace Test { template void impl_test_team_nrm2(int N, int K) { - typedef Kokkos::TeamPolicy team_policy ; - typedef typename team_policy::member_type team_member ; + using execution_space = typename Device::execution_space; + using team_policy = Kokkos::TeamPolicy; + 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 ); @@ -29,7 +30,7 @@ namespace Test { typename ViewTypeA::HostMirror h_a = h_vfA_type::view(h_b_a); - Kokkos::Random_XorShift64_Pool rand_pool(13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(b_a,rand_pool,ScalarA(10)); diff --git a/unit_test/blas/Test_Blas1_team_scal.hpp b/unit_test/blas/Test_Blas1_team_scal.hpp index 6b33caa262..028c763a6e 100644 --- a/unit_test/blas/Test_Blas1_team_scal.hpp +++ b/unit_test/blas/Test_Blas1_team_scal.hpp @@ -9,8 +9,9 @@ namespace Test { template void impl_test_team_scal(int N) { - typedef Kokkos::TeamPolicy team_policy ; - typedef typename team_policy::member_type team_member ; + using execution_space = typename Device::execution_space; + using team_policy = Kokkos::TeamPolicy; + using team_member = typename team_policy::member_type; //Launch M teams of the maximum number of threads per team int M = 4; @@ -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 rand_pool(13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(b_x,rand_pool,ScalarA(1)); Kokkos::fill_random(b_y,rand_pool,ScalarB(1)); @@ -98,8 +99,9 @@ namespace Test { template void impl_test_team_scal_mv(int N, int K) { - typedef Kokkos::TeamPolicy team_policy ; - typedef typename team_policy::member_type team_member ; + using execution_space = typename Device::execution_space; + using team_policy = Kokkos::TeamPolicy; + 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 ); @@ -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 rand_pool(13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(b_x,rand_pool,ScalarA(1)); Kokkos::fill_random(b_y,rand_pool,ScalarB(1)); diff --git a/unit_test/blas/Test_Blas1_team_update.hpp b/unit_test/blas/Test_Blas1_team_update.hpp index dcc9d1e486..3dd36cf51e 100644 --- a/unit_test/blas/Test_Blas1_team_update.hpp +++ b/unit_test/blas/Test_Blas1_team_update.hpp @@ -8,9 +8,10 @@ namespace Test { template void impl_test_team_update(int N) { - - typedef Kokkos::TeamPolicy team_policy ; - typedef typename team_policy::member_type team_member ; + + using execution_space = typename Device::execution_space; + using team_policy = Kokkos::TeamPolicy; + using team_member = typename team_policy::member_type; //Launch M teams of the maximum number of threads per team int M = 4; @@ -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 rand_pool(13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(b_x,rand_pool,ScalarA(10)); Kokkos::fill_random(b_y,rand_pool,ScalarB(10)); @@ -108,8 +109,9 @@ namespace Test { template void impl_test_team_update_mv(int N, int K) { - typedef Kokkos::TeamPolicy team_policy ; - typedef typename team_policy::member_type team_member ; + using execution_space = typename Device::execution_space; + using team_policy = Kokkos::TeamPolicy; + 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 ); @@ -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 rand_pool(13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(b_x,rand_pool,ScalarA(10)); Kokkos::fill_random(b_y,rand_pool,ScalarB(10)); diff --git a/unit_test/blas/Test_Blas2_team_gemv.hpp b/unit_test/blas/Test_Blas2_team_gemv.hpp index 124941bfd8..7d16ade850 100644 --- a/unit_test/blas/Test_Blas2_team_gemv.hpp +++ b/unit_test/blas/Test_Blas2_team_gemv.hpp @@ -9,8 +9,9 @@ namespace Test { template void impl_test_team_gemv(const char* mode, int N, int M) { - typedef Kokkos::TeamPolicy team_policy ; - typedef typename team_policy::member_type team_member ; + using execution_space = typename Device::execution_space; + using team_policy = Kokkos::TeamPolicy; + using team_member = typename team_policy::member_type; //Launch K teams of the maximum number of threads per team int K = 4; @@ -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 rand_pool(13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(b_x,rand_pool,ScalarX(10)); Kokkos::fill_random(b_y,rand_pool,ScalarY(10)); diff --git a/unit_test/hip/Test_HIP_Blas1_team_abs.cpp b/unit_test/hip/Test_HIP_Blas1_team_abs.cpp index f253a72735..d59b6a61de 100644 --- a/unit_test/hip/Test_HIP_Blas1_team_abs.cpp +++ b/unit_test/hip/Test_HIP_Blas1_team_abs.cpp @@ -1,4 +1,2 @@ #include -#ifdef KOKKOS_ENABLE_CUDA_LAMBDA #include -#endif diff --git a/unit_test/hip/Test_HIP_Blas1_team_axpby.cpp b/unit_test/hip/Test_HIP_Blas1_team_axpby.cpp index be7f570a02..0f3a2a5fec 100644 --- a/unit_test/hip/Test_HIP_Blas1_team_axpby.cpp +++ b/unit_test/hip/Test_HIP_Blas1_team_axpby.cpp @@ -1,4 +1,2 @@ #include -#ifdef KOKKOS_ENABLE_CUDA_LAMBDA #include -#endif diff --git a/unit_test/hip/Test_HIP_Blas1_team_axpy.cpp b/unit_test/hip/Test_HIP_Blas1_team_axpy.cpp index d6e22c8891..823154d5af 100644 --- a/unit_test/hip/Test_HIP_Blas1_team_axpy.cpp +++ b/unit_test/hip/Test_HIP_Blas1_team_axpy.cpp @@ -1,4 +1,2 @@ #include -#ifdef KOKKOS_ENABLE_CUDA_LAMBDA #include -#endif diff --git a/unit_test/hip/Test_HIP_Blas1_team_dot.cpp b/unit_test/hip/Test_HIP_Blas1_team_dot.cpp index bab30ef2b8..05987c8dd4 100644 --- a/unit_test/hip/Test_HIP_Blas1_team_dot.cpp +++ b/unit_test/hip/Test_HIP_Blas1_team_dot.cpp @@ -1,4 +1,2 @@ #include -#ifdef KOKKOS_ENABLE_CUDA_LAMBDA #include -#endif diff --git a/unit_test/hip/Test_HIP_Blas1_team_mult.cpp b/unit_test/hip/Test_HIP_Blas1_team_mult.cpp index 25d51c964f..ca54d031f1 100644 --- a/unit_test/hip/Test_HIP_Blas1_team_mult.cpp +++ b/unit_test/hip/Test_HIP_Blas1_team_mult.cpp @@ -1,4 +1,2 @@ #include -#ifdef KOKKOS_ENABLE_CUDA_LAMBDA #include -#endif diff --git a/unit_test/hip/Test_HIP_Blas1_team_nrm2.cpp b/unit_test/hip/Test_HIP_Blas1_team_nrm2.cpp index 4c067a39be..9994255a31 100644 --- a/unit_test/hip/Test_HIP_Blas1_team_nrm2.cpp +++ b/unit_test/hip/Test_HIP_Blas1_team_nrm2.cpp @@ -1,4 +1,2 @@ #include -#ifdef KOKKOS_ENABLE_CUDA_LAMBDA #include -#endif diff --git a/unit_test/hip/Test_HIP_Blas1_team_scal.cpp b/unit_test/hip/Test_HIP_Blas1_team_scal.cpp index e685a03a04..2f804c4dc5 100644 --- a/unit_test/hip/Test_HIP_Blas1_team_scal.cpp +++ b/unit_test/hip/Test_HIP_Blas1_team_scal.cpp @@ -1,4 +1,2 @@ #include -#ifdef KOKKOS_ENABLE_CUDA_LAMBDA #include -#endif diff --git a/unit_test/hip/Test_HIP_Blas1_team_update.cpp b/unit_test/hip/Test_HIP_Blas1_team_update.cpp index 9ffc89a8eb..99cc8746ed 100644 --- a/unit_test/hip/Test_HIP_Blas1_team_update.cpp +++ b/unit_test/hip/Test_HIP_Blas1_team_update.cpp @@ -1,4 +1,2 @@ #include -#ifdef KOKKOS_ENABLE_CUDA_LAMBDA #include -#endif diff --git a/unit_test/hip/Test_HIP_Blas2_team_gemv.cpp b/unit_test/hip/Test_HIP_Blas2_team_gemv.cpp index 7e5c60a527..da40621400 100644 --- a/unit_test/hip/Test_HIP_Blas2_team_gemv.cpp +++ b/unit_test/hip/Test_HIP_Blas2_team_gemv.cpp @@ -1,4 +1,2 @@ #include -#ifdef KOKKOS_ENABLE_CUDA_LAMBDA #include -#endif