]> https://gitweb.dealii.org/ - dealii.git/commitdiff
avoid 64bit overflow in Partiioner::set_ghost_indices 8936/head
authorTimo Heister <timo.heister@gmail.com>
Mon, 21 Oct 2019 11:56:39 +0000 (13:56 +0200)
committerTimo Heister <timo.heister@gmail.com>
Mon, 21 Oct 2019 13:35:33 +0000 (15:35 +0200)
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

index 4a63c4bc81e2509c6c3388b6290e2d2e4b55d537..9d987a1ef13a0000e010753ac0e7f1a0477e8c4b 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.