From a79c24dd343bd0ee965874e5d98ddca7849ba3d9 Mon Sep 17 00:00:00 2001 From: Marcel Koch Date: Mon, 8 Jan 2024 08:25:21 +0000 Subject: [PATCH] copy residual to host --- examples/distributed-solver/distributed-solver.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/distributed-solver/distributed-solver.cpp b/examples/distributed-solver/distributed-solver.cpp index 16fa6633f57..82eaef91ffc 100644 --- a/examples/distributed-solver/distributed-solver.cpp +++ b/examples/distributed-solver/distributed-solver.cpp @@ -219,7 +219,8 @@ int main(int argc, char* argv[]) ValueType t_end = gko::experimental::mpi::get_walltime(); // Get the residual. - auto res_norm = gko::as(logger->get_residual_norm()); + auto res_norm = gko::clone(exec->get_master(), + gko::as(logger->get_residual_norm())); // @sect3{Printing Results} // Print the achieved residual norm and timings on rank 0. @@ -227,7 +228,7 @@ int main(int argc, char* argv[]) // clang-format off std::cout << "\nNum rows in matrix: " << num_rows << "\nNum ranks: " << comm.size() - << "\nFinal Res norm: " << *res_norm->get_const_values() + << "\nFinal Res norm: " << res_norm->at(0, 0) << "\nIteration count: " << logger->get_num_iterations() << "\nInit time: " << t_init_end - t_init << "\nRead time: " << t_read_setup_end - t_init