From c53148d4beabcf70960f65f22eb6a09d8c37357a Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Tue, 23 Nov 2021 10:29:43 +0100 Subject: [PATCH] Improve default behaviour of CUDAWrappers::MatrixFree::reinit() --- .../matrix_free/cuda_matrix_free.templates.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/include/deal.II/matrix_free/cuda_matrix_free.templates.h b/include/deal.II/matrix_free/cuda_matrix_free.templates.h index 4c64f02188..fe34371727 100644 --- a/include/deal.II/matrix_free/cuda_matrix_free.templates.h +++ b/include/deal.II/matrix_free/cuda_matrix_free.templates.h @@ -711,10 +711,13 @@ namespace CUDAWrappers MatrixFree::get_data(unsigned int color) const { Data data_copy; - data_copy.q_points = q_points[color]; + if (q_points.size() > 0) + data_copy.q_points = q_points[color]; + if (inv_jacobian.size() > 0) + data_copy.inv_jacobian = inv_jacobian[color]; + if (JxW.size() > 0) + data_copy.JxW = JxW[color]; data_copy.local_to_global = local_to_global[color]; - data_copy.inv_jacobian = inv_jacobian[color]; - data_copy.JxW = JxW[color]; data_copy.id = my_id; data_copy.n_cells = n_cells[color]; data_copy.padding_length = padding_length; @@ -898,7 +901,9 @@ namespace CUDAWrappers if (typeid(Number) == typeid(double)) cudaDeviceSetSharedMemConfig(cudaSharedMemBankSizeEightByte); - const UpdateFlags &update_flags = additional_data.mapping_update_flags; + UpdateFlags update_flags = additional_data.mapping_update_flags; + if (update_flags & update_gradients) + update_flags |= update_JxW_values; if (additional_data.parallelization_scheme != parallel_over_elem && additional_data.parallelization_scheme != parallel_in_elem) -- 2.39.5