diff --git a/sparse/impl/KokkosSparse_sptrsv_solve_impl.hpp b/sparse/impl/KokkosSparse_sptrsv_solve_impl.hpp index 01fef9d086..b5d357cd4d 100644 --- a/sparse/impl/KokkosSparse_sptrsv_solve_impl.hpp +++ b/sparse/impl/KokkosSparse_sptrsv_solve_impl.hpp @@ -1290,7 +1290,6 @@ struct SptrsvWrap { using LowerTPFunc = FunctorTypeMacro(TriLvlSchedTP1SolverFunctor, true, BlockEnabled); #if defined(KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV) - using namespace KokkosSparse::Experimental; using device_t = Kokkos::Device; using integer_view_host_t = typename TriSolveHandle::integer_view_host_t; using row_map_host_view_t = Kokkos::View; @@ -1348,14 +1347,14 @@ struct SptrsvWrap { #if defined(KOKKOS_ENABLE_CUDA) && defined(KOKKOSPSTRSV_SOLVE_IMPL_PROFILE) cudaProfilerStart(); #endif - if (thandle.get_algorithm() == KokkosSparse::Experimental::SPTRSVAlgorithm::SEQLVLSCHD_RP) { + if (thandle.get_algorithm() == KokkosSparse::SPTRSVAlgorithm::SEQLVLSCHD_RP) { LowerRPFunc lrpp(row_map, entries, values, lhs, rhs, nodes_grouped_by_level, block_size); Kokkos::parallel_for("parfor_fixed_lvl", Kokkos::Experimental::require(range_policy(space, node_count, node_count + lvl_nodes), Kokkos::Experimental::WorkItemProperty::HintLightWeight), lrpp); - } else if (thandle.get_algorithm() == KokkosSparse::Experimental::SPTRSVAlgorithm::SEQLVLSCHD_TP1) { + } else if (thandle.get_algorithm() == KokkosSparse::SPTRSVAlgorithm::SEQLVLSCHD_TP1) { LowerTPFunc ltpp(row_map, entries, values, lhs, rhs, nodes_grouped_by_level, node_count, block_size); int team_size = thandle.get_team_size(); auto tp = @@ -1551,7 +1550,7 @@ struct SptrsvWrap { cudaProfilerStop(); #endif } // end if - } // end for lvl + } // end for lvl #ifdef profile_supernodal_etree Kokkos::fence(); @@ -1586,7 +1585,6 @@ struct SptrsvWrap { using UpperTPFunc = FunctorTypeMacro(TriLvlSchedTP1SolverFunctor, false, BlockEnabled); #if defined(KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV) - using namespace KokkosSparse::Experimental; using integer_view_host_t = typename TriSolveHandle::integer_view_host_t; using row_map_host_view_t = Kokkos::View; @@ -1644,13 +1642,13 @@ struct SptrsvWrap { cudaProfilerStart(); #endif - if (thandle.get_algorithm() == KokkosSparse::Experimental::SPTRSVAlgorithm::SEQLVLSCHD_RP) { + if (thandle.get_algorithm() == KokkosSparse::SPTRSVAlgorithm::SEQLVLSCHD_RP) { UpperRPFunc urpp(row_map, entries, values, lhs, rhs, nodes_grouped_by_level, block_size); Kokkos::parallel_for("parfor_fixed_lvl", Kokkos::Experimental::require(range_policy(space, node_count, node_count + lvl_nodes), Kokkos::Experimental::WorkItemProperty::HintLightWeight), urpp); - } else if (thandle.get_algorithm() == KokkosSparse::Experimental::SPTRSVAlgorithm::SEQLVLSCHD_TP1) { + } else if (thandle.get_algorithm() == KokkosSparse::SPTRSVAlgorithm::SEQLVLSCHD_TP1) { UpperTPFunc utpp(row_map, entries, values, lhs, rhs, nodes_grouped_by_level, node_count, block_size); int team_size = thandle.get_team_size(); auto tp = @@ -1955,7 +1953,7 @@ struct SptrsvWrap { cudaProfilerStop(); #endif } // end if - } // end for lvl + } // end for lvl #ifdef profile_supernodal_etree Kokkos::fence(); double sptrsv_time_seconds = sptrsv_timer.seconds(); @@ -2116,12 +2114,12 @@ struct SptrsvWrap { const auto block_enabled = thandle_v[i]->is_block_enabled(); KK_REQUIRE(block_enabled == BlockEnabled); if (lvl_nodes != 0) { - if (thandle_v[i]->get_algorithm() == KokkosSparse::Experimental::SPTRSVAlgorithm::SEQLVLSCHD_RP) { + if (thandle_v[i]->get_algorithm() == KokkosSparse::SPTRSVAlgorithm::SEQLVLSCHD_RP) { Kokkos::parallel_for("parfor_fixed_lvl", range_policy(execspace_v[i], node_count_v[i], node_count_v[i] + lvl_nodes), RPFunctor(row_map_v[i], entries_v[i], values_v[i], lhs_v[i], rhs_v[i], nodes_grouped_by_level_v[i], block_size)); - } else if (thandle_v[i]->get_algorithm() == KokkosSparse::Experimental::SPTRSVAlgorithm::SEQLVLSCHD_TP1) { + } else if (thandle_v[i]->get_algorithm() == KokkosSparse::SPTRSVAlgorithm::SEQLVLSCHD_TP1) { int team_size = thandle_v[i]->get_team_size(); auto tp = team_size == -1 ? team_policy(execspace_v[i], lvl_nodes, Kokkos::AUTO) : team_policy(execspace_v[i], lvl_nodes, team_size); @@ -2137,10 +2135,10 @@ struct SptrsvWrap { } node_count_v[i] += lvl_nodes; } // end if (lvl_nodes != 0) - } // end if (lvl < nlevels_v[i]) - } // end for streams - } // end for lvl - } // end tri_solve_streams + } // end if (lvl < nlevels_v[i]) + } // end for streams + } // end for lvl + } // end tri_solve_streams }; // struct SptrsvWrap diff --git a/sparse/impl/KokkosSparse_sptrsv_solve_spec.hpp b/sparse/impl/KokkosSparse_sptrsv_solve_spec.hpp index b8f8a4ab1c..fd173b6d3e 100644 --- a/sparse/impl/KokkosSparse_sptrsv_solve_spec.hpp +++ b/sparse/impl/KokkosSparse_sptrsv_solve_spec.hpp @@ -111,7 +111,7 @@ struct SPTRSV_SOLVEis_symbolic_complete() == false) { Experimental::lower_tri_symbolic(space, *sptrsv_handle, row_map, entries); } - if (sptrsv_handle->get_algorithm() == KokkosSparse::Experimental::SPTRSVAlgorithm::SEQLVLSCHD_TP1CHAIN) { + if (sptrsv_handle->get_algorithm() == KokkosSparse::SPTRSVAlgorithm::SEQLVLSCHD_TP1CHAIN) { Sptrsv::template tri_solve_chain(space, *sptrsv_handle, row_map, entries, values, b, x); } else { #ifdef KOKKOSKERNELS_SPTRSV_CUDAGRAPHSUPPORT @@ -133,7 +133,7 @@ struct SPTRSV_SOLVEis_symbolic_complete() == false) { Experimental::upper_tri_symbolic(space, *sptrsv_handle, row_map, entries); } - if (sptrsv_handle->get_algorithm() == KokkosSparse::Experimental::SPTRSVAlgorithm::SEQLVLSCHD_TP1CHAIN) { + if (sptrsv_handle->get_algorithm() == KokkosSparse::SPTRSVAlgorithm::SEQLVLSCHD_TP1CHAIN) { Sptrsv::template tri_solve_chain(space, *sptrsv_handle, row_map, entries, values, b, x); } else { #ifdef KOKKOSKERNELS_SPTRSV_CUDAGRAPHSUPPORT diff --git a/sparse/impl/KokkosSparse_sptrsv_symbolic_impl.hpp b/sparse/impl/KokkosSparse_sptrsv_symbolic_impl.hpp index 718495791d..71ab18372d 100644 --- a/sparse/impl/KokkosSparse_sptrsv_symbolic_impl.hpp +++ b/sparse/impl/KokkosSparse_sptrsv_symbolic_impl.hpp @@ -149,7 +149,7 @@ void lower_tri_symbolic(ExecSpaceIn& space, TriSolveHandle& thandle, const RowMa Kokkos::Timer timer; #endif - using namespace KokkosSparse::Experimental; + using KokkosSparse::SPTRSVAlgorithm; if (thandle.get_algorithm() == SPTRSVAlgorithm::SEQLVLSCHD_RP || thandle.get_algorithm() == SPTRSVAlgorithm::SEQLVLSCHD_TP1 || /*thandle.get_algorithm () == SPTRSVAlgorithm::SEQLVLSCHED_TP2*/ @@ -575,7 +575,7 @@ void upper_tri_symbolic(ExecutionSpace& space, TriSolveHandle& thandle, const Ro Kokkos::Timer timer; #endif - using namespace KokkosSparse::Experimental; + using KokkosSparse::SPTRSVAlgorithm; if (thandle.get_algorithm() == SPTRSVAlgorithm::SEQLVLSCHD_RP || thandle.get_algorithm() == SPTRSVAlgorithm::SEQLVLSCHD_TP1 || /*thandle.get_algorithm () == SPTRSVAlgorithm::SEQLVLSCHED_TP2*/ diff --git a/sparse/impl/KokkosSparse_twostage_gauss_seidel_impl.hpp b/sparse/impl/KokkosSparse_twostage_gauss_seidel_impl.hpp index d5afdb8c59..1c0d0949ba 100644 --- a/sparse/impl/KokkosSparse_twostage_gauss_seidel_impl.hpp +++ b/sparse/impl/KokkosSparse_twostage_gauss_seidel_impl.hpp @@ -684,7 +684,6 @@ class TwostageGaussSeidel { if (!(gsHandle->isTwoStage())) { // create SpTRSV handles for classical GS - using namespace KokkosSparse::Experimental; auto sptrsv_algo = handle->get_gs_sptrsvL_handle()->get_sptrsv_handle()->get_algorithm(); if (sptrsv_algo != SPTRSVAlgorithm::SPTRSV_CUSPARSE) { // symbolic with CuSparse needs // values @@ -753,7 +752,7 @@ class TwostageGaussSeidel { if (!(gsHandle->isTwoStage())) { using namespace KokkosSparse::Experimental; auto sptrsv_algo = handle->get_gs_sptrsvL_handle()->get_sptrsv_handle()->get_algorithm(); - if (sptrsv_algo == SPTRSVAlgorithm::SPTRSV_CUSPARSE) { // symbolic with CuSparse needs + if (sptrsv_algo == KokkosSparse::SPTRSVAlgorithm::SPTRSV_CUSPARSE) { // symbolic with CuSparse needs // values // CuSparse needs matrix sorted by column indexes for each row // TODO: may need to move this to symbolic/numeric of sptrsv diff --git a/sparse/src/KokkosKernels_Handle.hpp b/sparse/src/KokkosKernels_Handle.hpp index da06c772a9..8a6797a362 100644 --- a/sparse/src/KokkosKernels_Handle.hpp +++ b/sparse/src/KokkosKernels_Handle.hpp @@ -657,7 +657,6 @@ class KokkosKernelsHandle { auto gs2 = get_twostage_gs_handle(); gs2->setTwoStage(two_stage); if (!two_stage) { - using namespace KokkosSparse::Experimental; #if defined(KOKKOSKERNELS_ENABLE_TPL_CUSPARSE) // NOTE: we call CuSPARSE on GPU, if possible if (std::is_same::value && std::is_same::value && @@ -721,13 +720,13 @@ class KokkosKernelsHandle { // Handles for Classical GS (inner SpTRSV) TwoStageGaussSeidelSPTRSVHandleType *get_gs_sptrsvL_handle() { return this->gs_sptrsvLHandle; } TwoStageGaussSeidelSPTRSVHandleType *get_gs_sptrsvU_handle() { return this->gs_sptrsvUHandle; } - void create_gs_sptrsvL_handle(KokkosSparse::Experimental::SPTRSVAlgorithm algm, size_type nrows) { + void create_gs_sptrsvL_handle(KokkosSparse::SPTRSVAlgorithm algm, size_type nrows) { this->destroy_gs_sptrsvL_handle(); this->is_owner_of_the_gs_sptrsvL_handle = true; this->gs_sptrsvLHandle = new TwoStageGaussSeidelSPTRSVHandleType(); this->gs_sptrsvLHandle->create_sptrsv_handle(algm, nrows, true); } - void create_gs_sptrsvU_handle(KokkosSparse::Experimental::SPTRSVAlgorithm algm, size_type nrows) { + void create_gs_sptrsvU_handle(KokkosSparse::SPTRSVAlgorithm algm, size_type nrows) { this->destroy_gs_sptrsvU_handle(); this->is_owner_of_the_gs_sptrsvU_handle = true; this->gs_sptrsvUHandle = new TwoStageGaussSeidelSPTRSVHandleType(); @@ -762,7 +761,7 @@ class KokkosKernelsHandle { SPTRSVHandleType *get_sptrsv_handle() { return this->sptrsvHandle; } - void create_sptrsv_handle(KokkosSparse::Experimental::SPTRSVAlgorithm algm, size_type nrows, bool lower_tri, + void create_sptrsv_handle(KokkosSparse::SPTRSVAlgorithm algm, size_type nrows, bool lower_tri, size_type block_size = 0) { this->destroy_sptrsv_handle(); this->is_owner_of_the_sptrsv_handle = true; @@ -773,7 +772,7 @@ class KokkosKernelsHandle { #ifdef KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV // default SpMV option - using namespace KokkosSparse::Experimental; + using KokkosSparse::SPTRSVAlgorithm; if (algm == SPTRSVAlgorithm::SUPERNODAL_SPMV || algm == SPTRSVAlgorithm::SUPERNODAL_SPMV_DAG) { this->set_sptrsv_column_major(true); } @@ -800,7 +799,7 @@ class KokkosKernelsHandle { void set_sptrsv_invert_diagonal(bool flag) { auto algo = this->sptrsvHandle->get_algorithm(); - using namespace KokkosSparse::Experimental; + using KokkosSparse::SPTRSVAlgorithm; if (!flag && (algo == SPTRSVAlgorithm::SUPERNODAL_SPMV || algo == SPTRSVAlgorithm::SUPERNODAL_SPMV_DAG)) { std::cout << std::endl << " ** Supernodal SpTRSV with SpMV require diagonal inversion **" << std::endl diff --git a/sparse/src/KokkosSparse_sptrsv.hpp b/sparse/src/KokkosSparse_sptrsv.hpp index 2076150a7f..7908db5831 100644 --- a/sparse/src/KokkosSparse_sptrsv.hpp +++ b/sparse/src/KokkosSparse_sptrsv.hpp @@ -176,7 +176,7 @@ void sptrsv_symbolic(ExecutionSpace &space, KernelHandle *handle, lno_row_view_t Kokkos::Timer timer_sptrsv; #endif auto sptrsv_handle = handle->get_sptrsv_handle(); - if (sptrsv_handle->get_algorithm() == KokkosSparse::Experimental::SPTRSVAlgorithm::SPTRSV_CUSPARSE) { + if (sptrsv_handle->get_algorithm() == KokkosSparse::SPTRSVAlgorithm::SPTRSV_CUSPARSE) { #ifdef KOKKOSKERNELS_ENABLE_TPL_CUSPARSE if constexpr (std::is_same_v) { using RowMap_Internal = @@ -351,7 +351,7 @@ void sptrsv_solve(ExecutionSpace &space, KernelHandle *handle, lno_row_view_t_ r XType_Internal x_i = x; auto sptrsv_handle = handle->get_sptrsv_handle(); - if (sptrsv_handle->get_algorithm() == KokkosSparse::Experimental::SPTRSVAlgorithm::SPTRSV_CUSPARSE) { + if (sptrsv_handle->get_algorithm() == KokkosSparse::SPTRSVAlgorithm::SPTRSV_CUSPARSE) { #ifdef KOKKOSKERNELS_ENABLE_TPL_CUSPARSE if constexpr (std::is_same_v) { typedef typename KernelHandle::SPTRSVHandleType sptrsvHandleType; @@ -673,7 +673,7 @@ void sptrsv_solve_streams(const std::vector &execspace_v, const } if (handle_v[0]->get_sptrsv_handle()->get_algorithm() == - KokkosSparse::Experimental::SPTRSVAlgorithm::SPTRSV_CUSPARSE) { + KokkosSparse::SPTRSVAlgorithm::SPTRSV_CUSPARSE) { #ifdef KOKKOSKERNELS_ENABLE_TPL_CUSPARSE // NOTE: assume all streams use the same SPTRSV_CUSPARSE algo. KokkosSparse::Impl::sptrsvcuSPARSE_solve_streams class SPTRSVHandle { @@ -268,7 +272,7 @@ class SPTRSVHandle { bool lower_tri; - SPTRSVAlgorithm algm; + KokkosSparse::SPTRSVAlgorithm algm; // Symbolic: Level scheduling data signed_nnz_lno_view_t level_list; @@ -300,14 +304,14 @@ class SPTRSVHandle { bool require_symbolic_chain_phase; void set_if_algm_require_symb_lvlsched() { - if (algm == SPTRSVAlgorithm::SEQLVLSCHD_RP || - algm == SPTRSVAlgorithm::SEQLVLSCHD_TP1 + if (algm == KokkosSparse::SPTRSVAlgorithm::SEQLVLSCHD_RP || + algm == KokkosSparse::SPTRSVAlgorithm::SEQLVLSCHD_TP1 /*|| algm == SPTRSVAlgorithm::SEQLVLSCHED_TP2*/ - || algm == SPTRSVAlgorithm::SEQLVLSCHD_TP1CHAIN + || algm == KokkosSparse::SPTRSVAlgorithm::SEQLVLSCHD_TP1CHAIN #ifdef KOKKOSKERNELS_ENABLE_SUPERNODAL_SPTRSV - || algm == SPTRSVAlgorithm::SUPERNODAL_NAIVE || algm == SPTRSVAlgorithm::SUPERNODAL_ETREE || - algm == SPTRSVAlgorithm::SUPERNODAL_DAG || algm == SPTRSVAlgorithm::SUPERNODAL_SPMV || - algm == SPTRSVAlgorithm::SUPERNODAL_SPMV_DAG + || algm == KokkosSparse::SPTRSVAlgorithm::SUPERNODAL_NAIVE || algm == KokkosSparse::SPTRSVAlgorithm::SUPERNODAL_ETREE || + algm == KokkosSparse::SPTRSVAlgorithm::SUPERNODAL_DAG || algm == KokkosSparse::SPTRSVAlgorithm::SUPERNODAL_SPMV || + algm == KokkosSparse::SPTRSVAlgorithm::SUPERNODAL_SPMV_DAG #endif ) { require_symbolic_lvlsched_phase = true; @@ -317,7 +321,7 @@ class SPTRSVHandle { } void set_if_algm_require_symb_chain() { - if (algm == KokkosSparse::Experimental::SPTRSVAlgorithm::SEQLVLSCHD_TP1CHAIN) { + if (algm == KokkosSparse::SPTRSVAlgorithm::SEQLVLSCHD_TP1CHAIN) { require_symbolic_chain_phase = true; } else { require_symbolic_chain_phase = false; @@ -400,7 +404,7 @@ class SPTRSVHandle { #endif public: - SPTRSVHandle(SPTRSVAlgorithm choice, const size_type nrows_, bool lower_tri_, const size_type block_size_ = 0, + SPTRSVHandle(KokkosSparse::SPTRSVAlgorithm choice, const size_type nrows_, bool lower_tri_, const size_type block_size_ = 0, bool symbolic_complete_ = false, bool numeric_complete_ = false) : #ifdef KOKKOSKERNELS_SPTRSV_CUDAGRAPHSUPPORT @@ -457,7 +461,7 @@ class SPTRSVHandle { // Check a few prerequisites before allowing users // to run with the cusparse implementation of sptrsv. - if (algm == SPTRSVAlgorithm::SPTRSV_CUSPARSE) { + if (algm == KokkosSparse::SPTRSVAlgorithm::SPTRSV_CUSPARSE) { #if !defined(KOKKOSKERNELS_ENABLE_TPL_CUSPARSE) throw( std::runtime_error("sptrsv handle: SPTRSV_CUSPARSE requested but " @@ -472,7 +476,7 @@ class SPTRSVHandle { } #if defined(__clang__) && defined(KOKKOS_ENABLE_CUDA) - if (algm == SPTRSVAlgorithm::SEQLVLSCHD_TP1 && Kokkos::ArithTraits::isComplex && + if (algm == KokkosSparse::SPTRSVAlgorithm::SEQLVLSCHD_TP1 && Kokkos::ArithTraits::isComplex && std::is_same_v && block_size_ != 0) { throw(std::runtime_error( "sptrsv handle: SPTRSV may not work with blocks+clang+cuda+complex due to a compiler bug")); @@ -845,14 +849,14 @@ class SPTRSVHandle { // Can change the algorithm to a "Compatible algorithms" - for ease in some // testing cases - void set_algorithm(SPTRSVAlgorithm choice) { + void set_algorithm(KokkosSparse::SPTRSVAlgorithm choice) { if (algm != choice) { algm = choice; } } KOKKOS_INLINE_FUNCTION - SPTRSVAlgorithm get_algorithm() { return algm; } + KokkosSparse::SPTRSVAlgorithm get_algorithm() { return algm; } KOKKOS_INLINE_FUNCTION signed_nnz_lno_view_t get_level_list() const { return level_list; } @@ -965,15 +969,15 @@ class SPTRSVHandle { std::string ret_string; switch (algm) { - case SPTRSVAlgorithm::SEQLVLSCHD_RP: ret_string = "SEQLVLSCHD_RP"; break; - case SPTRSVAlgorithm::SEQLVLSCHD_TP1: ret_string = "SEQLVLSCHD_TP1"; break; - case SPTRSVAlgorithm::SEQLVLSCHD_TP1CHAIN: ret_string = "SEQLVLSCHD_TP1CHAIN"; break; - case SPTRSVAlgorithm::SPTRSV_CUSPARSE: ret_string = "SPTRSV_CUSPARSE"; break; - case SPTRSVAlgorithm::SUPERNODAL_NAIVE: ret_string = "SUPERNODAL_NAIVE"; break; - case SPTRSVAlgorithm::SUPERNODAL_ETREE: ret_string = "SUPERNODAL_ETREE"; break; - case SPTRSVAlgorithm::SUPERNODAL_DAG: ret_string = "SUPERNODAL_DAG"; break; - case SPTRSVAlgorithm::SUPERNODAL_SPMV: ret_string = "SUPERNODAL_SPMV"; break; - case SPTRSVAlgorithm::SUPERNODAL_SPMV_DAG: ret_string = "SUPERNODAL_SPMV_DAG"; break; + case KokkosSparse::SPTRSVAlgorithm::SEQLVLSCHD_RP: ret_string = "SEQLVLSCHD_RP"; break; + case KokkosSparse::SPTRSVAlgorithm::SEQLVLSCHD_TP1: ret_string = "SEQLVLSCHD_TP1"; break; + case KokkosSparse::SPTRSVAlgorithm::SEQLVLSCHD_TP1CHAIN: ret_string = "SEQLVLSCHD_TP1CHAIN"; break; + case KokkosSparse::SPTRSVAlgorithm::SPTRSV_CUSPARSE: ret_string = "SPTRSV_CUSPARSE"; break; + case KokkosSparse::SPTRSVAlgorithm::SUPERNODAL_NAIVE: ret_string = "SUPERNODAL_NAIVE"; break; + case KokkosSparse::SPTRSVAlgorithm::SUPERNODAL_ETREE: ret_string = "SUPERNODAL_ETREE"; break; + case KokkosSparse::SPTRSVAlgorithm::SUPERNODAL_DAG: ret_string = "SUPERNODAL_DAG"; break; + case KokkosSparse::SPTRSVAlgorithm::SUPERNODAL_SPMV: ret_string = "SUPERNODAL_SPMV"; break; + case KokkosSparse::SPTRSVAlgorithm::SUPERNODAL_SPMV_DAG: ret_string = "SUPERNODAL_SPMV_DAG"; break; default: KK_REQUIRE_MSG(false, "Unhandled sptrsv algorithm: " << static_cast(algm)); }