]> https://gitweb.dealii.org/ - dealii.git/commitdiff
LA::p::Vector: Only initialize data on demand 16707/head
authorMartin Kronbichler <martin.kronbichler@rub.de>
Fri, 1 Mar 2024 10:52:43 +0000 (11:52 +0100)
committerMartin Kronbichler <martin.kronbichler@rub.de>
Fri, 1 Mar 2024 17:32:45 +0000 (18:32 +0100)
include/deal.II/lac/la_parallel_vector.templates.h

index 30e8004aceb8b9f784187dfc5febdda8d9d85533..fe29f318b6807cb2cac36374b043afe346a5d44b 100644 (file)
@@ -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<MemorySpaceType, dealii::MemorySpace::Default>)
             {
               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<MemorySpaceType, MemorySpace::Default>)
             {
               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
             }
         }
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.