From 0990b114ade6dc0f7e59b2ffc290f80a962d3d71 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Wed, 7 Dec 2022 21:06:28 +0000 Subject: [PATCH] Tests passing --- include/deal.II/lac/la_parallel_vector.templates.h | 4 ++-- tests/lac/parallel_vector_21.cc | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/deal.II/lac/la_parallel_vector.templates.h b/include/deal.II/lac/la_parallel_vector.templates.h index d4910ca6ef..3b3beaafbe 100644 --- a/include/deal.II/lac/la_parallel_vector.templates.h +++ b/include/deal.II/lac/la_parallel_vector.templates.h @@ -480,9 +480,9 @@ namespace LinearAlgebra ::dealii::MemorySpace::Device::kokkos_space::execution_space>( exec, 0, size), KOKKOS_LAMBDA(size_type i, RealType & update) { - update += Kokkos::abs(data.values(i)); + update = Kokkos::max(update, Kokkos::abs(data.values(i))); }, - result); + Kokkos::Max(result)); } }; } // namespace internal diff --git a/tests/lac/parallel_vector_21.cc b/tests/lac/parallel_vector_21.cc index 2f4e21c58c..a2eed7634c 100644 --- a/tests/lac/parallel_vector_21.cc +++ b/tests/lac/parallel_vector_21.cc @@ -50,9 +50,10 @@ test() v2.reinit(v, true); // set locally owned range of v2 manually - Kokkos::parallel_for(v2.local_size(), KOKKOS_LAMBDA(int i) {v2.get_values()[i] = 1.;}); - Kokkos::fence(); + Kokkos::View v2_view(v2.get_values(), v2.local_size()); + Kokkos::deep_copy(v2_view, 1.); + Kokkos::parallel_for(v2.local_size(), KOKKOS_LAMBDA(int i) { KOKKOS_IMPL_DO_NOT_USE_PRINTF("%d: %f\n", i, v2_view(i));}); // add entries to ghost values // Because of limitation in import, the IndexSet of the ReadWriteVector needs // to have the local elements. -- 2.39.5