From: Martin Kronbichler Date: Fri, 1 Mar 2024 10:52:43 +0000 (+0100) Subject: LA::p::Vector: Only initialize data on demand X-Git-Tag: v9.6.0-rc1~515^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16ae5cffdf165e46ae1e1356b650fab8ee77cf05;p=dealii.git LA::p::Vector: Only initialize data on demand --- diff --git a/include/deal.II/lac/la_parallel_vector.templates.h b/include/deal.II/lac/la_parallel_vector.templates.h index 30e8004ace..fe29f318b6 100644 --- a/include/deal.II/lac/la_parallel_vector.templates.h +++ b/include/deal.II/lac/la_parallel_vector.templates.h @@ -132,7 +132,13 @@ namespace LinearAlgebra { if (comm_shared == MPI_COMM_SELF) { +#if KOKKOS_VERSION >= 30600 + Kokkos::resize(Kokkos::WithoutInitializing, + data.values, + new_alloc_size); +#else Kokkos::resize(data.values, new_alloc_size); +#endif allocated_size = new_alloc_size; @@ -341,7 +347,13 @@ namespace LinearAlgebra data.values.size() == 0), ExcInternalError()); +#if KOKKOS_VERSION >= 30600 + Kokkos::resize(Kokkos::WithoutInitializing, + data.values, + new_alloc_size); +#else Kokkos::resize(data.values, new_alloc_size); +#endif allocated_size = new_alloc_size; } @@ -980,15 +992,27 @@ namespace LinearAlgebra if (std::is_same_v) { if (import_data.values_host_buffer.size() == 0) +# if KOKKOS_VERSION >= 30600 + Kokkos::resize(Kokkos::WithoutInitializing, + import_data.values_host_buffer, + partitioner->n_import_indices()); +# else Kokkos::resize(import_data.values_host_buffer, partitioner->n_import_indices()); +# endif } else # endif { if (import_data.values.size() == 0) - Kokkos::resize(import_data.values, +# if KOKKOS_VERSION >= 30600 + Kokkos::resize(Kokkos::WithoutInitializing, + import_data.values, partitioner->n_import_indices()); +# else + Kokkos::resize(import_data.values, + partitioner->n_import_indices()); +# endif } } @@ -1128,15 +1152,27 @@ namespace LinearAlgebra if (std::is_same_v) { if (import_data.values_host_buffer.size() == 0) +# if KOKKOS_VERSION >= 30600 + Kokkos::resize(Kokkos::WithoutInitializing, + import_data.values_host_buffer, + partitioner->n_import_indices()); +# else Kokkos::resize(import_data.values_host_buffer, partitioner->n_import_indices()); +# endif } else # endif { if (import_data.values.size() == 0) - Kokkos::resize(import_data.values, +# if KOKKOS_VERSION >= 30600 + Kokkos::resize(Kokkos::WithoutInitializing, + import_data.values, partitioner->n_import_indices()); +# else + Kokkos::resize(import_data.values, + partitioner->n_import_indices()); +# endif } }