From 660a5bf8e0f8b66cf1fc7f267af4e56f37b7fcfc Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Tue, 20 Oct 2020 15:02:20 +0200 Subject: [PATCH] Ensure all communication is finished in matrix-free loops --- include/deal.II/matrix_free/matrix_free.h | 3 ++- source/matrix_free/task_info.cc | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index fc120c0f56..66bcbd9082 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -3135,7 +3135,7 @@ namespace internal template unsigned int find_vector_in_mf(const VectorType &vec, - const bool check_global_compatibility = false) const + const bool check_global_compatibility = true) const { unsigned int mf_component = numbers::invalid_unsigned_int; (void)check_global_compatibility; @@ -3565,6 +3565,7 @@ namespace internal std::is_same::value, "Type mismatch between VectorType and VectorDataExchange"); (void)component_in_block_vector; + if (vec.size() != 0) { # ifdef DEAL_II_WITH_MPI diff --git a/source/matrix_free/task_info.cc b/source/matrix_free/task_info.cc index c071c9dc76..fd89250393 100644 --- a/source/matrix_free/task_info.cc +++ b/source/matrix_free/task_info.cc @@ -353,7 +353,7 @@ namespace internal if (scheme != none) { funct.zero_dst_vector_range(numbers::invalid_unsigned_int); - if (scheme == partition_partition) + if (scheme == partition_partition && evens > 0) { tbb::empty_task *root = new (tbb::task::allocate_root()) tbb::empty_task; @@ -413,6 +413,14 @@ namespace internal root->wait_for_all(); root->destroy(*root); } + else if (scheme == partition_partition) + { + // catch the case of empty partition list: we still need to call + // the vector communication routines to clean up and initiate + // things + funct.vector_update_ghosts_finish(); + funct.vector_compress_start(); + } else // end of partition-partition, start of partition-color { // check whether there is only one partition. if not, build up the -- 2.39.5