From 68b45bfb89df739433a5ae8b097c19e39b21e36c Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Tue, 16 May 2023 14:04:24 +0200 Subject: [PATCH] Avoid setting face vectorization boundary in serial --- .../matrix_free/matrix_free.templates.h | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/include/deal.II/matrix_free/matrix_free.templates.h b/include/deal.II/matrix_free/matrix_free.templates.h index 7162655951..4f66144506 100644 --- a/include/deal.II/matrix_free/matrix_free.templates.h +++ b/include/deal.II/matrix_free/matrix_free.templates.h @@ -1951,14 +1951,23 @@ MatrixFree::initialize_indices( std::vector hard_vectorization_boundary( task_info.face_partition_data.size(), false); - if (task_info.scheme == internal::MatrixFreeFunctions::TaskInfo::none && - task_info.partition_row_index[2] < - task_info.face_partition_data.size()) - hard_vectorization_boundary[task_info.partition_row_index[2]] = true; + if (task_info.scheme == internal::MatrixFreeFunctions::TaskInfo::none) + { + // In case we do an MPI data exchange, we must make sure to first + // complete all face integrals with results in the ghost range + if (task_info.partition_row_index[2] < + task_info.face_partition_data.size()) + hard_vectorization_boundary[task_info.partition_row_index[2]] = + true; + } else - std::fill(hard_vectorization_boundary.begin(), - hard_vectorization_boundary.end(), - true); + { + // If we do threading, we need to strictly adhere to each partition, + // as we can't schedule work on conflicting face batches + std::fill(hard_vectorization_boundary.begin(), + hard_vectorization_boundary.end(), + true); + } internal::MatrixFreeFunctions::collect_faces_vectorization( face_setup.inner_faces, -- 2.39.5