From f9e28e8a73b7deb95b7d7cc07dbd36988f45e0fc Mon Sep 17 00:00:00 2001 From: Brian Kelley Date: Fri, 15 Sep 2023 15:34:09 -0600 Subject: [PATCH] Don't assume the default memory space is used (Fixes #1910) In the source and especially unit tests, assume the device type we want can have any memory space (not just the default memory space of the execution space). Lets TestExecSpace either be a Kokkos::Device type, or just an execution space (the old behavior). In all Cuda unit tests, use as the TestExecSpace if CudaUVMSpace is instantiated but CudaSpace is not. Otherwise, use . All other backends are unchanged, but this would also let us test devices like and in the future. --- .../unit_test/Test_Batched_SerialAxpy.hpp | 3 +- .../Test_Batched_SerialEigendecomposition.hpp | 3 +- .../unit_test/Test_Batched_SerialGemm.hpp | 3 +- .../unit_test/Test_Batched_SerialGesv.hpp | 3 +- .../Test_Batched_SerialInverseLU.hpp | 9 ++- .../dense/unit_test/Test_Batched_SerialLU.hpp | 3 +- .../unit_test/Test_Batched_SerialSVD.hpp | 9 ++- .../unit_test/Test_Batched_SerialSolveLU.hpp | 9 ++- .../unit_test/Test_Batched_SerialTrmm.hpp | 3 +- .../unit_test/Test_Batched_SerialTrsm.hpp | 3 +- .../unit_test/Test_Batched_SerialTrsv.hpp | 3 +- .../unit_test/Test_Batched_SerialTrtri.hpp | 3 +- .../dense/unit_test/Test_Batched_TeamAxpy.hpp | 5 +- .../dense/unit_test/Test_Batched_TeamGemm.hpp | 5 +- .../dense/unit_test/Test_Batched_TeamGesv.hpp | 5 +- .../unit_test/Test_Batched_TeamInverseLU.hpp | 5 +- .../dense/unit_test/Test_Batched_TeamLU.hpp | 4 +- .../unit_test/Test_Batched_TeamSolveLU.hpp | 11 ++- .../dense/unit_test/Test_Batched_TeamTrsm.hpp | 5 +- .../dense/unit_test/Test_Batched_TeamTrsv.hpp | 5 +- .../unit_test/Test_Batched_TeamVectorAxpy.hpp | 5 +- ...t_Batched_TeamVectorEigendecomposition.hpp | 2 +- .../unit_test/Test_Batched_TeamVectorGemm.hpp | 5 +- .../unit_test/Test_Batched_TeamVectorGesv.hpp | 5 +- .../unit_test/Test_Batched_TeamVectorQR.hpp | 3 +- ...atched_TeamVectorQR_WithColumnPivoting.hpp | 3 +- .../Test_Batched_TeamVectorSolveUTV.hpp | 3 +- .../Test_Batched_TeamVectorSolveUTV2.hpp | 3 +- .../unit_test/Test_Batched_TeamVectorUTV.hpp | 3 +- .../unit_test/Test_Batched_SerialGMRES.hpp | 3 +- .../unit_test/Test_Batched_SerialSpmv.hpp | 3 +- .../sparse/unit_test/Test_Batched_TeamCG.hpp | 5 +- .../unit_test/Test_Batched_TeamGMRES.hpp | 5 +- .../unit_test/Test_Batched_TeamSpmv.hpp | 3 +- .../unit_test/Test_Batched_TeamVectorCG.hpp | 5 +- .../Test_Batched_TeamVectorGMRES.hpp | 5 +- .../unit_test/Test_Batched_TeamVectorSpmv.hpp | 3 +- blas/unit_test/Test_Blas1_rotg.hpp | 20 ++--- blas/unit_test/Test_Blas1_rotmg.hpp | 10 +-- blas/unit_test/Test_Blas1_serial_setscal.hpp | 3 +- blas/unit_test/Test_Blas1_team_abs.hpp | 9 ++- blas/unit_test/Test_Blas1_team_axpby.hpp | 12 +-- blas/unit_test/Test_Blas1_team_axpy.hpp | 9 ++- blas/unit_test/Test_Blas1_team_dot.hpp | 12 +-- blas/unit_test/Test_Blas1_team_mult.hpp | 12 +-- blas/unit_test/Test_Blas1_team_nrm2.hpp | 6 +- blas/unit_test/Test_Blas1_team_scal.hpp | 12 +-- blas/unit_test/Test_Blas1_team_setscal.hpp | 5 +- blas/unit_test/Test_Blas1_team_update.hpp | 12 +-- blas/unit_test/Test_Blas2_gemv_util.hpp | 6 +- blas/unit_test/Test_Blas3_gemm.hpp | 20 ++--- blas/unit_test/Test_Blas_serial_axpy.hpp | 3 +- blas/unit_test/Test_Blas_serial_nrm2.hpp | 4 +- common/unit_test/Test_Common_ArithTraits.hpp | 16 ++-- common/unit_test/Test_Common_Sorting.hpp | 79 ++++++++++--------- graph/unit_test/Test_Graph_graph_color.hpp | 7 +- ode/unit_test/Test_ODE_Newton.hpp | 77 +++++++++--------- ode/unit_test/Test_ODE_RK.hpp | 27 ++++--- ode/unit_test/Test_ODE_RK_chem.hpp | 11 +-- .../impl/KokkosSparse_sptrsv_solve_impl.hpp | 4 +- sparse/src/KokkosSparse_sptrsv_supernode.hpp | 4 +- sparse/unit_test/Test_Sparse_SortCrs.hpp | 33 ++++---- sparse/unit_test/Test_Sparse_Transpose.hpp | 20 ++--- sparse/unit_test/Test_Sparse_coo2crs.hpp | 8 +- .../Test_Sparse_removeCrsMatrixZeros.hpp | 18 ++--- test_common/KokkosKernels_TestUtils.hpp | 11 +-- test_common/Test_Cuda.hpp | 12 ++- 67 files changed, 355 insertions(+), 290 deletions(-) diff --git a/batched/dense/unit_test/Test_Batched_SerialAxpy.hpp b/batched/dense/unit_test/Test_Batched_SerialAxpy.hpp index 2bde3f7fad..90ce5addc3 100644 --- a/batched/dense/unit_test/Test_Batched_SerialAxpy.hpp +++ b/batched/dense/unit_test/Test_Batched_SerialAxpy.hpp @@ -30,6 +30,7 @@ namespace Axpy { template struct Functor_TestBatchedSerialAxpy { + using execution_space = typename DeviceType::execution_space; const alphaViewType _alpha; const ViewType _X; const ViewType _Y; @@ -54,7 +55,7 @@ struct Functor_TestBatchedSerialAxpy { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _X.extent(0)); + Kokkos::RangePolicy policy(0, _X.extent(0)); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_SerialEigendecomposition.hpp b/batched/dense/unit_test/Test_Batched_SerialEigendecomposition.hpp index 5e90d5ae45..7eb2b89c83 100644 --- a/batched/dense/unit_test/Test_Batched_SerialEigendecomposition.hpp +++ b/batched/dense/unit_test/Test_Batched_SerialEigendecomposition.hpp @@ -34,6 +34,7 @@ namespace Test { typename ViewRank2Type, typename WorkViewType> struct Functor_TestBatchedSerialEigendecomposition { + using execution_space = typename DeviceType::execution_space; ViewRank3Type _A; ViewRank2Type _Er, _Ei; ViewRank3Type _UL, _UR; @@ -70,7 +71,7 @@ namespace Test { >::value ? "::ComplexFloat" : std::is_same >::value ? "::ComplexDouble" : "::UnknownValueType" ); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion( name.c_str() ); - Kokkos::RangePolicy policy(0, _A.extent(0)); + Kokkos::RangePolicy policy(0, _A.extent(0)); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_SerialGemm.hpp b/batched/dense/unit_test/Test_Batched_SerialGemm.hpp index 8304657849..7f27fa7dcf 100644 --- a/batched/dense/unit_test/Test_Batched_SerialGemm.hpp +++ b/batched/dense/unit_test/Test_Batched_SerialGemm.hpp @@ -40,6 +40,7 @@ struct ParamTag { template struct Functor_TestBatchedSerialGemm { + using execution_space = typename DeviceType::execution_space; ViewType _a, _b, _c; ScalarType _alpha, _beta; @@ -66,7 +67,7 @@ struct Functor_TestBatchedSerialGemm { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _c.extent(0)); + Kokkos::RangePolicy policy(0, _c.extent(0)); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_SerialGesv.hpp b/batched/dense/unit_test/Test_Batched_SerialGesv.hpp index 3b17d81d48..bb05fab3bb 100644 --- a/batched/dense/unit_test/Test_Batched_SerialGesv.hpp +++ b/batched/dense/unit_test/Test_Batched_SerialGesv.hpp @@ -35,6 +35,7 @@ namespace Gesv { template struct Functor_TestBatchedSerialGesv { + using execution_space = typename DeviceType::execution_space; const MatrixType _A; const MatrixType _tmp; const VectorType _X; @@ -61,7 +62,7 @@ struct Functor_TestBatchedSerialGesv { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _X.extent(0)); + Kokkos::RangePolicy policy(0, _X.extent(0)); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_SerialInverseLU.hpp b/batched/dense/unit_test/Test_Batched_SerialInverseLU.hpp index d3cbd6c024..23ded73e25 100644 --- a/batched/dense/unit_test/Test_Batched_SerialInverseLU.hpp +++ b/batched/dense/unit_test/Test_Batched_SerialInverseLU.hpp @@ -44,6 +44,7 @@ struct ParamTag { template struct Functor_BatchedSerialGemm { + using execution_space = typename DeviceType::execution_space; ViewType _a, _b, _c; ScalarType _alpha, _beta; @@ -72,7 +73,7 @@ struct Functor_BatchedSerialGemm { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _c.extent(0)); + Kokkos::RangePolicy policy(0, _c.extent(0)); Kokkos::parallel_for((name + "::GemmFunctor").c_str(), policy, *this); Kokkos::Profiling::popRegion(); } @@ -80,6 +81,7 @@ struct Functor_BatchedSerialGemm { template struct Functor_BatchedSerialLU { + using execution_space = typename DeviceType::execution_space; ViewType _a; KOKKOS_INLINE_FUNCTION @@ -100,7 +102,7 @@ struct Functor_BatchedSerialLU { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _a.extent(0)); + Kokkos::RangePolicy policy(0, _a.extent(0)); Kokkos::parallel_for((name + "::LUFunctor").c_str(), policy, *this); Kokkos::Profiling::popRegion(); } @@ -109,6 +111,7 @@ struct Functor_BatchedSerialLU { template struct Functor_TestBatchedSerialInverseLU { + using execution_space = typename DeviceType::execution_space; AViewType _a; WViewType _w; @@ -130,7 +133,7 @@ struct Functor_TestBatchedSerialInverseLU { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _a.extent(0)); + Kokkos::RangePolicy policy(0, _a.extent(0)); Kokkos::parallel_for((name + "::InverseLUFunctor").c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_SerialLU.hpp b/batched/dense/unit_test/Test_Batched_SerialLU.hpp index 23b72893b2..87224aa888 100644 --- a/batched/dense/unit_test/Test_Batched_SerialLU.hpp +++ b/batched/dense/unit_test/Test_Batched_SerialLU.hpp @@ -32,6 +32,7 @@ namespace Test { template struct Functor_TestBatchedSerialLU { + using execution_space = typename DeviceType::execution_space; ViewType _a; KOKKOS_INLINE_FUNCTION @@ -52,7 +53,7 @@ struct Functor_TestBatchedSerialLU { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _a.extent(0)); + Kokkos::RangePolicy policy(0, _a.extent(0)); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_SerialSVD.hpp b/batched/dense/unit_test/Test_Batched_SerialSVD.hpp index 5aa832f0df..fb56e25894 100644 --- a/batched/dense/unit_test/Test_Batched_SerialSVD.hpp +++ b/batched/dense/unit_test/Test_Batched_SerialSVD.hpp @@ -406,13 +406,14 @@ void GenerateTestData(ViewT data) { }); } -template +template void testIssue1786() { - using memory_space = typename ExeSpace::memory_space; + using execution_space = typename Device::execution_space; + using memory_space = typename Device::memory_space; constexpr int num_tests = 4; Kokkos::View matrices("data", num_tests); - GenerateTestData(matrices); + GenerateTestData(matrices); Kokkos::View Us("Us", matrices.extent(0)); Kokkos::View Ss("Ss", matrices.extent(0)); @@ -425,7 +426,7 @@ void testIssue1786() { "matrices_copy", matrices.extent(0)); // make a copy of the input data to avoid overwriting it Kokkos::deep_copy(matrices_copy, matrices); - auto policy = Kokkos::RangePolicy(0, matrices.extent(0)); + auto policy = Kokkos::RangePolicy(0, matrices.extent(0)); Kokkos::parallel_for( "polar decomposition", policy, KOKKOS_LAMBDA(int i) { auto matrix_copy = diff --git a/batched/dense/unit_test/Test_Batched_SerialSolveLU.hpp b/batched/dense/unit_test/Test_Batched_SerialSolveLU.hpp index 48e8e5dead..43cb8fab2f 100644 --- a/batched/dense/unit_test/Test_Batched_SerialSolveLU.hpp +++ b/batched/dense/unit_test/Test_Batched_SerialSolveLU.hpp @@ -44,6 +44,7 @@ struct ParamTag { template struct Functor_BatchedSerialGemm { + using execution_space = typename DeviceType::execution_space; ViewType _a, _b, _c; ScalarType _alpha, _beta; @@ -72,7 +73,7 @@ struct Functor_BatchedSerialGemm { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _c.extent(0)); + Kokkos::RangePolicy policy(0, _c.extent(0)); Kokkos::parallel_for((name + "::GemmFunctor").c_str(), policy, *this); Kokkos::Profiling::popRegion(); } @@ -80,6 +81,7 @@ struct Functor_BatchedSerialGemm { template struct Functor_BatchedSerialLU { + using execution_space = typename DeviceType::execution_space; ViewType _a; KOKKOS_INLINE_FUNCTION @@ -100,7 +102,7 @@ struct Functor_BatchedSerialLU { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _a.extent(0)); + Kokkos::RangePolicy policy(0, _a.extent(0)); Kokkos::parallel_for((name + "::LUFunctor").c_str(), policy, *this); Kokkos::Profiling::popRegion(); } @@ -109,6 +111,7 @@ struct Functor_BatchedSerialLU { template struct Functor_TestBatchedSerialSolveLU { + using execution_space = typename DeviceType::execution_space; ViewType _a; ViewType _b; @@ -130,7 +133,7 @@ struct Functor_TestBatchedSerialSolveLU { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _a.extent(0)); + Kokkos::RangePolicy policy(0, _a.extent(0)); Kokkos::parallel_for((name + "::SolveLUFunctor").c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_SerialTrmm.hpp b/batched/dense/unit_test/Test_Batched_SerialTrmm.hpp index af38e62e4d..7a7e89ebf8 100644 --- a/batched/dense/unit_test/Test_Batched_SerialTrmm.hpp +++ b/batched/dense/unit_test/Test_Batched_SerialTrmm.hpp @@ -113,6 +113,7 @@ struct ParamTag { template struct Functor_TestBatchedSerialTrmm { + using execution_space = typename DeviceType::execution_space; ViewType _a, _b; ScalarType _alpha; @@ -138,7 +139,7 @@ struct Functor_TestBatchedSerialTrmm { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _a.extent(0)); + Kokkos::RangePolicy policy(0, _a.extent(0)); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_SerialTrsm.hpp b/batched/dense/unit_test/Test_Batched_SerialTrsm.hpp index c0ef098652..f9418a804a 100644 --- a/batched/dense/unit_test/Test_Batched_SerialTrsm.hpp +++ b/batched/dense/unit_test/Test_Batched_SerialTrsm.hpp @@ -40,6 +40,7 @@ struct ParamTag { template struct Functor_TestBatchedSerialTrsm { + using execution_space = typename DeviceType::execution_space; ViewType _a, _b; ScalarType _alpha; @@ -65,7 +66,7 @@ struct Functor_TestBatchedSerialTrsm { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _b.extent(0)); + Kokkos::RangePolicy policy(0, _b.extent(0)); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_SerialTrsv.hpp b/batched/dense/unit_test/Test_Batched_SerialTrsv.hpp index f05a6f7fa5..512dce3bce 100644 --- a/batched/dense/unit_test/Test_Batched_SerialTrsv.hpp +++ b/batched/dense/unit_test/Test_Batched_SerialTrsv.hpp @@ -39,6 +39,7 @@ struct ParamTag { template struct Functor_TestBatchedSerialTrsv { + using execution_space = typename DeviceType::execution_space; ViewType _a, _b; ScalarType _alpha; @@ -64,7 +65,7 @@ struct Functor_TestBatchedSerialTrsv { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _b.extent(0)); + Kokkos::RangePolicy policy(0, _b.extent(0)); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_SerialTrtri.hpp b/batched/dense/unit_test/Test_Batched_SerialTrtri.hpp index 8f4ae64b7e..b09cadcb7e 100644 --- a/batched/dense/unit_test/Test_Batched_SerialTrtri.hpp +++ b/batched/dense/unit_test/Test_Batched_SerialTrtri.hpp @@ -113,6 +113,7 @@ struct ParamTag { template struct Functor_TestBatchedSerialTrtri { + using execution_space = typename DeviceType::execution_space; ViewType _a; KOKKOS_INLINE_FUNCTION @@ -132,7 +133,7 @@ struct Functor_TestBatchedSerialTrtri { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _a.extent(0)); + Kokkos::RangePolicy policy(0, _a.extent(0)); Kokkos::parallel_for("Functor_TestBatchedSerialTrtri", policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_TeamAxpy.hpp b/batched/dense/unit_test/Test_Batched_TeamAxpy.hpp index 7941fc0284..b43b498607 100644 --- a/batched/dense/unit_test/Test_Batched_TeamAxpy.hpp +++ b/batched/dense/unit_test/Test_Batched_TeamAxpy.hpp @@ -30,6 +30,7 @@ namespace TeamAxpy { template struct Functor_TestBatchedTeamAxpy { + using execution_space = typename DeviceType::execution_space; const alphaViewType _alpha; const ViewType _X; const ViewType _Y; @@ -65,8 +66,8 @@ struct Functor_TestBatchedTeamAxpy { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::TeamPolicy policy(_X.extent(0) / _N_team, - Kokkos::AUTO(), Kokkos::AUTO()); + Kokkos::TeamPolicy policy(_X.extent(0) / _N_team, + Kokkos::AUTO(), Kokkos::AUTO()); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_TeamGemm.hpp b/batched/dense/unit_test/Test_Batched_TeamGemm.hpp index 9023a009af..2d952889c9 100644 --- a/batched/dense/unit_test/Test_Batched_TeamGemm.hpp +++ b/batched/dense/unit_test/Test_Batched_TeamGemm.hpp @@ -41,6 +41,7 @@ struct ParamTag { template struct Functor_TestBatchedTeamGemm { + using execution_space = typename DeviceType::execution_space; ViewType _a, _b, _c; ScalarType _alpha, _beta; @@ -73,8 +74,8 @@ struct Functor_TestBatchedTeamGemm { std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); const int league_size = _c.extent(0); - Kokkos::TeamPolicy policy(league_size, - Kokkos::AUTO); + Kokkos::TeamPolicy policy(league_size, + Kokkos::AUTO); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_TeamGesv.hpp b/batched/dense/unit_test/Test_Batched_TeamGesv.hpp index 89f67e2731..dc3b4e53fb 100644 --- a/batched/dense/unit_test/Test_Batched_TeamGesv.hpp +++ b/batched/dense/unit_test/Test_Batched_TeamGesv.hpp @@ -35,6 +35,7 @@ namespace TeamGesv { template struct Functor_TestBatchedTeamGesv { + using execution_space = typename DeviceType::execution_space; const MatrixType _A; const VectorType _X; const VectorType _B; @@ -62,8 +63,8 @@ struct Functor_TestBatchedTeamGesv { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::TeamPolicy policy(_X.extent(0), Kokkos::AUTO(), - Kokkos::AUTO()); + Kokkos::TeamPolicy policy(_X.extent(0), Kokkos::AUTO(), + Kokkos::AUTO()); using MatrixViewType = Kokkos::View struct Functor_BatchedTeamGemm { + using execution_space = typename DeviceType::execution_space; ViewType _a, _b, _c; ScalarType _alpha, _beta; @@ -82,8 +83,8 @@ struct Functor_BatchedTeamGemm { Kokkos::Profiling::pushRegion(name.c_str()); const int league_size = _c.extent(0); - Kokkos::TeamPolicy policy(league_size, - Kokkos::AUTO); + Kokkos::TeamPolicy policy(league_size, + Kokkos::AUTO); Kokkos::parallel_for((name + "::GemmFunctor").c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_TeamLU.hpp b/batched/dense/unit_test/Test_Batched_TeamLU.hpp index 04e191b9cb..e20f3a7411 100644 --- a/batched/dense/unit_test/Test_Batched_TeamLU.hpp +++ b/batched/dense/unit_test/Test_Batched_TeamLU.hpp @@ -34,6 +34,8 @@ namespace TeamLU { template struct Functor_TestBatchedTeamLU { + using execution_space = typename DeviceType::execution_space; + ViewType _a; KOKKOS_INLINE_FUNCTION @@ -60,7 +62,7 @@ struct Functor_TestBatchedTeamLU { Kokkos::Profiling::pushRegion(name.c_str()); const int league_size = _a.extent(0); - Kokkos::TeamPolicy policy(league_size, Kokkos::AUTO); + Kokkos::TeamPolicy policy(league_size, Kokkos::AUTO); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_TeamSolveLU.hpp b/batched/dense/unit_test/Test_Batched_TeamSolveLU.hpp index 41287f9b52..445e10132f 100644 --- a/batched/dense/unit_test/Test_Batched_TeamSolveLU.hpp +++ b/batched/dense/unit_test/Test_Batched_TeamSolveLU.hpp @@ -44,6 +44,7 @@ struct ParamTag { template struct Functor_BatchedTeamGemm { + using execution_space = typename DeviceType::execution_space; ViewType _a, _b, _c; ScalarType _alpha, _beta; @@ -81,14 +82,15 @@ struct Functor_BatchedTeamGemm { std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); const int league_size = _c.extent(0); - Kokkos::TeamPolicy policy(league_size, - Kokkos::AUTO); + Kokkos::TeamPolicy policy(league_size, + Kokkos::AUTO); Kokkos::parallel_for((name + "::GemmFunctor").c_str(), policy, *this); Kokkos::Profiling::popRegion(); } }; template struct Functor_BatchedTeamLU { + using execution_space = typename DeviceType::execution_space; ViewType _a; KOKKOS_INLINE_FUNCTION @@ -113,7 +115,7 @@ struct Functor_BatchedTeamLU { std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); const int league_size = _a.extent(0); - Kokkos::TeamPolicy policy(league_size, Kokkos::AUTO); + Kokkos::TeamPolicy policy(league_size, Kokkos::AUTO); Kokkos::parallel_for((name + "::LUFunctor").c_str(), policy, *this); Kokkos::Profiling::popRegion(); } @@ -121,6 +123,7 @@ struct Functor_BatchedTeamLU { template struct Functor_TestBatchedTeamSolveLU { + using execution_space = typename DeviceType::execution_space; ViewType _a; ViewType _b; @@ -146,7 +149,7 @@ struct Functor_TestBatchedTeamSolveLU { Kokkos::Profiling::pushRegion(name.c_str()); const int league_size = _a.extent(0); - Kokkos::TeamPolicy policy(league_size, Kokkos::AUTO); + Kokkos::TeamPolicy policy(league_size, Kokkos::AUTO); Kokkos::parallel_for((name + "::SolveLU").c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_TeamTrsm.hpp b/batched/dense/unit_test/Test_Batched_TeamTrsm.hpp index 2f7781745d..523bd02df4 100644 --- a/batched/dense/unit_test/Test_Batched_TeamTrsm.hpp +++ b/batched/dense/unit_test/Test_Batched_TeamTrsm.hpp @@ -43,6 +43,7 @@ struct ParamTag { template struct Functor_TestBatchedTeamTrsm { + using execution_space = typename DeviceType::execution_space; ViewType _a, _b; ScalarType _alpha; @@ -74,8 +75,8 @@ struct Functor_TestBatchedTeamTrsm { Kokkos::Profiling::pushRegion(name.c_str()); const int league_size = _b.extent(0); - Kokkos::TeamPolicy policy(league_size, - Kokkos::AUTO); + Kokkos::TeamPolicy policy(league_size, + Kokkos::AUTO); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_TeamTrsv.hpp b/batched/dense/unit_test/Test_Batched_TeamTrsv.hpp index bb00b78736..400e35deb8 100644 --- a/batched/dense/unit_test/Test_Batched_TeamTrsv.hpp +++ b/batched/dense/unit_test/Test_Batched_TeamTrsv.hpp @@ -41,6 +41,7 @@ struct ParamTag { template struct Functor_TestBatchedTeamTrsv { + using execution_space = typename DeviceType::execution_space; ViewType _a, _b; ScalarType _alpha; @@ -72,8 +73,8 @@ struct Functor_TestBatchedTeamTrsv { Kokkos::Profiling::pushRegion(name.c_str()); const int league_size = _b.extent(0); - Kokkos::TeamPolicy policy(league_size, - Kokkos::AUTO); + Kokkos::TeamPolicy policy(league_size, + Kokkos::AUTO); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_TeamVectorAxpy.hpp b/batched/dense/unit_test/Test_Batched_TeamVectorAxpy.hpp index 5ea8a80717..fca0534b4b 100644 --- a/batched/dense/unit_test/Test_Batched_TeamVectorAxpy.hpp +++ b/batched/dense/unit_test/Test_Batched_TeamVectorAxpy.hpp @@ -30,6 +30,7 @@ namespace TeamVectorAxpy { template struct Functor_TestBatchedTeamVectorAxpy { + using execution_space = typename DeviceType::execution_space; const alphaViewType _alpha; const ViewType _X; const ViewType _Y; @@ -66,8 +67,8 @@ struct Functor_TestBatchedTeamVectorAxpy { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::TeamPolicy policy(_X.extent(0) / _N_team, - Kokkos::AUTO(), Kokkos::AUTO()); + Kokkos::TeamPolicy policy(_X.extent(0) / _N_team, + Kokkos::AUTO(), Kokkos::AUTO()); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_TeamVectorEigendecomposition.hpp b/batched/dense/unit_test/Test_Batched_TeamVectorEigendecomposition.hpp index 69cab9c63c..bf907feb96 100644 --- a/batched/dense/unit_test/Test_Batched_TeamVectorEigendecomposition.hpp +++ b/batched/dense/unit_test/Test_Batched_TeamVectorEigendecomposition.hpp @@ -74,7 +74,7 @@ name_value_type = ( std::is_same::value ? "::Float" : "::ComplexFloat" : std::is_same >::value ? "::ComplexDouble" : "::UnknownValueType" ); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion( name.c_str() ); - Kokkos::TeamPolicy policy(_A.extent(0), Kokkos::AUTO); + Kokkos::TeamPolicy policy(_A.extent(0), Kokkos::AUTO); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_TeamVectorGemm.hpp b/batched/dense/unit_test/Test_Batched_TeamVectorGemm.hpp index 327f28353e..f2f3bc217d 100644 --- a/batched/dense/unit_test/Test_Batched_TeamVectorGemm.hpp +++ b/batched/dense/unit_test/Test_Batched_TeamVectorGemm.hpp @@ -36,6 +36,7 @@ struct ParamTag { template struct Functor_TestBatchedTeamVector { + using execution_space = typename DeviceType::execution_space; ViewType _a, _b, _c; ScalarType _alpha, _beta; @@ -68,8 +69,8 @@ struct Functor_TestBatchedTeamVector { std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); const int league_size = _c.extent(0); - Kokkos::TeamPolicy policy(league_size, - Kokkos::AUTO); + Kokkos::TeamPolicy policy(league_size, + Kokkos::AUTO); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/dense/unit_test/Test_Batched_TeamVectorGesv.hpp b/batched/dense/unit_test/Test_Batched_TeamVectorGesv.hpp index 2026f2f81d..ddb1a5c40d 100644 --- a/batched/dense/unit_test/Test_Batched_TeamVectorGesv.hpp +++ b/batched/dense/unit_test/Test_Batched_TeamVectorGesv.hpp @@ -35,6 +35,7 @@ namespace TeamVectorGesv { template struct Functor_TestBatchedTeamVectorGesv { + using execution_space = typename DeviceType::execution_space; const MatrixType _A; const VectorType _X; const VectorType _B; @@ -63,8 +64,8 @@ struct Functor_TestBatchedTeamVectorGesv { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::TeamPolicy policy(_X.extent(0), Kokkos::AUTO(), - Kokkos::AUTO()); + Kokkos::TeamPolicy policy(_X.extent(0), Kokkos::AUTO(), + Kokkos::AUTO()); using MatrixViewType = Kokkos::View struct Functor_TestBatchedTeamVectorQR { + using execution_space = typename DeviceType::execution_space; MatrixViewType _a; VectorViewType _x, _b, _t; WorkViewType _w; @@ -99,7 +100,7 @@ struct Functor_TestBatchedTeamVectorQR { Kokkos::Profiling::pushRegion(name.c_str()); const int league_size = _a.extent(0); - Kokkos::TeamPolicy policy(league_size, Kokkos::AUTO); + Kokkos::TeamPolicy policy(league_size, Kokkos::AUTO); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); diff --git a/batched/dense/unit_test/Test_Batched_TeamVectorQR_WithColumnPivoting.hpp b/batched/dense/unit_test/Test_Batched_TeamVectorQR_WithColumnPivoting.hpp index c86d4e86a8..09427aa25e 100644 --- a/batched/dense/unit_test/Test_Batched_TeamVectorQR_WithColumnPivoting.hpp +++ b/batched/dense/unit_test/Test_Batched_TeamVectorQR_WithColumnPivoting.hpp @@ -35,6 +35,7 @@ namespace Test { template struct Functor_TestBatchedTeamVectorQR_WithColumnPivoting { + using execution_space = typename DeviceType::execution_space; MatrixViewType _a; VectorViewType _x, _b, _t; PivotViewType _p; @@ -108,7 +109,7 @@ struct Functor_TestBatchedTeamVectorQR_WithColumnPivoting { Kokkos::Profiling::pushRegion(name.c_str()); const int league_size = _a.extent(0); - Kokkos::TeamPolicy policy(league_size, Kokkos::AUTO); + Kokkos::TeamPolicy policy(league_size, Kokkos::AUTO); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); diff --git a/batched/dense/unit_test/Test_Batched_TeamVectorSolveUTV.hpp b/batched/dense/unit_test/Test_Batched_TeamVectorSolveUTV.hpp index 29496c1b87..2f30c7d3c1 100644 --- a/batched/dense/unit_test/Test_Batched_TeamVectorSolveUTV.hpp +++ b/batched/dense/unit_test/Test_Batched_TeamVectorSolveUTV.hpp @@ -35,6 +35,7 @@ namespace Test { template struct Functor_TestBatchedTeamVectorSolveUTV { + using execution_space = typename DeviceType::execution_space; MatrixViewType _r, _a, _acopy, _u, _v; PivViewType _p; VectorViewType _x, _b; @@ -121,7 +122,7 @@ struct Functor_TestBatchedTeamVectorSolveUTV { Kokkos::Profiling::pushRegion(name.c_str()); const int league_size = _a.extent(0); - Kokkos::TeamPolicy policy(league_size, Kokkos::AUTO); + Kokkos::TeamPolicy policy(league_size, Kokkos::AUTO); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); diff --git a/batched/dense/unit_test/Test_Batched_TeamVectorSolveUTV2.hpp b/batched/dense/unit_test/Test_Batched_TeamVectorSolveUTV2.hpp index 45d6093f2a..cf7084a92c 100644 --- a/batched/dense/unit_test/Test_Batched_TeamVectorSolveUTV2.hpp +++ b/batched/dense/unit_test/Test_Batched_TeamVectorSolveUTV2.hpp @@ -35,6 +35,7 @@ namespace Test { template struct Functor_TestBatchedTeamVectorSolveUTV2 { + using execution_space = typename DeviceType::execution_space; MatrixViewType _r, _a, _acopy, _u, _v; PivViewType _p; VectorViewType _x, _b; @@ -125,7 +126,7 @@ struct Functor_TestBatchedTeamVectorSolveUTV2 { Kokkos::Profiling::pushRegion(name.c_str()); const int league_size = _a.extent(0); - Kokkos::TeamPolicy policy(league_size, Kokkos::AUTO); + Kokkos::TeamPolicy policy(league_size, Kokkos::AUTO); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); diff --git a/batched/dense/unit_test/Test_Batched_TeamVectorUTV.hpp b/batched/dense/unit_test/Test_Batched_TeamVectorUTV.hpp index 527c93e059..eb45a70c89 100644 --- a/batched/dense/unit_test/Test_Batched_TeamVectorUTV.hpp +++ b/batched/dense/unit_test/Test_Batched_TeamVectorUTV.hpp @@ -34,6 +34,7 @@ namespace Test { template struct Functor_TestBatchedTeamVectorUTV { + using execution_space = typename DeviceType::execution_space; MatrixViewType _r, _a, _acopy, _u, _v; PivViewType _p; VectorViewType _x, _b; @@ -155,7 +156,7 @@ struct Functor_TestBatchedTeamVectorUTV { Kokkos::Profiling::pushRegion(name.c_str()); const int league_size = _a.extent(0); - Kokkos::TeamPolicy policy(league_size, Kokkos::AUTO); + Kokkos::TeamPolicy policy(league_size, Kokkos::AUTO); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); diff --git a/batched/sparse/unit_test/Test_Batched_SerialGMRES.hpp b/batched/sparse/unit_test/Test_Batched_SerialGMRES.hpp index 45b6a71f99..e28efb9b82 100644 --- a/batched/sparse/unit_test/Test_Batched_SerialGMRES.hpp +++ b/batched/sparse/unit_test/Test_Batched_SerialGMRES.hpp @@ -32,6 +32,7 @@ namespace GMRES { template struct Functor_TestBatchedSerialGMRES { + using execution_space = typename DeviceType::execution_space; const ValuesViewType _D; const IntView _r; const IntView _c; @@ -85,7 +86,7 @@ struct Functor_TestBatchedSerialGMRES { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _D.extent(0) / _N_team); + Kokkos::RangePolicy policy(0, _D.extent(0) / _N_team); const int N = _D.extent(0); const int n = _X.extent(1); diff --git a/batched/sparse/unit_test/Test_Batched_SerialSpmv.hpp b/batched/sparse/unit_test/Test_Batched_SerialSpmv.hpp index 338a93d0eb..05f2724c5b 100644 --- a/batched/sparse/unit_test/Test_Batched_SerialSpmv.hpp +++ b/batched/sparse/unit_test/Test_Batched_SerialSpmv.hpp @@ -41,6 +41,7 @@ template struct Functor_TestBatchedSerialSpmv { + using execution_space = typename DeviceType::execution_space; const alphaViewType _alpha; const ValuesViewType _D; const IntView _r; @@ -75,7 +76,7 @@ struct Functor_TestBatchedSerialSpmv { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _D.extent(0)); + Kokkos::RangePolicy policy(0, _D.extent(0)); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); } diff --git a/batched/sparse/unit_test/Test_Batched_TeamCG.hpp b/batched/sparse/unit_test/Test_Batched_TeamCG.hpp index 41fa682bdd..b05f3db61f 100644 --- a/batched/sparse/unit_test/Test_Batched_TeamCG.hpp +++ b/batched/sparse/unit_test/Test_Batched_TeamCG.hpp @@ -31,6 +31,7 @@ namespace TeamCG { template struct Functor_TestBatchedTeamCG { + using execution_space = typename DeviceType::execution_space; const ValuesViewType _D; const IntView _r; const IntView _c; @@ -79,8 +80,8 @@ struct Functor_TestBatchedTeamCG { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::TeamPolicy policy(_D.extent(0) / _N_team, - Kokkos::AUTO(), Kokkos::AUTO()); + Kokkos::TeamPolicy policy(_D.extent(0) / _N_team, + Kokkos::AUTO(), Kokkos::AUTO()); size_t bytes_0 = ValuesViewType::shmem_size(_N_team, _X.extent(1)); size_t bytes_1 = ValuesViewType::shmem_size(_N_team, 1); diff --git a/batched/sparse/unit_test/Test_Batched_TeamGMRES.hpp b/batched/sparse/unit_test/Test_Batched_TeamGMRES.hpp index 2b7ab73790..de1a7f4fc2 100644 --- a/batched/sparse/unit_test/Test_Batched_TeamGMRES.hpp +++ b/batched/sparse/unit_test/Test_Batched_TeamGMRES.hpp @@ -32,6 +32,7 @@ namespace TeamGMRES { template struct Functor_TestBatchedTeamGMRES { + using execution_space = typename DeviceType::execution_space; const ValuesViewType _D; const IntView _r; const IntView _c; @@ -91,8 +92,8 @@ struct Functor_TestBatchedTeamGMRES { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::TeamPolicy policy(_D.extent(0) / _N_team, - Kokkos::AUTO(), Kokkos::AUTO()); + Kokkos::TeamPolicy policy(_D.extent(0) / _N_team, + Kokkos::AUTO(), Kokkos::AUTO()); const int N = _D.extent(0); const int n = _X.extent(1); diff --git a/batched/sparse/unit_test/Test_Batched_TeamSpmv.hpp b/batched/sparse/unit_test/Test_Batched_TeamSpmv.hpp index 5c077f75ed..a6c9ac7ea8 100644 --- a/batched/sparse/unit_test/Test_Batched_TeamSpmv.hpp +++ b/batched/sparse/unit_test/Test_Batched_TeamSpmv.hpp @@ -42,6 +42,7 @@ template struct Functor_TestBatchedTeamSpmv { + using execution_space = typename DeviceType::execution_space; const alphaViewType _alpha; const ValuesViewType _D; const IntView _r; @@ -99,7 +100,7 @@ struct Functor_TestBatchedTeamSpmv { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::TeamPolicy policy( + Kokkos::TeamPolicy policy( _D.extent(0) / _N_team, Kokkos::AUTO(), Kokkos::AUTO()); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); diff --git a/batched/sparse/unit_test/Test_Batched_TeamVectorCG.hpp b/batched/sparse/unit_test/Test_Batched_TeamVectorCG.hpp index abadf27953..3ffd68209b 100644 --- a/batched/sparse/unit_test/Test_Batched_TeamVectorCG.hpp +++ b/batched/sparse/unit_test/Test_Batched_TeamVectorCG.hpp @@ -31,6 +31,7 @@ namespace TeamVectorCG { template struct Functor_TestBatchedTeamVectorCG { + using execution_space = typename DeviceType::execution_space; const ValuesViewType _D; const IntView _r; const IntView _c; @@ -81,8 +82,8 @@ struct Functor_TestBatchedTeamVectorCG { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::TeamPolicy policy(_D.extent(0) / _N_team, - Kokkos::AUTO(), Kokkos::AUTO()); + Kokkos::TeamPolicy policy(_D.extent(0) / _N_team, + Kokkos::AUTO(), Kokkos::AUTO()); size_t bytes_0 = ValuesViewType::shmem_size(_N_team, _X.extent(1)); size_t bytes_1 = ValuesViewType::shmem_size(_N_team, 1); diff --git a/batched/sparse/unit_test/Test_Batched_TeamVectorGMRES.hpp b/batched/sparse/unit_test/Test_Batched_TeamVectorGMRES.hpp index f4f208a829..084b623aa2 100644 --- a/batched/sparse/unit_test/Test_Batched_TeamVectorGMRES.hpp +++ b/batched/sparse/unit_test/Test_Batched_TeamVectorGMRES.hpp @@ -32,6 +32,7 @@ namespace TeamVectorGMRES { template struct Functor_TestBatchedTeamVectorGMRES { + using execution_space = typename DeviceType::execution_space; const ValuesViewType _D; const IntView _r; const IntView _c; @@ -91,8 +92,8 @@ struct Functor_TestBatchedTeamVectorGMRES { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::TeamPolicy policy(_D.extent(0) / _N_team, - Kokkos::AUTO(), Kokkos::AUTO()); + Kokkos::TeamPolicy policy(_D.extent(0) / _N_team, + Kokkos::AUTO(), Kokkos::AUTO()); const int N = _D.extent(0); const int n = _X.extent(1); diff --git a/batched/sparse/unit_test/Test_Batched_TeamVectorSpmv.hpp b/batched/sparse/unit_test/Test_Batched_TeamVectorSpmv.hpp index 67d944b159..9cbba56370 100644 --- a/batched/sparse/unit_test/Test_Batched_TeamVectorSpmv.hpp +++ b/batched/sparse/unit_test/Test_Batched_TeamVectorSpmv.hpp @@ -42,6 +42,7 @@ template struct Functor_TestBatchedTeamVectorSpmv { + using execution_space = typename DeviceType::execution_space; const alphaViewType _alpha; const ValuesViewType _D; const IntView _r; @@ -106,7 +107,7 @@ struct Functor_TestBatchedTeamVectorSpmv { const std::string name_value_type = Test::value_type_name(); std::string name = name_region + name_value_type; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::TeamPolicy policy( + Kokkos::TeamPolicy policy( ceil(static_cast(_D.extent(0)) / _N_team), Kokkos::AUTO(), Kokkos::AUTO()); Kokkos::parallel_for(name.c_str(), policy, *this); diff --git a/blas/unit_test/Test_Blas1_rotg.hpp b/blas/unit_test/Test_Blas1_rotg.hpp index 338eaa1b56..8efcb50182 100644 --- a/blas/unit_test/Test_Blas1_rotg.hpp +++ b/blas/unit_test/Test_Blas1_rotg.hpp @@ -16,12 +16,12 @@ #include namespace Test { -template -void test_rotg_impl(ExecSpace const& space, Scalar const a_in, - Scalar const b_in) { +template +void test_rotg_impl(typename Device::execution_space const& space, + Scalar const a_in, Scalar const b_in) { using magnitude_type = typename Kokkos::ArithTraits::mag_type; - using SViewType = Kokkos::View; - using MViewType = Kokkos::View; + using SViewType = Kokkos::View; + using MViewType = Kokkos::View; // const magnitude_type eps = Kokkos::ArithTraits::eps(); // const Scalar zero = Kokkos::ArithTraits::zero(); @@ -43,17 +43,17 @@ void test_rotg_impl(ExecSpace const& space, Scalar const a_in, } } // namespace Test -template +template int test_rotg() { const Scalar zero = Kokkos::ArithTraits::zero(); const Scalar one = Kokkos::ArithTraits::one(); const Scalar two = one + one; - ExecutionSpace space{}; + typename Device::execution_space space{}; - Test::test_rotg_impl(space, one, zero); - Test::test_rotg_impl(space, one / two, one / two); - Test::test_rotg_impl(space, 2.1 * one, 1.3 * one); + Test::test_rotg_impl(space, one, zero); + Test::test_rotg_impl(space, one / two, one / two); + Test::test_rotg_impl(space, 2.1 * one, 1.3 * one); return 1; } diff --git a/blas/unit_test/Test_Blas1_rotmg.hpp b/blas/unit_test/Test_Blas1_rotmg.hpp index f628505d97..ecfc3b6815 100644 --- a/blas/unit_test/Test_Blas1_rotmg.hpp +++ b/blas/unit_test/Test_Blas1_rotmg.hpp @@ -218,14 +218,10 @@ void set_rotmg_input_ref_vals(const int test_case, View0& d1, View0& d2, } } // namespace Test -template +template int test_rotmg() { - Kokkos::View> - d1("d1"), d2("d2"), x1("x1"), y1("y1"); - Kokkos::View> - param("param"); + Kokkos::View d1("d1"), d2("d2"), x1("x1"), y1("y1"); + Kokkos::View param("param"); Kokkos::View ref_vals( "reference values"); diff --git a/blas/unit_test/Test_Blas1_serial_setscal.hpp b/blas/unit_test/Test_Blas1_serial_setscal.hpp index 80a0561d60..6c55ef65e3 100644 --- a/blas/unit_test/Test_Blas1_serial_setscal.hpp +++ b/blas/unit_test/Test_Blas1_serial_setscal.hpp @@ -87,7 +87,8 @@ struct Functor_TestBlasSerialMatUtil { std::string name = name_region + name_value_type + name_work_tag + name_test_id; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _a.extent(0)); + Kokkos::RangePolicy + policy(0, _a.extent(0)); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); return 0; diff --git a/blas/unit_test/Test_Blas1_team_abs.hpp b/blas/unit_test/Test_Blas1_team_abs.hpp index d3f4f661d0..642be144e4 100644 --- a/blas/unit_test/Test_Blas1_team_abs.hpp +++ b/blas/unit_test/Test_Blas1_team_abs.hpp @@ -29,7 +29,8 @@ namespace Test { template void impl_test_team_abs(int N) { - typedef Kokkos::TeamPolicy team_policy; + using execution_space = typename Device::execution_space; + typedef Kokkos::TeamPolicy team_policy; typedef typename team_policy::member_type team_member; // Launch M teams of the maximum number of threads per team @@ -109,7 +110,8 @@ void impl_test_team_abs(int N) { template void impl_test_team_abs_mv(int N, int K) { - typedef Kokkos::TeamPolicy team_policy; + using execution_space = typename Device::execution_space; + typedef Kokkos::TeamPolicy team_policy; typedef typename team_policy::member_type team_member; // Launch K teams of the maximum number of threads per team @@ -122,8 +124,7 @@ void impl_test_team_abs_mv(int N, int K) { view_stride_adapter x("X", N, K); view_stride_adapter y("Y", N, K); - Kokkos::Random_XorShift64_Pool rand_pool( - 13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(x.d_view, rand_pool, ScalarA(1)); Kokkos::fill_random(y.d_view, rand_pool, ScalarB(1)); diff --git a/blas/unit_test/Test_Blas1_team_axpby.hpp b/blas/unit_test/Test_Blas1_team_axpby.hpp index e11b1e14a5..7052371bdb 100644 --- a/blas/unit_test/Test_Blas1_team_axpby.hpp +++ b/blas/unit_test/Test_Blas1_team_axpby.hpp @@ -29,7 +29,8 @@ namespace Test { template void impl_test_team_axpby(int N) { - typedef Kokkos::TeamPolicy team_policy; + using execution_space = typename Device::execution_space; + typedef Kokkos::TeamPolicy team_policy; typedef typename team_policy::member_type team_member; // Launch M teams of the maximum number of threads per team @@ -48,8 +49,7 @@ void impl_test_team_axpby(int N) { view_stride_adapter y("Y", N); view_stride_adapter org_y("Y", N); - Kokkos::Random_XorShift64_Pool rand_pool( - 13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(x.d_view, rand_pool, ScalarA(10)); Kokkos::fill_random(y.d_view, rand_pool, ScalarB(10)); @@ -116,7 +116,8 @@ void impl_test_team_axpby(int N) { template void impl_test_team_axpby_mv(int N, int K) { - typedef Kokkos::TeamPolicy team_policy; + using execution_space = typename Device::execution_space; + typedef Kokkos::TeamPolicy team_policy; typedef typename team_policy::member_type team_member; // Launch K teams of the maximum number of threads per team @@ -129,8 +130,7 @@ void impl_test_team_axpby_mv(int N, int K) { view_stride_adapter y("Y", N, K); view_stride_adapter org_y("Org_Y", N, K); - Kokkos::Random_XorShift64_Pool rand_pool( - 13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(x.d_view, rand_pool, ScalarA(10)); Kokkos::fill_random(y.d_view, rand_pool, ScalarB(10)); diff --git a/blas/unit_test/Test_Blas1_team_axpy.hpp b/blas/unit_test/Test_Blas1_team_axpy.hpp index 5cff9d025e..87a4a80fba 100644 --- a/blas/unit_test/Test_Blas1_team_axpy.hpp +++ b/blas/unit_test/Test_Blas1_team_axpy.hpp @@ -29,7 +29,8 @@ namespace Test { template void impl_test_team_axpy(int N) { - typedef Kokkos::TeamPolicy team_policy; + using execution_space = typename Device::execution_space; + typedef Kokkos::TeamPolicy team_policy; typedef typename team_policy::member_type team_member; // Launch M teams of the maximum number of threads per team @@ -113,7 +114,8 @@ void impl_test_team_axpy(int N) { template void impl_test_team_axpy_mv(int N, int K) { - typedef Kokkos::TeamPolicy team_policy; + using execution_space = typename Device::execution_space; + typedef Kokkos::TeamPolicy team_policy; typedef typename team_policy::member_type team_member; // Launch K teams of the maximum number of threads per team @@ -126,8 +128,7 @@ void impl_test_team_axpy_mv(int N, int K) { view_stride_adapter y("Y", N, K); view_stride_adapter org_y("Org_Y", N, K); - Kokkos::Random_XorShift64_Pool rand_pool( - 13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(x.d_view, rand_pool, ScalarA(10)); Kokkos::fill_random(y.d_view, rand_pool, ScalarB(10)); diff --git a/blas/unit_test/Test_Blas1_team_dot.hpp b/blas/unit_test/Test_Blas1_team_dot.hpp index 00c0940023..ec8dad838a 100644 --- a/blas/unit_test/Test_Blas1_team_dot.hpp +++ b/blas/unit_test/Test_Blas1_team_dot.hpp @@ -28,7 +28,8 @@ namespace Test { template void impl_test_team_dot(int N) { - typedef Kokkos::TeamPolicy team_policy; + using execution_space = typename Device::execution_space; + typedef Kokkos::TeamPolicy team_policy; typedef typename team_policy::member_type team_member; // Launch M teams of the maximum number of threads per team @@ -42,8 +43,7 @@ void impl_test_team_dot(int N) { view_stride_adapter a("a", N); view_stride_adapter b("b", N); - Kokkos::Random_XorShift64_Pool rand_pool( - 13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(a.d_view, rand_pool, ScalarA(10)); Kokkos::fill_random(b.d_view, rand_pool, ScalarB(10)); @@ -161,7 +161,8 @@ void impl_test_team_dot(int N) { template void impl_test_team_dot_mv(int N, int K) { - typedef Kokkos::TeamPolicy team_policy; + using execution_space = typename Device::execution_space; + typedef Kokkos::TeamPolicy team_policy; typedef typename team_policy::member_type team_member; // Launch K teams of the maximum number of threads per team @@ -173,8 +174,7 @@ void impl_test_team_dot_mv(int N, int K) { view_stride_adapter a("A", N, K); view_stride_adapter b("B", N, K); - Kokkos::Random_XorShift64_Pool rand_pool( - 13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(a.d_view, rand_pool, ScalarA(10)); Kokkos::fill_random(b.d_view, rand_pool, ScalarB(10)); diff --git a/blas/unit_test/Test_Blas1_team_mult.hpp b/blas/unit_test/Test_Blas1_team_mult.hpp index f340ac2309..e8802a84a6 100644 --- a/blas/unit_test/Test_Blas1_team_mult.hpp +++ b/blas/unit_test/Test_Blas1_team_mult.hpp @@ -29,7 +29,8 @@ namespace Test { template void impl_test_team_mult(int N) { - typedef Kokkos::TeamPolicy team_policy; + using execution_space = typename Device::execution_space; + typedef Kokkos::TeamPolicy team_policy; typedef typename team_policy::member_type team_member; // Launch M teams of the maximum number of threads per team @@ -50,8 +51,7 @@ void impl_test_team_mult(int N) { view_stride_adapter z("Z", N); view_stride_adapter org_z("Org_Z", N); - Kokkos::Random_XorShift64_Pool rand_pool( - 13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(x.d_view, rand_pool, ScalarA(10)); Kokkos::fill_random(y.d_view, rand_pool, ScalarB(10)); @@ -158,7 +158,8 @@ void impl_test_team_mult(int N) { template void impl_test_team_mult_mv(int N, int K) { - typedef Kokkos::TeamPolicy team_policy; + using execution_space = typename Device::execution_space; + typedef Kokkos::TeamPolicy team_policy; typedef typename team_policy::member_type team_member; // Launch K teams of the maximum number of threads per team @@ -174,8 +175,7 @@ void impl_test_team_mult_mv(int N, int K) { view_stride_adapter z("Z", N, K); view_stride_adapter org_z("Org_Z", N, K); - Kokkos::Random_XorShift64_Pool rand_pool( - 13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); typename Kokkos::ArithTraits::mag_type const max_val = 10; Kokkos::fill_random(x.d_view, rand_pool, ScalarA(max_val)); diff --git a/blas/unit_test/Test_Blas1_team_nrm2.hpp b/blas/unit_test/Test_Blas1_team_nrm2.hpp index 4bc4836782..e5008441a4 100644 --- a/blas/unit_test/Test_Blas1_team_nrm2.hpp +++ b/blas/unit_test/Test_Blas1_team_nrm2.hpp @@ -28,7 +28,8 @@ namespace Test { template void impl_test_team_nrm2(int N, int K) { - typedef Kokkos::TeamPolicy team_policy; + using execution_space = typename Device::execution_space; + typedef Kokkos::TeamPolicy team_policy; typedef typename team_policy::member_type team_member; // Launch K teams of the maximum number of threads per team @@ -39,8 +40,7 @@ void impl_test_team_nrm2(int N, int K) { view_stride_adapter a("A", N, K); - Kokkos::Random_XorShift64_Pool rand_pool( - 13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(a.d_view, rand_pool, ScalarA(10)); diff --git a/blas/unit_test/Test_Blas1_team_scal.hpp b/blas/unit_test/Test_Blas1_team_scal.hpp index e0c109e1af..aad2e8723f 100644 --- a/blas/unit_test/Test_Blas1_team_scal.hpp +++ b/blas/unit_test/Test_Blas1_team_scal.hpp @@ -29,7 +29,8 @@ namespace Test { template void impl_test_team_scal(int N) { - typedef Kokkos::TeamPolicy team_policy; + using execution_space = typename Device::execution_space; + typedef Kokkos::TeamPolicy team_policy; typedef typename team_policy::member_type team_member; // Launch M teams of the maximum number of threads per team @@ -49,8 +50,7 @@ void impl_test_team_scal(int N) { typename AT::mag_type zero = AT::abs(AT::zero()); typename AT::mag_type one = AT::abs(AT::one()); - Kokkos::Random_XorShift64_Pool rand_pool( - 13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(x.d_view, rand_pool, ScalarA(1)); @@ -122,7 +122,8 @@ void impl_test_team_scal(int N) { template void impl_test_team_scal_mv(int N, int K) { - typedef Kokkos::TeamPolicy team_policy; + using execution_space = typename Device::execution_space; + typedef Kokkos::TeamPolicy team_policy; typedef typename team_policy::member_type team_member; // Launch K teams of the maximum number of threads per team @@ -135,8 +136,7 @@ void impl_test_team_scal_mv(int N, int K) { view_stride_adapter x("X", N, K); view_stride_adapter y("Y", N, K); - Kokkos::Random_XorShift64_Pool rand_pool( - 13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(x.d_view, rand_pool, ScalarA(1)); Kokkos::deep_copy(x.h_base, x.d_base); diff --git a/blas/unit_test/Test_Blas1_team_setscal.hpp b/blas/unit_test/Test_Blas1_team_setscal.hpp index ff593d3eeb..cae6e68be0 100644 --- a/blas/unit_test/Test_Blas1_team_setscal.hpp +++ b/blas/unit_test/Test_Blas1_team_setscal.hpp @@ -36,6 +36,7 @@ struct NaiveTag {}; template struct Functor_TestBlasTeamMatUtil { + using execution_space = typename DeviceType::execution_space; ScalarType _alpha; ViewType _a; @@ -97,8 +98,8 @@ struct Functor_TestBlasTeamMatUtil { Kokkos::Profiling::pushRegion(name.c_str()); const int league_size = _a.extent(0); - Kokkos::TeamPolicy policy(league_size, - Kokkos::AUTO); + Kokkos::TeamPolicy policy(league_size, + Kokkos::AUTO); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); diff --git a/blas/unit_test/Test_Blas1_team_update.hpp b/blas/unit_test/Test_Blas1_team_update.hpp index 09b60440ae..35182b27fd 100644 --- a/blas/unit_test/Test_Blas1_team_update.hpp +++ b/blas/unit_test/Test_Blas1_team_update.hpp @@ -29,7 +29,8 @@ namespace Test { template void impl_test_team_update(int N) { - typedef Kokkos::TeamPolicy team_policy; + using execution_space = typename Device::execution_space; + typedef Kokkos::TeamPolicy team_policy; typedef typename team_policy::member_type team_member; // Launch M teams of the maximum number of threads per team @@ -51,8 +52,7 @@ void impl_test_team_update(int N) { view_stride_adapter z("Z", N); view_stride_adapter org_z("Org_Z", N); - Kokkos::Random_XorShift64_Pool rand_pool( - 13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(x.d_view, rand_pool, ScalarA(10)); Kokkos::fill_random(y.d_view, rand_pool, ScalarB(10)); @@ -160,7 +160,8 @@ void impl_test_team_update(int N) { template void impl_test_team_update_mv(int N, int K) { - typedef Kokkos::TeamPolicy team_policy; + using execution_space = typename Device::execution_space; + typedef Kokkos::TeamPolicy team_policy; typedef typename team_policy::member_type team_member; // Launch K teams of the maximum number of threads per team @@ -175,8 +176,7 @@ void impl_test_team_update_mv(int N, int K) { view_stride_adapter z("Z", N, K); view_stride_adapter org_z("Org_Z", N, K); - Kokkos::Random_XorShift64_Pool rand_pool( - 13718); + Kokkos::Random_XorShift64_Pool rand_pool(13718); Kokkos::fill_random(x.d_view, rand_pool, ScalarA(10)); Kokkos::fill_random(y.d_view, rand_pool, ScalarB(10)); diff --git a/blas/unit_test/Test_Blas2_gemv_util.hpp b/blas/unit_test/Test_Blas2_gemv_util.hpp index 99b4516cff..80bf76b0dd 100644 --- a/blas/unit_test/Test_Blas2_gemv_util.hpp +++ b/blas/unit_test/Test_Blas2_gemv_util.hpp @@ -239,7 +239,8 @@ struct GEMVTest { template static void run_views(const char trans, ViewTypeA A, ViewTypeX x, ViewTypeY y) { - Kokkos::TeamPolicy teams(1, 1); // just run on device + Kokkos::TeamPolicy teams( + 1, 1); // just run on device fill_inputs(A, x, y); ScalarType alpha = 3; // TODO: test also with zero alpha/beta ? ScalarType beta = 5; @@ -279,7 +280,8 @@ struct GEMVTest { ViewTypeY, Device, ScalarType>; op_type gemv_op(trans, alpha, A, x, beta, y); - Kokkos::parallel_for(Kokkos::TeamPolicy(1, 1), gemv_op); + Kokkos::parallel_for( + Kokkos::TeamPolicy(1, 1), gemv_op); const double eps = epsilon(ScalarY{}); EXPECT_NEAR_KK_REL_1DVIEW(y, y_ref, eps); diff --git a/blas/unit_test/Test_Blas3_gemm.hpp b/blas/unit_test/Test_Blas3_gemm.hpp index 13c52ec437..bc2d881600 100644 --- a/blas/unit_test/Test_Blas3_gemm.hpp +++ b/blas/unit_test/Test_Blas3_gemm.hpp @@ -81,7 +81,7 @@ void build_matrices(const int M, const int N, const int K, const typename ViewTypeA::value_type alpha, ViewTypeA& A, ViewTypeB& B, const typename ViewTypeA::value_type beta, ViewTypeC& C, ViewTypeC& Cref) { - using execution_space = TestExecSpace; + using execution_space = typename TestExecSpace::execution_space; using ScalarA = typename ViewTypeA::non_const_value_type; using ScalarB = typename ViewTypeB::non_const_value_type; using ScalarC = typename ViewTypeC::non_const_value_type; @@ -257,15 +257,16 @@ void impl_test_gemm(const char* TA, const char* TB, int M, int N, int K, } } -template +template void impl_test_stream_gemm_psge2(const int M, const int N, const int K, const Scalar alpha, const Scalar beta) { - using ViewTypeA = Kokkos::View; - using ViewTypeB = Kokkos::View; - using ViewTypeC = Kokkos::View; - using ScalarC = typename ViewTypeC::value_type; - using APT = Kokkos::ArithTraits; - using mag_type = typename APT::mag_type; + using execution_space = typename Device::execution_space; + using ViewTypeA = Kokkos::View; + using ViewTypeB = Kokkos::View; + using ViewTypeC = Kokkos::View; + using ScalarC = typename ViewTypeC::value_type; + using APT = Kokkos::ArithTraits; + using mag_type = typename APT::mag_type; const char tA[] = {"N"}; const char tB[] = {"N"}; @@ -336,6 +337,7 @@ void impl_test_stream_gemm_psge2(const int M, const int N, const int K, template void test_gemm() { + typedef typename TestExecSpace::execution_space execution_space; typedef Kokkos::View view_type_a; typedef Kokkos::View view_type_b; typedef Kokkos::View view_type_c; @@ -371,7 +373,7 @@ void test_gemm() { } } } - auto pool_size = TestExecSpace().concurrency(); + auto pool_size = execution_space().concurrency(); if (pool_size >= 2) { Test::impl_test_stream_gemm_psge2( 53, 42, 17, 4.5, diff --git a/blas/unit_test/Test_Blas_serial_axpy.hpp b/blas/unit_test/Test_Blas_serial_axpy.hpp index 48b417c96d..e6a571b7de 100644 --- a/blas/unit_test/Test_Blas_serial_axpy.hpp +++ b/blas/unit_test/Test_Blas_serial_axpy.hpp @@ -32,6 +32,7 @@ struct NaiveAxpyTag {}; template struct Functor_TestBlasSerialAxpy { + using execution_space = typename DeviceType::execution_space; ScalarType _alpha; ViewType _x; ViewType _y; @@ -71,7 +72,7 @@ struct Functor_TestBlasSerialAxpy { std::string name = name_region + name_value_type + name_work_tag + name_test_id; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _x.extent(0)); + Kokkos::RangePolicy policy(0, _x.extent(0)); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); return; diff --git a/blas/unit_test/Test_Blas_serial_nrm2.hpp b/blas/unit_test/Test_Blas_serial_nrm2.hpp index a4af218ff3..1e0a7a4ffa 100644 --- a/blas/unit_test/Test_Blas_serial_nrm2.hpp +++ b/blas/unit_test/Test_Blas_serial_nrm2.hpp @@ -70,7 +70,7 @@ struct Functor_TestBlasSerialNrm2 { std::string name = name_region + name_value_type + name_work_tag + name_test_id; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _x.extent(0)); + Kokkos::RangePolicy policy(0, _x.extent(0)); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); return; @@ -125,7 +125,7 @@ struct Functor_TestBlasSerialNrm2MV { std::string name = name_region + name_value_type + name_work_tag + name_test_id; Kokkos::Profiling::pushRegion(name.c_str()); - Kokkos::RangePolicy policy(0, _x.extent(0)); + Kokkos::RangePolicy policy(0, _x.extent(0)); Kokkos::parallel_for(name.c_str(), policy, *this); Kokkos::Profiling::popRegion(); return; diff --git a/common/unit_test/Test_Common_ArithTraits.hpp b/common/unit_test/Test_Common_ArithTraits.hpp index 8aa963b2ab..b5bf350847 100644 --- a/common/unit_test/Test_Common_ArithTraits.hpp +++ b/common/unit_test/Test_Common_ArithTraits.hpp @@ -119,7 +119,7 @@ struct HasTranscendentals { template class ArithTraitsTesterBase { public: - typedef DeviceType execution_space; + typedef typename DeviceType::execution_space execution_space; typedef typename execution_space::size_type size_type; //! Type of the result of the reduction. typedef int value_type; @@ -430,7 +430,7 @@ class ArithTraitsTesterTranscendentalBase typedef ArithTraitsTesterBase base_type; public: - typedef DeviceType execution_space; + typedef typename DeviceType::execution_space execution_space; typedef typename execution_space::size_type size_type; //! Type of the result of the reduction. typedef int value_type; @@ -509,7 +509,7 @@ class ArithTraitsTesterTranscendentalBase } public: - typedef DeviceType execution_space; + typedef typename DeviceType::execution_space execution_space; typedef typename execution_space::size_type size_type; //! Type of the result of the reduction. typedef int value_type; @@ -993,7 +993,7 @@ class ArithTraitsTesterComplexBase typedef ArithTraitsTesterTranscendentalBase base_type; public: - typedef DeviceType execution_space; + typedef typename DeviceType::execution_space execution_space; typedef typename execution_space::size_type size_type; //! Type of the result of the reduction. typedef int value_type; @@ -1079,7 +1079,7 @@ class ArithTraitsTesterComplexBase typedef ArithTraitsTesterTranscendentalBase base_type; public: - typedef DeviceType execution_space; + typedef typename DeviceType::execution_space execution_space; typedef typename execution_space::size_type size_type; //! Type of the result of the reduction. typedef int value_type; @@ -1217,7 +1217,7 @@ class ArithTraitsTesterFloatingPointBase base_type; public: - typedef DeviceType execution_space; + typedef typename DeviceType::execution_space execution_space; typedef typename execution_space::size_type size_type; //! Type of the result of the reduction. typedef int value_type; @@ -1336,7 +1336,7 @@ class ArithTraitsTesterFloatingPointBase base_type; public: - typedef DeviceType execution_space; + typedef typename DeviceType::execution_space execution_space; typedef typename execution_space::size_type size_type; //! Type of the result of the reduction. typedef int value_type; @@ -1417,7 +1417,7 @@ template class ArithTraitsTester : public ArithTraitsTesterFloatingPointBase { public: - typedef DeviceType execution_space; + typedef typename DeviceType::execution_space execution_space; typedef typename execution_space::size_type size_type; //! Type of the result of the reduction. typedef int value_type; diff --git a/common/unit_test/Test_Common_Sorting.hpp b/common/unit_test/Test_Common_Sorting.hpp index 51ecf228a8..6969453395 100644 --- a/common/unit_test/Test_Common_Sorting.hpp +++ b/common/unit_test/Test_Common_Sorting.hpp @@ -178,17 +178,18 @@ struct TestSerialRadix2Functor { OrdView offsets; }; -template +template void testSerialRadixSort(size_t k, size_t subArraySize) { // Create a view of randomized data - typedef typename ExecSpace::memory_space mem_space; + typedef typename Device::execution_space exec_space; + typedef typename Device::memory_space mem_space; typedef Kokkos::View OrdView; typedef Kokkos::View KeyView; OrdView counts("Subarray Sizes", k); OrdView offsets("Subarray Offsets", k); // Generate k sub-array sizes, each with size about 20 - size_t n = generateRandomOffsets(counts, offsets, k, - subArraySize); + size_t n = generateRandomOffsets(counts, offsets, k, + subArraySize); KeyView keys("Radix sort testing data", n); fillRandom(keys); // Sort using std::sort on host to do correctness test @@ -196,11 +197,11 @@ void testSerialRadixSort(size_t k, size_t subArraySize) { Kokkos::deep_copy(gold, keys); KeyView keysAux("Radix sort aux data", n); // Run the sorting on device in all sub-arrays in parallel - typedef Kokkos::RangePolicy range_policy; + typedef Kokkos::RangePolicy range_policy; Kokkos::parallel_for( range_policy(0, k), TestSerialRadixFunctor(keys, keysAux, counts, offsets)); - ExecSpace().fence(); + exec_space().fence(); auto countsHost = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), counts); auto offsetsHost = @@ -218,18 +219,19 @@ void testSerialRadixSort(size_t k, size_t subArraySize) { } } -template +template void testSerialRadixSort2(size_t k, size_t subArraySize) { // Create a view of randomized data - typedef typename ExecSpace::memory_space mem_space; + typedef typename Device::execution_space exec_space; + typedef typename Device::memory_space mem_space; typedef Kokkos::View OrdView; typedef Kokkos::View KeyView; typedef Kokkos::View ValView; OrdView counts("Subarray Sizes", k); OrdView offsets("Subarray Offsets", k); // Generate k sub-array sizes, each with size about 20 - size_t n = generateRandomOffsets(counts, offsets, k, - subArraySize); + size_t n = generateRandomOffsets(counts, offsets, k, + subArraySize); KeyView keys("Radix test keys", n); ValView data("Radix test data", n); // The keys are randomized @@ -239,12 +241,12 @@ void testSerialRadixSort2(size_t k, size_t subArraySize) { KeyView keysAux("Radix sort aux keys", n); ValView dataAux("Radix sort aux data", n); // Run the sorting on device in all sub-arrays in parallel - typedef Kokkos::RangePolicy range_policy; + typedef Kokkos::RangePolicy range_policy; // Deliberately using a weird number for vector length Kokkos::parallel_for(range_policy(0, k), TestSerialRadix2Functor( keys, keysAux, data, dataAux, counts, offsets)); - ExecSpace().fence(); + exec_space().fence(); // Sort using std::sort on host to do correctness test auto countsHost = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), counts); @@ -312,30 +314,31 @@ struct TestTeamBitonic2Functor { OrdView offsets; }; -template +template void testTeamBitonicSort(size_t k, size_t subArraySize) { // Create a view of randomized data - typedef typename ExecSpace::memory_space mem_space; + typedef typename Device::execution_space exec_space; + typedef typename Device::memory_space mem_space; typedef Kokkos::View OrdView; typedef Kokkos::View ValView; OrdView counts("Subarray Sizes", k); OrdView offsets("Subarray Offsets", k); // Generate k sub-array sizes, each with size about 20 - size_t n = generateRandomOffsets(counts, offsets, k, - subArraySize); + size_t n = generateRandomOffsets(counts, offsets, k, + subArraySize); ValView data("Bitonic sort testing data", n); fillRandom(data); Kokkos::View gold("Host sorted", n); Kokkos::deep_copy(gold, data); // Run the sorting on device in all sub-arrays in parallel Kokkos::parallel_for( - Kokkos::TeamPolicy(k, Kokkos::AUTO()), + Kokkos::TeamPolicy(k, Kokkos::AUTO()), TestTeamBitonicFunctor(data, counts, offsets)); // Copy result to host auto dataHost = Kokkos::create_mirror_view(data); Kokkos::deep_copy(dataHost, data); // Sort using std::sort on host to do correctness test - ExecSpace().fence(); + exec_space().fence(); auto countsHost = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), counts); auto offsetsHost = @@ -350,18 +353,19 @@ void testTeamBitonicSort(size_t k, size_t subArraySize) { } } -template +template void testTeamBitonicSort2(size_t k, size_t subArraySize) { // Create a view of randomized data - typedef typename ExecSpace::memory_space mem_space; + typedef typename Device::execution_space exec_space; + typedef typename Device::memory_space mem_space; typedef Kokkos::View OrdView; typedef Kokkos::View KeyView; typedef Kokkos::View ValView; OrdView counts("Subarray Sizes", k); OrdView offsets("Subarray Offsets", k); // Generate k sub-array sizes, each with size about 20 - size_t n = generateRandomOffsets(counts, offsets, k, - subArraySize); + size_t n = generateRandomOffsets(counts, offsets, k, + subArraySize); KeyView keys("Bitonic test keys", n); ValView data("Bitonic test data", n); // The keys are randomized @@ -370,10 +374,10 @@ void testTeamBitonicSort2(size_t k, size_t subArraySize) { Kokkos::deep_copy(gold, keys); // Run the sorting on device in all sub-arrays in parallel, just using vector // loops Deliberately using a weird number for vector length - Kokkos::parallel_for(Kokkos::TeamPolicy(k, Kokkos::AUTO()), + Kokkos::parallel_for(Kokkos::TeamPolicy(k, Kokkos::AUTO()), TestTeamBitonic2Functor( keys, data, counts, offsets)); - ExecSpace().fence(); + exec_space().fence(); auto countsHost = Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace(), counts); auto offsetsHost = @@ -409,16 +413,17 @@ struct CheckSortedFunctor { View v; }; -template +template void testBitonicSort(size_t n) { // Create a view of randomized data - typedef typename ExecSpace::memory_space mem_space; + typedef typename Device::execution_space exec_space; + typedef typename Device::memory_space mem_space; typedef Kokkos::View ValView; ValView data("Bitonic sort testing data", n); fillRandom(data); - KokkosKernels::bitonicSort(data); + KokkosKernels::bitonicSort(data); int ordered = 1; - Kokkos::parallel_reduce(Kokkos::RangePolicy(0, n - 1), + Kokkos::parallel_reduce(Kokkos::RangePolicy(0, n - 1), CheckSortedFunctor(data), Kokkos::Min(ordered)); ASSERT_TRUE(ordered); @@ -444,19 +449,20 @@ struct CompareDescending { } }; -template +template void testBitonicSortDescending() { + typedef typename Device::execution_space exec_space; + typedef typename Device::memory_space mem_space; typedef char Scalar; typedef CompareDescending Comp; // Create a view of randomized data - typedef typename ExecSpace::memory_space mem_space; typedef Kokkos::View ValView; size_t n = 12521; ValView data("Bitonic sort testing data", n); fillRandom(data); - KokkosKernels::bitonicSort(data); + KokkosKernels::bitonicSort(data); int ordered = 1; - Kokkos::parallel_reduce(Kokkos::RangePolicy(0, n - 1), + Kokkos::parallel_reduce(Kokkos::RangePolicy(0, n - 1), CheckOrderedFunctor(data), Kokkos::Min(ordered)); ASSERT_TRUE(ordered); @@ -479,18 +485,19 @@ struct LexCompare { } }; -template +template void testBitonicSortLexicographic() { + typedef typename Device::execution_space exec_space; + typedef typename Device::memory_space mem_space; typedef Coordinates Scalar; // Create a view of randomized data - typedef typename ExecSpace::memory_space mem_space; typedef Kokkos::View ValView; size_t n = 9521; ValView data("Bitonic sort testing data", n); fillRandom(data); - KokkosKernels::bitonicSort(data); + KokkosKernels::bitonicSort(data); int ordered = 1; - Kokkos::parallel_reduce(Kokkos::RangePolicy(0, n - 1), + Kokkos::parallel_reduce(Kokkos::RangePolicy(0, n - 1), CheckOrderedFunctor(data), Kokkos::Min(ordered)); ASSERT_TRUE(ordered); diff --git a/graph/unit_test/Test_Graph_graph_color.hpp b/graph/unit_test/Test_Graph_graph_color.hpp index 19ee9f600b..ee917e6ef4 100644 --- a/graph/unit_test/Test_Graph_graph_color.hpp +++ b/graph/unit_test/Test_Graph_graph_color.hpp @@ -96,9 +96,10 @@ void test_coloring(lno_t numRows, size_type nnz, lno_t bandwidth, KokkosKernels::Impl::symmetrize_graph_symbolic_hashmap< lno_view_t, lno_nnz_view_t, typename lno_view_t::non_const_type, - typename lno_nnz_view_t::non_const_type, device>( - numRows, input_mat.graph.row_map, input_mat.graph.entries, sym_xadj, - sym_adj); + typename lno_nnz_view_t::non_const_type, + typename device::execution_space>(numRows, input_mat.graph.row_map, + input_mat.graph.entries, sym_xadj, + sym_adj); size_type numentries = sym_adj.extent(0); scalar_view_t newValues("vals", numentries); diff --git a/ode/unit_test/Test_ODE_Newton.hpp b/ode/unit_test/Test_ODE_Newton.hpp index 44a299b949..7cc3fd2a6d 100644 --- a/ode/unit_test/Test_ODE_Newton.hpp +++ b/ode/unit_test/Test_ODE_Newton.hpp @@ -75,17 +75,17 @@ struct NewtonSolve_wrapper { } }; -template +template void run_newton_test(const system_type& mySys, KokkosODE::Experimental::Newton_params& params, const scalar_type* const initial_val, const scalar_type* const solution) { + using execution_space = typename Device::execution_space; using newton_solver_status = KokkosODE::Experimental::newton_solver_status; - using vec_type = typename Kokkos::View; - using mat_type = typename Kokkos::View; + using vec_type = typename Kokkos::View; + using mat_type = typename Kokkos::View; - Kokkos::View status("Newton status", - 1); + Kokkos::View status("Newton status", 1); vec_type x("solution vector", mySys.neqs), rhs("right hand side vector", mySys.neqs); @@ -136,10 +136,10 @@ void run_newton_test(const system_type& mySys, // x^2 - x - 2 = 0 // Solution: x = 2 or x = -1 // Derivative 2*x - 1 -template +template struct QuadraticEquation { - using vec_type = Kokkos::View; - using mat_type = Kokkos::View; + using vec_type = Kokkos::View; + using mat_type = Kokkos::View; static constexpr int neqs = 1; @@ -198,11 +198,12 @@ struct LogarithmicEquation { } }; -template +template void test_newton_status() { + using execution_space = typename Device::execution_space; using newton_solver_status = KokkosODE::Experimental::newton_solver_status; - using vec_type = typename Kokkos::View; - using mat_type = typename Kokkos::View; + using vec_type = typename Kokkos::View; + using mat_type = typename Kokkos::View; double abs_tol, rel_tol; if (std::is_same_v) { @@ -220,7 +221,7 @@ void test_newton_status() { auto status_h = Kokkos::create_mirror_view(status); // Create the non-linear system and initialize data - QuadraticEquation my_system{}; + QuadraticEquation my_system{}; scalar_type initial_value[3] = {1.0, -0.5, 0.5}; #ifdef HAVE_KOKKOSKERNELS_DEBUG @@ -259,8 +260,9 @@ void test_newton_status() { } } -template +template void test_simple_problems() { + using execution_space = typename Device::execution_space; double abs_tol, rel_tol; if (std::is_same_v) { rel_tol = 10e-5; @@ -280,11 +282,11 @@ void test_simple_problems() { #ifdef HAVE_KOKKOSKERNELS_DEBUG std::cout << "\nStarting Quadratic Equation problem" << std::endl; #endif - using system_type = QuadraticEquation; + using system_type = QuadraticEquation; system_type mySys{}; scalar_type initial_value[2] = {1.0, -0.5}, solution[2] = {2.0, -1.0}; for (int idx = 0; idx < 2; ++idx) { - run_newton_test( + run_newton_test( mySys, params, &(initial_value[idx]), &(solution[idx])); } #ifdef HAVE_KOKKOSKERNELS_DEBUG @@ -300,8 +302,8 @@ void test_simple_problems() { using system_type = TrigonometricEquation; system_type mySys{}; scalar_type initial_value[1] = {0.1}, solution[1] = {0.739085}; - run_newton_test( - mySys, params, initial_value, solution); + run_newton_test(mySys, params, + initial_value, solution); #ifdef HAVE_KOKKOSKERNELS_DEBUG std::cout << "Finished Trigonometric Equation problem" << std::endl; #endif @@ -317,8 +319,8 @@ void test_simple_problems() { scalar_type initial_value[1] = {static_cast(0.5)}, solution[1] = {static_cast(1.0) / static_cast(7.0)}; - run_newton_test( - mySys, params, initial_value, solution); + run_newton_test(mySys, params, + initial_value, solution); #ifdef HAVE_KOKKOSKERNELS_DEBUG std::cout << "Finished Logarithmic Equation problem" << std::endl; #endif @@ -340,10 +342,10 @@ void test_simple_problems() { // // Solution: x = 10.75/6 y = +/- sqrt(2.25 + 7.25/6) // ~ 1.7916666 ~ +/- 0.8887803753 -template +template struct CirclesIntersections { - using vec_type = Kokkos::View; - using mat_type = Kokkos::View; + using vec_type = Kokkos::View; + using mat_type = Kokkos::View; static constexpr int neqs = 2; @@ -374,10 +376,10 @@ struct CirclesIntersections { // x1~ 0.5176380902 y1~ 1.9318516525 // x2~ -0.5176380902 y2~ -1.9318516525 // x3~ -1.9318516525 y3~ -0.5176380902 -template +template struct CircleHyperbolaIntersection { - using vec_type = Kokkos::View; - using mat_type = Kokkos::View; + using vec_type = Kokkos::View; + using mat_type = Kokkos::View; static constexpr int neqs = 2; @@ -396,8 +398,9 @@ struct CircleHyperbolaIntersection { } }; -template +template void test_simple_systems() { + using execution_space = typename Device::execution_space; double abs_tol, rel_tol; if (std::is_same_v) { rel_tol = 10e-5; @@ -419,8 +422,8 @@ void test_simple_systems() { system_type mySys{}; scalar_type initial_values[2] = {1.5, 1.5}; scalar_type solution[2] = {10.75 / 6, 0.8887803753}; - run_newton_test( - mySys, params, initial_values, solution); + run_newton_test(mySys, params, + initial_values, solution); #ifdef HAVE_KOKKOSKERNELS_DEBUG std::cout << "Finished Circles Intersetcion problem" << std::endl; #endif @@ -432,8 +435,7 @@ void test_simple_systems() { std::cout << "\nStarting Circle/Hyperbola Intersetcion problem" << std::endl; #endif - using system_type = - CircleHyperbolaIntersection; + using system_type = CircleHyperbolaIntersection; system_type mySys{}; scalar_type init_vals[2] = {0.0, 1.0}; @@ -443,8 +445,8 @@ void test_simple_systems() { 4 + Kokkos::sqrt(static_cast(12.0)) / 2)), Kokkos::sqrt(static_cast( (4 + Kokkos::sqrt(static_cast(12.0))) / 2))}; - run_newton_test( - mySys, params, init_vals, solutions); + run_newton_test(mySys, params, init_vals, + solutions); #ifdef HAVE_KOKKOSKERNELS_DEBUG std::cout << "Finished Circle/Hyperbola Intersetcion problem" << std::endl; #endif @@ -457,12 +459,13 @@ void test_simple_systems() { // happen within a FE/FD code. // //////////////////////////////////////////// -template +template void test_newton_on_device() { - using vec_type = Kokkos::View; - using mat_type = Kokkos::View; - using newton_params = KokkosODE::Experimental::Newton_params; - using system_type = CircleHyperbolaIntersection; + using execution_space = typename Device::execution_space; + using vec_type = Kokkos::View; + using mat_type = Kokkos::View; + using newton_params = KokkosODE::Experimental::Newton_params; + using system_type = CircleHyperbolaIntersection; using newton_solver_status = KokkosODE::Experimental::newton_solver_status; double abs_tol, rel_tol; diff --git a/ode/unit_test/Test_ODE_RK.hpp b/ode/unit_test/Test_ODE_RK.hpp index 2e6df4fd81..039e0211eb 100644 --- a/ode/unit_test/Test_ODE_RK.hpp +++ b/ode/unit_test/Test_ODE_RK.hpp @@ -174,11 +174,12 @@ void test_method(const std::string label, ode_type& my_ode, } // test_method -template +template void test_RK() { - using RK_type = KokkosODE::Experimental::RK_type; - using vec_type = Kokkos::View; - using mv_type = Kokkos::View; + using execution_space = typename Device::execution_space; + using RK_type = KokkosODE::Experimental::RK_type; + using vec_type = Kokkos::View; + using mv_type = Kokkos::View; duho my_oscillator(1, 1, 4); const int neqs = my_oscillator.neqs; @@ -349,11 +350,12 @@ void test_rate(ode_type& my_ode, const scalar_type& tstart, } // test_method -template +template void test_convergence_rate() { - using RK_type = KokkosODE::Experimental::RK_type; - using vec_type = Kokkos::View; - using mv_type = Kokkos::View; + using execution_space = typename Device::execution_space; + using RK_type = KokkosODE::Experimental::RK_type; + using vec_type = Kokkos::View; + using mv_type = Kokkos::View; duho my_oscillator(1, 1, 4); const int neqs = my_oscillator.neqs; @@ -463,11 +465,12 @@ void test_convergence_rate() { } } // test_convergence_rate -template +template void test_adaptivity() { - using RK_type = KokkosODE::Experimental::RK_type; - using vec_type = Kokkos::View; - using mv_type = Kokkos::View; + using execution_space = typename Device::execution_space; + using RK_type = KokkosODE::Experimental::RK_type; + using vec_type = Kokkos::View; + using mv_type = Kokkos::View; duho my_oscillator(1, 1, 4); const int neqs = my_oscillator.neqs; diff --git a/ode/unit_test/Test_ODE_RK_chem.hpp b/ode/unit_test/Test_ODE_RK_chem.hpp index 5abdd41d00..763394e1ec 100644 --- a/ode/unit_test/Test_ODE_RK_chem.hpp +++ b/ode/unit_test/Test_ODE_RK_chem.hpp @@ -89,12 +89,13 @@ struct chem_model_2 { } }; -template +template void test_chem() { - using vec_type = Kokkos::View; - using mv_type = Kokkos::View; - using RK_type = KokkosODE::Experimental::RK_type; - using solver_type = KokkosODE::Experimental::RungeKutta; + using execution_space = typename Device::execution_space; + using vec_type = Kokkos::View; + using mv_type = Kokkos::View; + using RK_type = KokkosODE::Experimental::RK_type; + using solver_type = KokkosODE::Experimental::RungeKutta; { chem_model_1 chem_model; diff --git a/sparse/impl/KokkosSparse_sptrsv_solve_impl.hpp b/sparse/impl/KokkosSparse_sptrsv_solve_impl.hpp index e2a625e2a7..b7e7fa1650 100644 --- a/sparse/impl/KokkosSparse_sptrsv_solve_impl.hpp +++ b/sparse/impl/KokkosSparse_sptrsv_solve_impl.hpp @@ -2915,7 +2915,7 @@ void lower_tri_solve(TriSolveHandle &thandle, const RowMapType row_map, #if defined(KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV) using namespace KokkosSparse::Experimental; - using memory_space = typename execution_space::memory_space; + using memory_space = typename TriSolveHandle::memory_space; using integer_view_t = typename TriSolveHandle::integer_view_t; using integer_view_host_t = typename TriSolveHandle::integer_view_host_t; using scalar_t = typename ValuesType::non_const_value_type; @@ -3289,7 +3289,7 @@ void upper_tri_solve(TriSolveHandle &thandle, const RowMapType row_map, #if defined(KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV) using namespace KokkosSparse::Experimental; - using memory_space = typename execution_space::memory_space; + using memory_space = typename TriSolveHandle::memory_space; using integer_view_t = typename TriSolveHandle::integer_view_t; using integer_view_host_t = typename TriSolveHandle::integer_view_host_t; using scalar_t = typename ValuesType::non_const_value_type; diff --git a/sparse/src/KokkosSparse_sptrsv_supernode.hpp b/sparse/src/KokkosSparse_sptrsv_supernode.hpp index 845efabc57..0be3abac08 100644 --- a/sparse/src/KokkosSparse_sptrsv_supernode.hpp +++ b/sparse/src/KokkosSparse_sptrsv_supernode.hpp @@ -1402,8 +1402,8 @@ void invert_supernodal_columns(KernelHandle *kernelHandle, bool unit_diag, // If we are running KokkosKernels::trmm on device, // then we need to allocate a workspace on device using trmm_execution_space = typename KernelHandle::HandleExecSpace; - using trmm_memory_space = typename trmm_execution_space::memory_space; - using trmm_view_t = Kokkos::View; + using trmm_memory_space = typename KernelHandle::HandlePersistentMemorySpace; + using trmm_view_t = Kokkos::View; #if !defined(KOKKOSKERNELS_ENABLE_TPL_CUBLAS) // use KokkosBlas::trmm only with CUBLAS (since deep-copy to host throws an // error) diff --git a/sparse/unit_test/Test_Sparse_SortCrs.hpp b/sparse/unit_test/Test_Sparse_SortCrs.hpp index 6cf989accf..fe092461f3 100644 --- a/sparse/unit_test/Test_Sparse_SortCrs.hpp +++ b/sparse/unit_test/Test_Sparse_SortCrs.hpp @@ -41,15 +41,14 @@ enum : int { }; } -template +template void testSortCRS(default_lno_t numRows, default_lno_t numCols, default_size_type nnz, bool doValues, bool doStructInterface, int howExecSpecified) { - using scalar_t = default_scalar; - using lno_t = default_lno_t; - using size_type = default_size_type; - using mem_space = typename exec_space::memory_space; - using device_t = Kokkos::Device; + using scalar_t = default_scalar; + using lno_t = default_lno_t; + using size_type = default_size_type; + using exec_space = typename device_t::execution_space; using crsMat_t = KokkosSparse::CrsMatrix; // Create a random matrix on device @@ -160,14 +159,13 @@ void testSortCRS(default_lno_t numRows, default_lno_t numCols, } } -template +template void testSortCRSUnmanaged(bool doValues, bool doStructInterface) { // This test is about bug #960. - using scalar_t = default_scalar; - using lno_t = default_lno_t; - using size_type = default_size_type; - using mem_space = typename exec_space::memory_space; - using device_t = Kokkos::Device; + using scalar_t = default_scalar; + using lno_t = default_lno_t; + using size_type = default_size_type; + using exec_space = typename device_t::execution_space; using crsMat_t = KokkosSparse::CrsMatrix, @@ -207,14 +205,13 @@ void testSortCRSUnmanaged(bool doValues, bool doStructInterface) { } } -template +template void testSortAndMerge(bool justGraph, int howExecSpecified, bool doStructInterface, bool inPlace, int testCase) { - using size_type = default_size_type; - using lno_t = default_lno_t; - using scalar_t = default_scalar; - using mem_space = typename exec_space::memory_space; - using device_t = Kokkos::Device; + using size_type = default_size_type; + using lno_t = default_lno_t; + using scalar_t = default_scalar; + using exec_space = typename device_t::execution_space; using crsMat_t = KokkosSparse::CrsMatrix; using graph_t = typename crsMat_t::staticcrsgraph_type; diff --git a/sparse/unit_test/Test_Sparse_Transpose.hpp b/sparse/unit_test/Test_Sparse_Transpose.hpp index 0b9ba1a611..35f7a0516c 100644 --- a/sparse/unit_test/Test_Sparse_Transpose.hpp +++ b/sparse/unit_test/Test_Sparse_Transpose.hpp @@ -40,14 +40,13 @@ struct ExactCompare { V v2; }; -template +template void testTranspose(int numRows, int numCols, bool doValues) { + using exec_space = typename device_t::execution_space; using range_pol = Kokkos::RangePolicy; using scalar_t = default_scalar; using lno_t = default_lno_t; using size_type = default_size_type; - using mem_space = typename exec_space::memory_space; - using device_t = Kokkos::Device; using crsMat_t = typename KokkosSparse::CrsMatrix; using c_rowmap_t = typename crsMat_t::row_map_type; @@ -158,13 +157,11 @@ void CompareBsrMatrices(bsrMat_t& A, bsrMat_t& B) { EXPECT_EQ(size_type(0), valuesDiffs); } -template +template void testTransposeBsrRef() { using scalar_t = default_scalar; using lno_t = default_lno_t; using size_type = default_size_type; - using mem_space = typename exec_space::memory_space; - using device_t = Kokkos::Device; using bsrMat_t = typename KokkosSparse::Experimental::BsrMatrix; @@ -236,13 +233,12 @@ void testTransposeBsrRef() { CompareBsrMatrices(At, At_ref); } -template +template void testTransposeBsr(int numRows, int numCols, int blockSize) { - using scalar_t = default_scalar; - using lno_t = default_lno_t; - using size_type = default_size_type; - using mem_space = typename exec_space::memory_space; - using device_t = Kokkos::Device; + using scalar_t = default_scalar; + using lno_t = default_lno_t; + using size_type = default_size_type; + using exec_space = typename device_t::execution_space; using bsrMat_t = typename KokkosSparse::Experimental::BsrMatrix; diff --git a/sparse/unit_test/Test_Sparse_coo2crs.hpp b/sparse/unit_test/Test_Sparse_coo2crs.hpp index 8a52a39220..a2ccd6bc62 100644 --- a/sparse/unit_test/Test_Sparse_coo2crs.hpp +++ b/sparse/unit_test/Test_Sparse_coo2crs.hpp @@ -197,10 +197,10 @@ void check_crs_matrix(CrsType crsMat, RowType row, ColType col, DataType data, } } -template +template void doCoo2Crs(size_t m, size_t n, ScalarType min_val, ScalarType max_val) { - RandCooMat cooMat(m, n, m * n, min_val, - max_val); + RandCooMat cooMat(m, n, m * n, min_val, + max_val); auto randRow = cooMat.get_row(); auto randCol = cooMat.get_col(); auto randData = cooMat.get_data(); @@ -329,4 +329,4 @@ TEST_F(TestCategory, sparse_coo2crs_staticMatrix_edgeCases) { auto crsMatFsTs1 = KokkosSparse::coo2crs(m, n, row, col, data); check_crs_matrix(crsMatFsTs1, row_h, col_h, data); } -} // namespace Test \ No newline at end of file +} // namespace Test diff --git a/sparse/unit_test/Test_Sparse_removeCrsMatrixZeros.hpp b/sparse/unit_test/Test_Sparse_removeCrsMatrixZeros.hpp index b5c57dbe49..bdd175558f 100644 --- a/sparse/unit_test/Test_Sparse_removeCrsMatrixZeros.hpp +++ b/sparse/unit_test/Test_Sparse_removeCrsMatrixZeros.hpp @@ -91,9 +91,7 @@ Matrix loadMatrixFromVectors(int numRows, int numCols, template void getTestInput(int test, Matrix& A, Matrix& Afiltered_ref) { - using Offset = typename Matrix::size_type; - using Device = - Kokkos::Device; + using Offset = typename Matrix::size_type; bool haveHardcodedReference = true; switch (test) { case 0: { @@ -226,7 +224,8 @@ void getTestInput(int test, Matrix& A, Matrix& Afiltered_ref) { if (haveHardcodedReference) { Matrix Afiltered_refimpl = removeMatrixZerosReference(A); bool referenceImplMatchesHardcoded = - Test::is_same_matrix(Afiltered_ref, Afiltered_refimpl); + Test::is_same_matrix(Afiltered_ref, + Afiltered_refimpl); ASSERT_TRUE(referenceImplMatchesHardcoded) << "Test case " << test << ": reference impl gave wrong answer!"; } @@ -236,15 +235,14 @@ void getTestInput(int test, Matrix& A, Matrix& Afiltered_ref) { void testRemoveCrsMatrixZeros(int testCase) { using namespace TestRemoveCrsMatrixZeros; - using Device = - Kokkos::Device; - using Matrix = KokkosSparse::CrsMatrix; + using Matrix = + KokkosSparse::CrsMatrix; Matrix A, Afiltered_ref; getTestInput(testCase, A, Afiltered_ref); Matrix Afiltered_actual = KokkosSparse::removeCrsMatrixZeros(A); - bool matches = - Test::is_same_matrix(Afiltered_actual, Afiltered_ref); + bool matches = Test::is_same_matrix(Afiltered_actual, + Afiltered_ref); EXPECT_TRUE(matches) << "Test case " << testCase << ": matrix with zeros filtered out does not match reference."; diff --git a/test_common/KokkosKernels_TestUtils.hpp b/test_common/KokkosKernels_TestUtils.hpp index 95a3459699..330c00cde6 100644 --- a/test_common/KokkosKernels_TestUtils.hpp +++ b/test_common/KokkosKernels_TestUtils.hpp @@ -574,13 +574,14 @@ int string_compare_no_case(const std::string& str1, const std::string& str2) { /// /brief Coo matrix class for testing purposes. /// \tparam ScalarType /// \tparam LayoutType -/// \tparam ExeSpaceType -template +/// \tparam Device +template class RandCooMat { private: - using RowViewTypeD = Kokkos::View; - using ColViewTypeD = Kokkos::View; - using DataViewTypeD = Kokkos::View; + using ExeSpaceType = typename Device::execution_space; + using RowViewTypeD = Kokkos::View; + using ColViewTypeD = Kokkos::View; + using DataViewTypeD = Kokkos::View; RowViewTypeD __row_d; ColViewTypeD __col_d; DataViewTypeD __data_d; diff --git a/test_common/Test_Cuda.hpp b/test_common/Test_Cuda.hpp index 0bfe35718b..9230d7f935 100644 --- a/test_common/Test_Cuda.hpp +++ b/test_common/Test_Cuda.hpp @@ -32,6 +32,16 @@ class Cuda : public ::testing::Test { }; #define TestCategory Cuda -#define TestExecSpace Kokkos::Cuda + +using CudaSpaceDevice = Kokkos::Device; +using CudaUVMSpaceDevice = Kokkos::Device; + +// Prefer for any testing where only one exec space is used +#if defined(KOKKOSKERNELS_INST_MEMSPACE_CUDAUVMSPACE) && \ + !defined(KOKKOSKERNELS_INST_MEMSPACE_CUDASPACE) +#define TestExecSpace CudaUVMSpaceDevice +#else +#define TestExecSpace CudaSpaceDevice +#endif #endif // TEST_CUDA_HPP