From 5c8addea055c2f1911c6c534dcf91a695da27b1a Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Mon, 21 Oct 2019 13:56:39 +0200 Subject: [PATCH] avoid 64bit overflow in Partiioner::set_ghost_indices We MPI::sum() a 32 bit value of the total number of ghost indices, which might overflow. This is unlikely to be a problem unless you exactly have 2^32 ghost indices, but this is nevertheless a bug. --- source/base/partitioner.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/base/partitioner.cc b/source/base/partitioner.cc index 4a63c4bc81..9d987a1ef1 100644 --- a/source/base/partitioner.cc +++ b/source/base/partitioner.cc @@ -174,7 +174,7 @@ namespace Utilities n_ghost_indices_data = ghost_indices_data.n_elements(); have_ghost_indices = - Utilities::MPI::sum(n_ghost_indices_data, communicator) > 0; + Utilities::MPI::max(n_ghost_indices_data, communicator) > 0; // In the rest of this function, we determine the point-to-point // communication pattern of the partitioner. We make up a list with both -- 2.39.5