From 99c2b556911d49c7a2b1460010a527245887962a Mon Sep 17 00:00:00 2001 From: James Foucar Date: Mon, 10 Apr 2023 13:04:59 -0600 Subject: [PATCH 01/14] par_ilut: make Ut_values view atomic in compute_l_u_factors ... to fix the race issues when async updates are on. --- sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp index 89dcd12c5b..af2fb15fa4 100644 --- a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp +++ b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -450,7 +451,16 @@ struct IlutWrap { LRowMapType& L_row_map, LEntriesType& L_entries, LValuesType& L_values, URowMapType& U_row_map, UEntriesType& U_entries, UValuesType& U_values, UtRowMapType& Ut_row_map, UtEntriesType& Ut_entries, - UtValuesType& Ut_values, const bool async_update) { + UtValuesType& Ut_values_arg, const bool async_update) { + // Use an atomic view for Ut_values due to race condition + using UtValuesAtomic = Kokkos::View< + typename UtValuesType::non_const_value_type*, + typename UtValuesType::array_layout, + typename UtValuesType::device_type, + Kokkos::MemoryTraits >; + + UtValuesAtomic Ut_values = Ut_values_arg; + const size_type nrows = ih.get_nrows(); Kokkos::parallel_for( "compute_l_u_factors", range_policy(0, nrows), From d0f82cdc4924f393f320be1ea024a8db7778ee2a Mon Sep 17 00:00:00 2001 From: James Foucar Date: Mon, 10 Apr 2023 13:50:51 -0600 Subject: [PATCH 02/14] With Ut atomic, no need to avoid async updates on GPU --- sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp index af2fb15fa4..650d4ae7ee 100644 --- a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp +++ b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp @@ -804,10 +804,8 @@ struct IlutWrap { thandle.get_residual_norm_delta_stop(); const size_type max_iter = thandle.get_max_iter(); - const auto verbose = thandle.get_verbose(); - constexpr bool on_gpu = - KokkosKernels::Impl::kk_is_gpu_exec_space(); - const auto async_update = !on_gpu && thandle.get_async_update(); + const auto verbose = thandle.get_verbose(); + const auto async_update = thandle.get_async_update(); if (verbose) { std::cout << "Starting PARILUT with..." << std::endl; From 6183aa17622a2187e344e47d4f7d0077d5d23270 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Mon, 10 Apr 2023 13:51:22 -0600 Subject: [PATCH 03/14] formatting --- sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp index 650d4ae7ee..27630f4d03 100644 --- a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp +++ b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp @@ -454,10 +454,10 @@ struct IlutWrap { UtValuesType& Ut_values_arg, const bool async_update) { // Use an atomic view for Ut_values due to race condition using UtValuesAtomic = Kokkos::View< - typename UtValuesType::non_const_value_type*, - typename UtValuesType::array_layout, - typename UtValuesType::device_type, - Kokkos::MemoryTraits >; + typename UtValuesType::non_const_value_type*, + typename UtValuesType::array_layout, typename UtValuesType::device_type, + Kokkos::MemoryTraits >; UtValuesAtomic Ut_values = Ut_values_arg; From aeeb3a205309abe418a81cb55391cf49edeb28fe Mon Sep 17 00:00:00 2001 From: James Foucar Date: Mon, 10 Apr 2023 13:57:40 -0600 Subject: [PATCH 04/14] Remove unnecessary header --- sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp index 27630f4d03..03dae9b51d 100644 --- a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp +++ b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp @@ -28,7 +28,6 @@ #include #include #include -#include #include From 216df3bfc96adcaff37d38e6c9a14eb9b0d94cdd Mon Sep 17 00:00:00 2001 From: James Foucar Date: Mon, 10 Apr 2023 14:40:17 -0600 Subject: [PATCH 05/14] Update comments --- sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp | 3 +-- sparse/src/KokkosSparse_par_ilut_handle.hpp | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp index 03dae9b51d..974bbe0051 100644 --- a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp +++ b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp @@ -496,8 +496,7 @@ struct IlutWrap { // ut_nnz is not guarateed to fail into range used exclusively // by this thread. Updating it here opens up potential race - // conditions that cause problems on GPU but usually causes - // faster convergence. + // conditions but usually causes faster convergence. if (async_update) { Ut_values(ut_nnz) = new_val; } diff --git a/sparse/src/KokkosSparse_par_ilut_handle.hpp b/sparse/src/KokkosSparse_par_ilut_handle.hpp index 7ae11d297c..3ffe44ffca 100644 --- a/sparse/src/KokkosSparse_par_ilut_handle.hpp +++ b/sparse/src/KokkosSparse_par_ilut_handle.hpp @@ -82,8 +82,6 @@ class PAR_ILUTHandle { bool async_update; /// Whether compute LU factors should do asychronous /// updates. When ON, the algorithm will usually converge /// faster but it makes the algorithm non-deterministic. - /// This will always be OFF for GPU since it doesn't work - /// there. bool verbose; /// Print information while executing par_ilut // Stored by parent KokkosKernelsHandle From 708f80fa0dadc6e8bec3bc75e61c7e3d17731ed0 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Mon, 10 Apr 2023 16:09:20 -0600 Subject: [PATCH 06/14] Fixes for complex scalars --- sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp index 974bbe0051..fbfa713f4c 100644 --- a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp +++ b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp @@ -420,7 +420,8 @@ struct IlutWrap { const auto l_col = L_entries(l_row_nnz); const auto u_row = Ut_entries(ut_row_nnz); if (l_col == u_row && l_col < last_entry) { - sum += L_values(l_row_nnz) * Ut_values(ut_row_nnz); + const scalar_t ut_val = Ut_values(ut_row_nnz); + sum += L_values(l_row_nnz) * ut_val; } if (static_cast(u_row) == row_idx) { ut_nnz = ut_row_nnz; @@ -470,7 +471,7 @@ struct IlutWrap { for (auto l_nnz = l_row_nnz_begin; l_nnz < l_row_nnz_end; ++l_nnz) { const auto col_idx = L_entries(l_nnz); - const auto u_diag = Ut_values(Ut_row_map(col_idx + 1) - 1); + const scalar_t u_diag = Ut_values(Ut_row_map(col_idx + 1) - 1); if (u_diag != 0.0) { const auto new_val = compute_sum(row_idx, col_idx, A_row_map, A_entries, A_values, From 420094f01f592ccf2560a7a3abd1020b6895d2b8 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Mon, 10 Apr 2023 16:47:47 -0600 Subject: [PATCH 07/14] formatting --- sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp index fbfa713f4c..0e7798d06b 100644 --- a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp +++ b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp @@ -470,8 +470,8 @@ struct IlutWrap { L_row_map(row_idx + 1) - 1; // skip diagonal for L for (auto l_nnz = l_row_nnz_begin; l_nnz < l_row_nnz_end; ++l_nnz) { - const auto col_idx = L_entries(l_nnz); - const scalar_t u_diag = Ut_values(Ut_row_map(col_idx + 1) - 1); + const auto col_idx = L_entries(l_nnz); + const scalar_t u_diag = Ut_values(Ut_row_map(col_idx + 1) - 1); if (u_diag != 0.0) { const auto new_val = compute_sum(row_idx, col_idx, A_row_map, A_entries, A_values, From 81847200ff61ee423c751bd4307211438167c427 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Wed, 12 Apr 2023 10:43:52 -0600 Subject: [PATCH 08/14] Adjust async update views; default it to off --- .../KokkosSparse_par_ilut_numeric_impl.hpp | 73 +++++++++++++++---- sparse/src/KokkosKernels_Handle.hpp | 2 +- sparse/unit_test/Test_Sparse_par_ilut.hpp | 2 +- 3 files changed, 61 insertions(+), 16 deletions(-) diff --git a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp index 0e7798d06b..bb9cbf24bc 100644 --- a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp +++ b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp @@ -35,6 +35,28 @@ namespace KokkosSparse { namespace Impl { namespace Experimental { +namespace ParIlutOnly { + +template +struct UtViewType +{ + template + using UtValuesViewType = UtValuesType; +}; + +template <> +struct UtViewType +{ + template + using UtValuesViewType = Kokkos::View< + typename UtValuesType::non_const_value_type*, + typename UtValuesType::array_layout, typename UtValuesType::device_type, + Kokkos::MemoryTraits >; +}; + +} + template struct IlutWrap { // @@ -441,25 +463,24 @@ struct IlutWrap { * make this function determistic, but that could cause par_ilut * to take longer (more iterations) to converge. */ - template - static void compute_l_u_factors( + template + static void compute_l_u_factors_impl( IlutHandle& ih, const ARowMapType& A_row_map, const AEntriesType& A_entries, const AValuesType& A_values, LRowMapType& L_row_map, LEntriesType& L_entries, LValuesType& L_values, URowMapType& U_row_map, UEntriesType& U_entries, UValuesType& U_values, UtRowMapType& Ut_row_map, UtEntriesType& Ut_entries, - UtValuesType& Ut_values_arg, const bool async_update) { - // Use an atomic view for Ut_values due to race condition - using UtValuesAtomic = Kokkos::View< - typename UtValuesType::non_const_value_type*, - typename UtValuesType::array_layout, typename UtValuesType::device_type, - Kokkos::MemoryTraits >; + UtValuesType& Ut_values_arg) { + + // UtValues needs to be Atomic if async updates are on. Otherwise, + // non-atomic is fine. + using UtValuesSafeType = typename ParIlutOnly::UtViewType::UtValuesViewType; - UtValuesAtomic Ut_values = Ut_values_arg; + UtValuesSafeType Ut_values = Ut_values_arg; const size_type nrows = ih.get_nrows(); Kokkos::parallel_for( @@ -505,6 +526,30 @@ struct IlutWrap { }); } + template + static void compute_l_u_factors( + IlutHandle& ih, const ARowMapType& A_row_map, + const AEntriesType& A_entries, const AValuesType& A_values, + LRowMapType& L_row_map, LEntriesType& L_entries, LValuesType& L_values, + URowMapType& U_row_map, UEntriesType& U_entries, UValuesType& U_values, + UtRowMapType& Ut_row_map, UtEntriesType& Ut_entries, + UtValuesType& Ut_values, const bool async_update) { + if (async_update) { + compute_l_u_factors_impl(ih, A_row_map, A_entries, A_values, L_row_map, L_entries, + L_values, U_row_map, U_entries, U_values, + Ut_row_map, Ut_entries, Ut_values); + } + else { + compute_l_u_factors_impl(ih, A_row_map, A_entries, A_values, L_row_map, L_entries, + L_values, U_row_map, U_entries, U_values, + Ut_row_map, Ut_entries, Ut_values); + } + } + + /** * Select threshold based on filter rank. Do all this on host */ @@ -804,7 +849,7 @@ struct IlutWrap { const size_type max_iter = thandle.get_max_iter(); const auto verbose = thandle.get_verbose(); - const auto async_update = thandle.get_async_update(); + const auto async_update = false; //thandle.get_async_update(); if (verbose) { std::cout << "Starting PARILUT with..." << std::endl; diff --git a/sparse/src/KokkosKernels_Handle.hpp b/sparse/src/KokkosKernels_Handle.hpp index 1f080b7bce..dc76ee23d7 100644 --- a/sparse/src/KokkosKernels_Handle.hpp +++ b/sparse/src/KokkosKernels_Handle.hpp @@ -872,7 +872,7 @@ class KokkosKernelsHandle { const typename PAR_ILUTHandleType::float_t residual_norm_delta_stop = 1e-2, const typename PAR_ILUTHandleType::float_t fill_in_limit = 0.75, - const bool async_update = true, const bool verbose = false) { + const bool async_update = false, const bool verbose = false) { this->destroy_par_ilut_handle(); this->is_owner_of_the_par_ilut_handle = true; this->par_ilutHandle = diff --git a/sparse/unit_test/Test_Sparse_par_ilut.hpp b/sparse/unit_test/Test_Sparse_par_ilut.hpp index 9b99c1000d..f9ad4d1873 100644 --- a/sparse/unit_test/Test_Sparse_par_ilut.hpp +++ b/sparse/unit_test/Test_Sparse_par_ilut.hpp @@ -302,7 +302,7 @@ void run_test_par_ilut_precond() { constexpr auto numRows = n; constexpr auto numCols = n; constexpr auto diagDominance = 1; - constexpr bool verbose = false; + constexpr bool verbose = true; typename sp_matrix_type::non_const_size_type nnz = 10 * numRows; auto A = KokkosSparse::Impl::kk_generate_diagonally_dominant_sparse_matrix< From 7b48101726f7c416c03e7dfb7b671459ae8971a5 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Wed, 12 Apr 2023 11:11:58 -0600 Subject: [PATCH 09/14] Fix UtValuesSafeType --- sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp | 2 +- sparse/unit_test/Test_Sparse_par_ilut.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp index bb9cbf24bc..4955f1f730 100644 --- a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp +++ b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp @@ -478,7 +478,7 @@ struct IlutWrap { // UtValues needs to be Atomic if async updates are on. Otherwise, // non-atomic is fine. - using UtValuesSafeType = typename ParIlutOnly::UtViewType::UtValuesViewType; + using UtValuesSafeType = typename ParIlutOnly::UtViewType::template UtValuesViewType; UtValuesSafeType Ut_values = Ut_values_arg; diff --git a/sparse/unit_test/Test_Sparse_par_ilut.hpp b/sparse/unit_test/Test_Sparse_par_ilut.hpp index f9ad4d1873..9b99c1000d 100644 --- a/sparse/unit_test/Test_Sparse_par_ilut.hpp +++ b/sparse/unit_test/Test_Sparse_par_ilut.hpp @@ -302,7 +302,7 @@ void run_test_par_ilut_precond() { constexpr auto numRows = n; constexpr auto numCols = n; constexpr auto diagDominance = 1; - constexpr bool verbose = true; + constexpr bool verbose = false; typename sp_matrix_type::non_const_size_type nnz = 10 * numRows; auto A = KokkosSparse::Impl::kk_generate_diagonally_dominant_sparse_matrix< From a3f2a5a38b3e114967fafaf9276ae5cef0af3e8b Mon Sep 17 00:00:00 2001 From: James Foucar Date: Wed, 12 Apr 2023 11:13:01 -0600 Subject: [PATCH 10/14] formatting --- .../KokkosSparse_par_ilut_numeric_impl.hpp | 58 +++++++++---------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp index 4955f1f730..c5b7cd1bdd 100644 --- a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp +++ b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp @@ -38,24 +38,22 @@ namespace Experimental { namespace ParIlutOnly { template -struct UtViewType -{ +struct UtViewType { template using UtValuesViewType = UtValuesType; }; template <> -struct UtViewType -{ +struct UtViewType { template using UtValuesViewType = Kokkos::View< - typename UtValuesType::non_const_value_type*, - typename UtValuesType::array_layout, typename UtValuesType::device_type, - Kokkos::MemoryTraits >; + typename UtValuesType::non_const_value_type*, + typename UtValuesType::array_layout, typename UtValuesType::device_type, + Kokkos::MemoryTraits >; }; -} +} // namespace ParIlutOnly template struct IlutWrap { @@ -463,11 +461,11 @@ struct IlutWrap { * make this function determistic, but that could cause par_ilut * to take longer (more iterations) to converge. */ - template + template static void compute_l_u_factors_impl( IlutHandle& ih, const ARowMapType& A_row_map, const AEntriesType& A_entries, const AValuesType& A_values, @@ -475,10 +473,10 @@ struct IlutWrap { URowMapType& U_row_map, UEntriesType& U_entries, UValuesType& U_values, UtRowMapType& Ut_row_map, UtEntriesType& Ut_entries, UtValuesType& Ut_values_arg) { - // UtValues needs to be Atomic if async updates are on. Otherwise, // non-atomic is fine. - using UtValuesSafeType = typename ParIlutOnly::UtViewType::template UtValuesViewType; + using UtValuesSafeType = typename ParIlutOnly::UtViewType< + async_update>::template UtValuesViewType; UtValuesSafeType Ut_values = Ut_values_arg; @@ -526,10 +524,10 @@ struct IlutWrap { }); } - template + template static void compute_l_u_factors( IlutHandle& ih, const ARowMapType& A_row_map, const AEntriesType& A_entries, const AValuesType& A_values, @@ -538,18 +536,16 @@ struct IlutWrap { UtRowMapType& Ut_row_map, UtEntriesType& Ut_entries, UtValuesType& Ut_values, const bool async_update) { if (async_update) { - compute_l_u_factors_impl(ih, A_row_map, A_entries, A_values, L_row_map, L_entries, - L_values, U_row_map, U_entries, U_values, - Ut_row_map, Ut_entries, Ut_values); - } - else { - compute_l_u_factors_impl(ih, A_row_map, A_entries, A_values, L_row_map, L_entries, - L_values, U_row_map, U_entries, U_values, - Ut_row_map, Ut_entries, Ut_values); + compute_l_u_factors_impl( + ih, A_row_map, A_entries, A_values, L_row_map, L_entries, L_values, + U_row_map, U_entries, U_values, Ut_row_map, Ut_entries, Ut_values); + } else { + compute_l_u_factors_impl( + ih, A_row_map, A_entries, A_values, L_row_map, L_entries, L_values, + U_row_map, U_entries, U_values, Ut_row_map, Ut_entries, Ut_values); } } - /** * Select threshold based on filter rank. Do all this on host */ @@ -848,8 +844,8 @@ struct IlutWrap { thandle.get_residual_norm_delta_stop(); const size_type max_iter = thandle.get_max_iter(); - const auto verbose = thandle.get_verbose(); - const auto async_update = false; //thandle.get_async_update(); + const auto verbose = thandle.get_verbose(); + const auto async_update = false; // thandle.get_async_update(); if (verbose) { std::cout << "Starting PARILUT with..." << std::endl; From 804862213aebbdaac0a251cc25cccaf186d997f4 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Wed, 12 Apr 2023 11:20:38 -0600 Subject: [PATCH 11/14] Another try at formatting --- sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp index c5b7cd1bdd..b1c3d77c79 100644 --- a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp +++ b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp @@ -844,7 +844,7 @@ struct IlutWrap { thandle.get_residual_norm_delta_stop(); const size_type max_iter = thandle.get_max_iter(); - const auto verbose = thandle.get_verbose(); + const auto verbose = thandle.get_verbose(); const auto async_update = false; // thandle.get_async_update(); if (verbose) { From bf80c2f54625f39c42a12473efd6028e965d79d0 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Wed, 12 Apr 2023 16:53:04 -0600 Subject: [PATCH 12/14] Update sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp Co-authored-by: brian-kelley --- sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp index b1c3d77c79..87f44a874a 100644 --- a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp +++ b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp @@ -475,8 +475,9 @@ struct IlutWrap { UtValuesType& Ut_values_arg) { // UtValues needs to be Atomic if async updates are on. Otherwise, // non-atomic is fine. - using UtValuesSafeType = typename ParIlutOnly::UtViewType< - async_update>::template UtValuesViewType; + using UtValuesSafeType = std::conditional_t >, + UtValuesType>; UtValuesSafeType Ut_values = Ut_values_arg; From 94cade88a75b1a7bce0b99a1939071cbb74a7df4 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Wed, 12 Apr 2023 17:00:37 -0600 Subject: [PATCH 13/14] Remove UtViewType in favor of std::conditional --- .../KokkosSparse_par_ilut_numeric_impl.hpp | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp index 87f44a874a..a4fd14e10b 100644 --- a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp +++ b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp @@ -35,26 +35,6 @@ namespace KokkosSparse { namespace Impl { namespace Experimental { -namespace ParIlutOnly { - -template -struct UtViewType { - template - using UtValuesViewType = UtValuesType; -}; - -template <> -struct UtViewType { - template - using UtValuesViewType = Kokkos::View< - typename UtValuesType::non_const_value_type*, - typename UtValuesType::array_layout, typename UtValuesType::device_type, - Kokkos::MemoryTraits >; -}; - -} // namespace ParIlutOnly - template struct IlutWrap { // From bd74d62d9af9a8615ec1e65af03c212a8823b0b4 Mon Sep 17 00:00:00 2001 From: James Foucar Date: Wed, 12 Apr 2023 17:01:48 -0600 Subject: [PATCH 14/14] formatting --- sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp index a4fd14e10b..c482aff429 100644 --- a/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp +++ b/sparse/impl/KokkosSparse_par_ilut_numeric_impl.hpp @@ -455,9 +455,15 @@ struct IlutWrap { UtValuesType& Ut_values_arg) { // UtValues needs to be Atomic if async updates are on. Otherwise, // non-atomic is fine. - using UtValuesSafeType = std::conditional_t >, - UtValuesType>; + using UtValuesSafeType = std::conditional_t< + async_update, + Kokkos::View< + typename UtValuesType::non_const_value_type*, + typename UtValuesType::array_layout, + typename UtValuesType::device_type, + Kokkos::MemoryTraits >, + UtValuesType>; UtValuesSafeType Ut_values = Ut_values_arg;