From ce6043c32530a27eacc6e6998b38dbea5a443933 Mon Sep 17 00:00:00 2001 From: "Yu-Hsiang M. Tsai" Date: Mon, 20 Jan 2025 08:31:41 +0100 Subject: [PATCH] WIP: not good approach yet --- common/unified/solver/chebyshev_kernels.cpp | 29 ++-- core/device_hooks/common_kernels.inc.cpp | 9 +- core/distributed/matrix.cpp | 124 +++++++++++++----- core/solver/chebyshev_kernels.hpp | 20 +-- include/ginkgo/core/base/dense_cache.hpp | 33 ++++- .../ginkgo/core/base/precision_dispatch.hpp | 53 ++++++++ include/ginkgo/core/distributed/matrix.hpp | 21 ++- reference/solver/chebyshev_kernels.cpp | 30 +++-- test/distributed/assembly_kernels.cpp | 17 ++- test/distributed/matrix_kernels.cpp | 34 +++-- test/distributed/vector_kernels.cpp | 8 +- 11 files changed, 270 insertions(+), 108 deletions(-) diff --git a/common/unified/solver/chebyshev_kernels.cpp b/common/unified/solver/chebyshev_kernels.cpp index e4d945d2a32..09257e51544 100644 --- a/common/unified/solver/chebyshev_kernels.cpp +++ b/common/unified/solver/chebyshev_kernels.cpp @@ -4,9 +4,11 @@ #include "core/solver/chebyshev_kernels.hpp" +#include #include #include "common/unified/base/kernel_launch.hpp" +#include "core/base/mixed_precision_types.hpp" namespace gko { @@ -22,18 +24,22 @@ void init_update(std::shared_ptr exec, matrix::Dense* update_sol, matrix::Dense* output) { + using type = device_type>; run_kernel( exec, [] GKO_KERNEL(auto row, auto col, auto alpha, auto inner_sol, auto update_sol, auto output) { - const auto inner_val = inner_sol(row, col); - update_sol(row, col) = inner_val; - output(row, col) += alpha * inner_val; + const auto inner_val = static_cast(inner_sol(row, col)); + update_sol(row, col) = + static_cast>(inner_val); + output(row, col) = static_cast>( + static_cast(output(row, col)) + + static_cast(alpha) * inner_val); }, output->get_size(), alpha, inner_sol, update_sol, output); } -GKO_INSTANTIATE_FOR_EACH_VALUE_AND_SCALAR_TYPE( +GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_2( GKO_DECLARE_CHEBYSHEV_INIT_UPDATE_KERNEL); @@ -43,19 +49,24 @@ void update(std::shared_ptr exec, const ScalarType alpha, matrix::Dense* update_sol, matrix::Dense* output) { + using type = device_type>; run_kernel( exec, [] GKO_KERNEL(auto row, auto col, auto alpha, auto beta, auto inner_sol, auto update_sol, auto output) { - const auto val = inner_sol(row, col) + beta * update_sol(row, col); - inner_sol(row, col) = val; - update_sol(row, col) = val; - output(row, col) += alpha * val; + const auto val = static_cast(inner_sol(row, col)) + + static_cast(beta) * + static_cast(update_sol(row, col)); + inner_sol(row, col) = static_cast>(val); + update_sol(row, col) = static_cast>(val); + output(row, col) = static_cast>( + static_cast(output(row, col)) + + static_cast(alpha) * val); }, output->get_size(), alpha, beta, inner_sol, update_sol, output); } -GKO_INSTANTIATE_FOR_EACH_VALUE_AND_SCALAR_TYPE( +GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_2( GKO_DECLARE_CHEBYSHEV_UPDATE_KERNEL); diff --git a/core/device_hooks/common_kernels.inc.cpp b/core/device_hooks/common_kernels.inc.cpp index ac38237df8b..7925dfa5902 100644 --- a/core/device_hooks/common_kernels.inc.cpp +++ b/core/device_hooks/common_kernels.inc.cpp @@ -165,6 +165,11 @@ GKO_NOT_COMPILED(GKO_HOOK_MODULE); \ GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_AND_INDEX_TYPE(_macro) +#define GKO_STUB_FOR_EACH_MIXED_VALUE_TYPE_2(_macro) \ + template \ + _macro(ValueType, ScalarType) GKO_NOT_COMPILED(GKO_HOOK_MODULE); \ + GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_2(_macro) + #define GKO_STUB_MIXED_VALUE_AND_INDEX_TYPE_2_BASE(_macro) \ template \ @@ -657,8 +662,8 @@ GKO_STUB_CB_GMRES_CONST(GKO_DECLARE_CB_GMRES_SOLVE_KRYLOV_KERNEL); namespace chebyshev { -GKO_STUB_VALUE_AND_SCALAR_TYPE(GKO_DECLARE_CHEBYSHEV_INIT_UPDATE_KERNEL); -GKO_STUB_VALUE_AND_SCALAR_TYPE(GKO_DECLARE_CHEBYSHEV_UPDATE_KERNEL); +GKO_STUB_FOR_EACH_MIXED_VALUE_TYPE_2(GKO_DECLARE_CHEBYSHEV_INIT_UPDATE_KERNEL); +GKO_STUB_FOR_EACH_MIXED_VALUE_TYPE_2(GKO_DECLARE_CHEBYSHEV_UPDATE_KERNEL); } // namespace chebyshev diff --git a/core/distributed/matrix.cpp b/core/distributed/matrix.cpp index 7320bc27914..2831c32bc88 100644 --- a/core/distributed/matrix.cpp +++ b/core/distributed/matrix.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors +// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors // // SPDX-License-Identifier: BSD-3-Clause @@ -10,6 +10,7 @@ #include #include #include +#include #include #include "core/components/prefix_sum_kernels.hpp" @@ -55,7 +56,8 @@ Matrix::Matrix( non_local_to_global_{exec}, one_scalar_{}, local_mtx_{local_matrix_template->clone(exec)}, - non_local_mtx_{non_local_matrix_template->clone(exec)} + non_local_mtx_{non_local_matrix_template->clone(exec)}, + local_only_{false} { GKO_ASSERT( (dynamic_cast*>( @@ -81,7 +83,8 @@ Matrix::Matrix( non_local_to_global_{exec}, one_scalar_{}, non_local_mtx_(::gko::matrix::Coo::create( - exec, dim<2>{local_linop->get_size()[0], 0})) + exec, dim<2>{local_linop->get_size()[0], 0})), + local_only_{true} { this->set_size(size); one_scalar_.init(exec, dim<2>{1, 1}); @@ -104,7 +107,8 @@ Matrix::Matrix( recv_sizes_(comm.size()), gather_idxs_{exec}, non_local_to_global_{exec}, - one_scalar_{} + one_scalar_{}, + local_only_{false} { this->set_size(size); local_mtx_ = std::move(local_linop); @@ -445,8 +449,9 @@ void Matrix::read_distributed( template +template mpi::request Matrix::communicate( - const local_vector_type* local_b) const + const gko::matrix::Dense* local_b) const { // This function can never return early! // Even if the non-local part is empty, i.e. this process doesn't need @@ -460,23 +465,26 @@ mpi::request Matrix::communicate( auto recv_size = recv_offsets_.back(); auto send_dim = dim<2>{static_cast(send_size), num_cols}; auto recv_dim = dim<2>{static_cast(recv_size), num_cols}; - recv_buffer_.init(exec, recv_dim); - send_buffer_.init(exec, send_dim); - - local_b->row_gather(&gather_idxs_, send_buffer_.get()); + auto recv_buffer = + recv_buffer_.template get(exec, recv_dim); + auto send_buffer = + recv_buffer_.template get(exec, send_dim); + local_b->row_gather(&gather_idxs_, send_buffer); auto use_host_buffer = mpi::requires_host_buffer(exec, comm); + auto send_ptr = send_buffer->get_const_values(); + auto recv_ptr = recv_buffer->get_values(); if (use_host_buffer) { - host_recv_buffer_.init(exec->get_master(), recv_dim); - host_send_buffer_.init(exec->get_master(), send_dim); - host_send_buffer_->copy_from(send_buffer_.get()); + auto host_recv_buffer = host_recv_buffer_.template get( + exec->get_master(), recv_dim); + auto host_send_buffer = host_send_buffer_.template get( + exec->get_master(), send_dim); + host_send_buffer->copy_from(send_buffer); + send_ptr = host_send_buffer->get_const_values(); + recv_ptr = host_recv_buffer->get_values(); } mpi::contiguous_type type(num_cols, mpi::type_impl::get_type()); - auto send_ptr = use_host_buffer ? host_send_buffer_->get_const_values() - : send_buffer_->get_const_values(); - auto recv_ptr = use_host_buffer ? host_recv_buffer_->get_values() - : recv_buffer_->get_values(); exec->synchronize(); #ifdef GINKGO_FORCE_SPMV_BLOCKING_COMM comm.all_to_all_v(use_host_buffer ? exec->get_master() : exec, send_ptr, @@ -497,10 +505,14 @@ template void Matrix::apply_impl( const LinOp* b, LinOp* x) const { - distributed::precision_dispatch_real_complex( + distributed::mixed_precision_dispatch_real_complex( [this](const auto dense_b, auto dense_x) { auto x_exec = dense_x->get_executor(); - auto local_x = gko::matrix::Dense::create( + using x_value_type = + typename std::decay_t::value_type; + using b_value_type = + typename std::decay_t::value_type; + auto local_x = gko::matrix::Dense::create( x_exec, dense_x->get_local_vector()->get_size(), gko::make_array_view( x_exec, @@ -509,16 +521,31 @@ void Matrix::apply_impl( dense_x->get_local_vector()->get_stride()); auto comm = this->get_communicator(); - auto req = this->communicate(dense_b->get_local_vector()); + mpi::request req; + if (!local_only_) { + req = this->communicate(dense_b->get_local_vector()); + } local_mtx_->apply(dense_b->get_local_vector(), local_x); + if (local_only_) { + return; + } req.wait(); auto exec = this->get_executor(); auto use_host_buffer = mpi::requires_host_buffer(exec, comm); + + auto recv_size = recv_offsets_.back(); + auto recv_dim = dim<2>{static_cast(recv_size), + dense_b->get_size()[1]}; + auto recv_buffer = + recv_buffer_.template get(exec, recv_dim); if (use_host_buffer) { - recv_buffer_->copy_from(host_recv_buffer_.get()); + auto host_recv_buffer = + host_recv_buffer_.template get(exec, + recv_dim); + recv_buffer->copy_from(host_recv_buffer); } - non_local_mtx_->apply(one_scalar_.get(), recv_buffer_.get(), + non_local_mtx_->apply(one_scalar_.get(), recv_buffer, one_scalar_.get(), local_x); }, b, x); @@ -529,11 +556,17 @@ template void Matrix::apply_impl( const LinOp* alpha, const LinOp* b, const LinOp* beta, LinOp* x) const { - distributed::precision_dispatch_real_complex( - [this](const auto local_alpha, const auto dense_b, - const auto local_beta, auto dense_x) { + distributed::mixed_precision_dispatch_real_complex( + [this, alpha, beta](const auto dense_b, auto dense_x) { const auto x_exec = dense_x->get_executor(); - auto local_x = gko::matrix::Dense::create( + using x_value_type = + typename std::decay_t::value_type; + using b_value_type = + typename std::decay_t::value_type; + auto local_alpha = gko::make_temporary_conversion(alpha); + auto local_beta = + gko::make_temporary_conversion(beta); + auto local_x = gko::matrix::Dense::create( x_exec, dense_x->get_local_vector()->get_size(), gko::make_array_view( x_exec, @@ -542,20 +575,34 @@ void Matrix::apply_impl( dense_x->get_local_vector()->get_stride()); auto comm = this->get_communicator(); - auto req = this->communicate(dense_b->get_local_vector()); - local_mtx_->apply(local_alpha, dense_b->get_local_vector(), - local_beta, local_x); + mpi::request req; + if (!local_only_) { + req = this->communicate(dense_b->get_local_vector()); + } + local_mtx_->apply(local_alpha.get(), dense_b->get_local_vector(), + local_beta.get(), local_x); + if (local_only_) { + return; + } req.wait(); auto exec = this->get_executor(); auto use_host_buffer = mpi::requires_host_buffer(exec, comm); + auto recv_size = recv_offsets_.back(); + auto recv_dim = dim<2>{static_cast(recv_size), + dense_b->get_size()[1]}; + auto recv_buffer = + recv_buffer_.template get(exec, recv_dim); if (use_host_buffer) { - recv_buffer_->copy_from(host_recv_buffer_.get()); + auto host_recv_buffer = + host_recv_buffer_.template get(exec, + recv_dim); + recv_buffer->copy_from(host_recv_buffer); } - non_local_mtx_->apply(local_alpha, recv_buffer_.get(), + non_local_mtx_->apply(local_alpha.get(), recv_buffer, one_scalar_.get(), local_x); }, - alpha, b, beta, x); + b, x); } @@ -582,21 +629,26 @@ void Matrix::col_scale( exec, n_local_cols, make_const_array_view(exec, n_local_cols, scale_values)); - auto req = this->communicate( - stride == 1 ? scaling_factors->get_local_vector() - : scaling_factors_single_stride->get_local_vector()); + auto factors = stride == 1 + ? scaling_factors->get_local_vector() + : scaling_factors_single_stride->get_local_vector(); + auto req = this->communicate(factors); scale_diag->rapply(local_mtx_, local_mtx_); req.wait(); if (n_non_local_cols > 0) { auto use_host_buffer = mpi::requires_host_buffer(exec, comm); + auto recv_buffer = recv_buffer_.template get( + exec, gko::dim<2>(n_non_local_cols, 1)); if (use_host_buffer) { - recv_buffer_->copy_from(host_recv_buffer_.get()); + auto host_recv_buffer = host_recv_buffer_.template get( + exec->get_master(), gko::dim<2>(n_non_local_cols, 1)); + recv_buffer->copy_from(host_recv_buffer); } const auto non_local_scale_diag = gko::matrix::Diagonal::create_const( exec, n_non_local_cols, make_const_array_view(exec, n_non_local_cols, - recv_buffer_->get_const_values())); + recv_buffer->get_const_values())); non_local_scale_diag->rapply(non_local_mtx_, non_local_mtx_); } } diff --git a/core/solver/chebyshev_kernels.hpp b/core/solver/chebyshev_kernels.hpp index f1557369eb2..2c99a7d8b1e 100644 --- a/core/solver/chebyshev_kernels.hpp +++ b/core/solver/chebyshev_kernels.hpp @@ -20,18 +20,18 @@ namespace kernels { namespace chebyshev { -#define GKO_DECLARE_CHEBYSHEV_INIT_UPDATE_KERNEL(ValueType, ScalarType) \ - void init_update(std::shared_ptr exec, \ - const ScalarType alpha, \ - const matrix::Dense* inner_sol, \ - matrix::Dense* update_sol, \ +#define GKO_DECLARE_CHEBYSHEV_INIT_UPDATE_KERNEL(ValueType, ScalarType, ...) \ + void init_update(std::shared_ptr exec, \ + const ScalarType alpha, \ + const matrix::Dense* inner_sol, \ + matrix::Dense* update_sol, \ matrix::Dense* output) -#define GKO_DECLARE_CHEBYSHEV_UPDATE_KERNEL(ValueType, ScalarType) \ - void update(std::shared_ptr exec, \ - const ScalarType alpha, const ScalarType beta, \ - matrix::Dense* inner_sol, \ - matrix::Dense* update_sol, \ +#define GKO_DECLARE_CHEBYSHEV_UPDATE_KERNEL(ValueType, ScalarType, ...) \ + void update(std::shared_ptr exec, \ + const ScalarType alpha, const ScalarType beta, \ + matrix::Dense* inner_sol, \ + matrix::Dense* update_sol, \ matrix::Dense* output) #define GKO_DECLARE_ALL_AS_TEMPLATES \ diff --git a/include/ginkgo/core/base/dense_cache.hpp b/include/ginkgo/core/base/dense_cache.hpp index dd2918ab6a7..e9df2d71d81 100644 --- a/include/ginkgo/core/base/dense_cache.hpp +++ b/include/ginkgo/core/base/dense_cache.hpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors +// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors // // SPDX-License-Identifier: BSD-3-Clause @@ -8,6 +8,7 @@ #include +#include #include @@ -90,6 +91,36 @@ struct DenseCache { }; +struct DenseCacheN { + DenseCacheN() = default; + ~DenseCacheN() = default; + DenseCacheN(const DenseCacheN&) {} + DenseCacheN(DenseCacheN&&) noexcept {} + DenseCacheN& operator=(const DenseCacheN&) { return *this; } + DenseCacheN& operator=(DenseCacheN&&) noexcept { return *this; } + mutable array workspace; + + /** + * Pointer access to the underlying vector. + * @return Pointer to the stored vector. + */ + template + std::shared_ptr> get( + std::shared_ptr exec, dim<2> size) const + { + workspace.set_executor(exec); + if (size[0] * size[1] * sizeof(ValueType) > workspace.get_size()) { + workspace.resize_and_reset(size[0] * size[1] * sizeof(ValueType)); + } + return matrix::Dense::create( + exec, size, + make_array_view(exec, size[0] * size[1], + reinterpret_cast(workspace.get_data())), + size[1]); + } +}; + + } // namespace detail } // namespace gko diff --git a/include/ginkgo/core/base/precision_dispatch.hpp b/include/ginkgo/core/base/precision_dispatch.hpp index ffbe0645484..eac60a6d050 100644 --- a/include/ginkgo/core/base/precision_dispatch.hpp +++ b/include/ginkgo/core/base/precision_dispatch.hpp @@ -387,6 +387,38 @@ void precision_dispatch(Function fn, Args*... linops) fn(distributed::make_temporary_conversion(linops).get()...); } +template +void mixed_precision_dispatch(Function fn, const LinOp* in, LinOp* out) +{ +#ifdef GINKGO_MIXED_PRECISION + using fst_type = Vector; + using snd_type = Vector>; + using trd_type = Vector>>; + auto dispatch_out_vector = [&](auto vector_in) { + if (auto vector_out = dynamic_cast(out)) { + fn(vector_in, vector_out); + } else if (auto vector_out = dynamic_cast(out)) { + fn(vector_in, vector_out); + } else if (auto vector_out = dynamic_cast(out)) { + fn(vector_in, vector_out); + } else { + GKO_NOT_SUPPORTED(out); + } + }; + if (auto vector_in = dynamic_cast(in)) { + dispatch_out_vector(vector_in); + } else if (auto vector_in = dynamic_cast(in)) { + dispatch_out_vector(vector_in); + } else if (auto vector_in = dynamic_cast(in)) { + dispatch_out_vector(vector_in); + } else { + GKO_NOT_SUPPORTED(in); + } +#else + precision_dispatch(fn, in, out); +#endif +} + /** * Calls the given function with the given LinOps temporarily converted to @@ -421,6 +453,27 @@ void precision_dispatch_real_complex(Function fn, const LinOp* in, LinOp* out) } +template +void mixed_precision_dispatch_real_complex(Function fn, const LinOp* in, + LinOp* out) +{ + auto complex_to_real = !( + is_complex() || + dynamic_cast>*>( + in)); + if (complex_to_real) { + distributed::mixed_precision_dispatch>( + [&fn](auto vector_in, auto vector_out) { + fn(vector_in->create_real_view().get(), + vector_out->create_real_view().get()); + }, + in, out); + } else { + distributed::mixed_precision_dispatch(fn, in, out); + } +} + + /** * @copydoc precision_dispatch_real_complex(Function, const LinOp*, LinOp*) */ diff --git a/include/ginkgo/core/distributed/matrix.hpp b/include/ginkgo/core/distributed/matrix.hpp index ceda97c0427..dfa88fadce8 100644 --- a/include/ginkgo/core/distributed/matrix.hpp +++ b/include/ginkgo/core/distributed/matrix.hpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors +// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors // // SPDX-License-Identifier: BSD-3-Clause @@ -28,7 +28,11 @@ template class Csr; -} +template +class Dense; + + +} // namespace matrix namespace multigrid { @@ -661,7 +665,9 @@ class Matrix * shared values is automatically extracted. * @return MPI request for the non-blocking communication. */ - mpi::request communicate(const local_vector_type* local_b) const; + template + mpi::request communicate( + const gko::matrix::Dense* local_b) const; void apply_impl(const LinOp* b, LinOp* x) const override; @@ -676,12 +682,13 @@ class Matrix array gather_idxs_; array non_local_to_global_; gko::detail::DenseCache one_scalar_; - gko::detail::DenseCache host_send_buffer_; - gko::detail::DenseCache host_recv_buffer_; - gko::detail::DenseCache send_buffer_; - gko::detail::DenseCache recv_buffer_; + gko::detail::DenseCacheN host_send_buffer_; + gko::detail::DenseCacheN host_recv_buffer_; + gko::detail::DenseCacheN send_buffer_; + gko::detail::DenseCacheN recv_buffer_; std::shared_ptr local_mtx_; std::shared_ptr non_local_mtx_; + bool local_only_; }; diff --git a/reference/solver/chebyshev_kernels.cpp b/reference/solver/chebyshev_kernels.cpp index 2adf0a8026d..aa9a0ecfb7d 100644 --- a/reference/solver/chebyshev_kernels.cpp +++ b/reference/solver/chebyshev_kernels.cpp @@ -4,8 +4,11 @@ #include "core/solver/chebyshev_kernels.hpp" +#include #include +#include "core/base/mixed_precision_types.hpp" + namespace gko { namespace kernels { namespace reference { @@ -19,16 +22,19 @@ void init_update(std::shared_ptr exec, matrix::Dense* update_sol, matrix::Dense* output) { + using type = highest_precision; for (size_t row = 0; row < output->get_size()[0]; row++) { for (size_t col = 0; col < output->get_size()[1]; col++) { - const auto inner_val = inner_sol->at(row, col); - update_sol->at(row, col) = inner_val; - output->at(row, col) += alpha * inner_val; + const auto inner_val = static_cast(inner_sol->at(row, col)); + update_sol->at(row, col) = static_cast(inner_val); + output->at(row, col) = + static_cast(static_cast(output->at(row, col)) + + static_cast(alpha) * inner_val); } } } -GKO_INSTANTIATE_FOR_EACH_VALUE_AND_SCALAR_TYPE( +GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_2( GKO_DECLARE_CHEBYSHEV_INIT_UPDATE_KERNEL); @@ -38,18 +44,22 @@ void update(std::shared_ptr exec, const ScalarType alpha, matrix::Dense* update_sol, matrix::Dense* output) { + using type = highest_precision; for (size_t row = 0; row < output->get_size()[0]; row++) { for (size_t col = 0; col < output->get_size()[1]; col++) { - const auto val = - inner_sol->at(row, col) + beta * update_sol->at(row, col); - inner_sol->at(row, col) = val; - update_sol->at(row, col) = val; - output->at(row, col) += alpha * val; + const auto val = static_cast(inner_sol->at(row, col)) + + static_cast(beta) * + static_cast(update_sol->at(row, col)); + inner_sol->at(row, col) = static_cast(val); + update_sol->at(row, col) = static_cast(val); + output->at(row, col) = + static_cast(static_cast(output->at(row, col)) + + static_cast(alpha) * val); } } } -GKO_INSTANTIATE_FOR_EACH_VALUE_AND_SCALAR_TYPE( +GKO_INSTANTIATE_FOR_EACH_MIXED_VALUE_TYPE_2( GKO_DECLARE_CHEBYSHEV_UPDATE_KERNEL); diff --git a/test/distributed/assembly_kernels.cpp b/test/distributed/assembly_kernels.cpp index f27682cc883..840fb1f0073 100644 --- a/test/distributed/assembly_kernels.cpp +++ b/test/distributed/assembly_kernels.cpp @@ -145,8 +145,7 @@ TYPED_TEST(AssemblyHelpers, AddNonLocalEntriesLocalSmallIsEquivalentToRef) value_type, global_index_type>( num_rows, num_cols, std::uniform_int_distribution(0, static_cast(num_cols - 1)), - std::uniform_real_distribution>(0, 1), - this->engine, this->ref); + std::uniform_real_distribution<>(0, 1), this->engine, this->ref); auto partition = gko::experimental::distributed::Partition< local_index_type, global_index_type>::build_from_mapping(this->ref, @@ -175,13 +174,13 @@ TYPED_TEST(AssemblyHelpers, AddNonLocalEntriesLocalIsEquivalentToRef) std::uniform_int_distribution< gko::experimental::distributed::comm_index_type>(0, num_parts - 1), this->engine, this->ref); - auto input = gko::test::generate_random_device_matrix_data< - value_type, global_index_type>( - num_rows, num_cols, - std::uniform_int_distribution(static_cast(1), - static_cast(num_cols - 1)), - std::uniform_real_distribution>(0, 1), - this->engine, this->ref); + auto input = + gko::test::generate_random_device_matrix_data( + num_rows, num_cols, + std::uniform_int_distribution(static_cast(1), + static_cast(num_cols - 1)), + std::uniform_real_distribution<>(0, 1), this->engine, this->ref); auto partition = gko::experimental::distributed::Partition< local_index_type, global_index_type>::build_from_mapping(this->ref, diff --git a/test/distributed/matrix_kernels.cpp b/test/distributed/matrix_kernels.cpp index afae8c130dc..5e800a2dcde 100644 --- a/test/distributed/matrix_kernels.cpp +++ b/test/distributed/matrix_kernels.cpp @@ -132,8 +132,7 @@ TYPED_TEST(Matrix, BuildsLocalSmallIsEquivalentToRef) value_type, global_index_type>( num_rows, num_cols, std::uniform_int_distribution(0, static_cast(num_cols - 1)), - std::uniform_real_distribution>(0, 1), - this->engine, this->ref); + std::uniform_real_distribution<>(0, 1), this->engine, this->ref); auto partition = gko::experimental::distributed::Partition< local_index_type, global_index_type>::build_from_mapping(this->ref, @@ -162,13 +161,13 @@ TYPED_TEST(Matrix, BuildsLocalIsEquivalentToRef) std::uniform_int_distribution< gko::experimental::distributed::comm_index_type>(0, num_parts - 1), this->engine, this->ref); - auto input = gko::test::generate_random_device_matrix_data< - value_type, global_index_type>( - num_rows, num_cols, - std::uniform_int_distribution(static_cast(num_cols - 1), - static_cast(num_cols - 1)), - std::uniform_real_distribution>(0, 1), - this->engine, this->ref); + auto input = + gko::test::generate_random_device_matrix_data( + num_rows, num_cols, + std::uniform_int_distribution(static_cast(num_cols - 1), + static_cast(num_cols - 1)), + std::uniform_real_distribution<>(0, 1), this->engine, this->ref); auto partition = gko::experimental::distributed::Partition< local_index_type, global_index_type>::build_from_mapping(this->ref, @@ -241,8 +240,7 @@ TYPED_TEST(Matrix, BuildsLocalSmallWithColPartitionIsEquivalentToRef) value_type, global_index_type>( num_rows, num_cols, std::uniform_int_distribution(0, static_cast(num_cols - 1)), - std::uniform_real_distribution>(0, 1), - this->engine, this->ref); + std::uniform_real_distribution<>(0, 1), this->engine, this->ref); auto row_partition = gko::experimental::distributed::Partition< local_index_type, global_index_type>::build_from_mapping(this->ref, @@ -286,13 +284,13 @@ TYPED_TEST(Matrix, BuildsLocalWithColPartitionIsEquivalentToRef) std::uniform_int_distribution< gko::experimental::distributed::comm_index_type>(0, num_parts - 1), this->engine, this->ref); - auto input = gko::test::generate_random_device_matrix_data< - value_type, global_index_type>( - num_rows, num_cols, - std::uniform_int_distribution(static_cast(num_cols), - static_cast(num_cols)), - std::uniform_real_distribution>(0, 1), - this->engine, this->ref); + auto input = + gko::test::generate_random_device_matrix_data( + num_rows, num_cols, + std::uniform_int_distribution(static_cast(num_cols), + static_cast(num_cols)), + std::uniform_real_distribution<>(0, 1), this->engine, this->ref); auto row_partition = gko::experimental::distributed::Partition< local_index_type, global_index_type>::build_from_mapping(this->ref, diff --git a/test/distributed/vector_kernels.cpp b/test/distributed/vector_kernels.cpp index c195318dde2..6259af78481 100644 --- a/test/distributed/vector_kernels.cpp +++ b/test/distributed/vector_kernels.cpp @@ -134,9 +134,7 @@ TYPED_TEST(Vector, BuildsLocalSmallIsEquivalentToRef) num_rows, num_cols, std::uniform_int_distribution(0, static_cast(num_cols - 1)), - std::uniform_real_distribution>(0, - 1), - this->engine, this->ref); + std::uniform_real_distribution<>(0, 1), this->engine, this->ref); auto partition = gko::experimental::distributed::Partition< local_index_type, global_index_type>::build_from_mapping(this->ref, mapping, @@ -169,9 +167,7 @@ TYPED_TEST(Vector, BuildsLocalIsEquivalentToRef) num_rows, num_cols, std::uniform_int_distribution(0, static_cast(num_cols - 1)), - std::uniform_real_distribution>(0, - 1), - this->engine, this->ref); + std::uniform_real_distribution<>(0, 1), this->engine, this->ref); auto partition = gko::experimental::distributed::Partition< local_index_type, global_index_type>::build_from_mapping(this->ref, mapping,