From: Martin Kronbichler Date: Tue, 29 Aug 2023 13:31:24 +0000 (+0200) Subject: FEEvaluation: Add some padding between different data fields X-Git-Tag: relicensing~537^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32a2c97afc4eb13c33b6a8326d71e0b7cf40012b;p=dealii.git FEEvaluation: Add some padding between different data fields --- diff --git a/include/deal.II/matrix_free/fe_evaluation_data.h b/include/deal.II/matrix_free/fe_evaluation_data.h index 4b6c1c53e6..061eb3c0bc 100644 --- a/include/deal.II/matrix_free/fe_evaluation_data.h +++ b/include/deal.II/matrix_free/fe_evaluation_data.h @@ -49,9 +49,9 @@ namespace internal std::string, << "You are requesting information from an FEEvaluation/FEFaceEvaluation " << "object for which this kind of information has not been computed. What " - << "information these objects compute is determined by the update_* flags you " - << "pass to MatrixFree::reinit() via MatrixFree::AdditionalData. Here, " - << "the operation you are attempting requires the <" << arg1 + << "information these objects compute is determined by the update_* flags " + << "you pass to MatrixFree::reinit() via MatrixFree::AdditionalData. " + << "Here, the operation you are attempting requires the <" << arg1 << "> flag to be set, but it was apparently not specified " << "upon initialization."); } // namespace internal @@ -1205,7 +1205,9 @@ FEEvaluationData::set_data_pointers( (n_components * ((dim * (dim + 1)) / 2 + 2 * dim + 2) * n_quadrature_points); - const unsigned int allocated_size = size_scratch_data + size_data_arrays; + // include 12 extra fields to insert some padding between values, gradients + // and hessians, which helps to reduce the probability of cache conflicts + const unsigned int allocated_size = size_scratch_data + size_data_arrays + 12; # ifdef DEBUG scratch_data_array->clear(); scratch_data_array->resize(allocated_size, @@ -1213,23 +1215,24 @@ FEEvaluationData::set_data_pointers( # else scratch_data_array->resize_fast(allocated_size); # endif - scratch_data.reinit(scratch_data_array->begin() + size_data_arrays, + scratch_data.reinit(scratch_data_array->begin() + size_data_arrays + 12, size_scratch_data); // set the pointers to the correct position in the data array values_dofs = scratch_data_array->begin(); - values_quad = scratch_data_array->begin() + n_components * dofs_per_component; + values_quad = + scratch_data_array->begin() + 4 + n_components * dofs_per_component; values_from_gradients_quad = - scratch_data_array->begin() + + scratch_data_array->begin() + 6 + n_components * (dofs_per_component + n_quadrature_points); gradients_quad = - scratch_data_array->begin() + + scratch_data_array->begin() + 8 + n_components * (dofs_per_component + 2 * n_quadrature_points); gradients_from_hessians_quad = - scratch_data_array->begin() + + scratch_data_array->begin() + 12 + n_components * (dofs_per_component + (dim + 2) * n_quadrature_points); hessians_quad = - scratch_data_array->begin() + + scratch_data_array->begin() + 12 + n_components * (dofs_per_component + (2 * dim + 2) * n_quadrature_points); }