]> https://gitweb.dealii.org/ - dealii.git/commitdiff
check that size of ArrayView in internal::all_reduce() is the same across the given...
authorDenis Davydov <davydden@gmail.com>
Mon, 19 Mar 2018 14:10:51 +0000 (15:10 +0100)
committerDenis Davydov <davydden@gmail.com>
Mon, 19 Mar 2018 17:00:35 +0000 (18:00 +0100)
include/deal.II/base/mpi.templates.h

index 8302d7cdc9371ecd3babe867ce3ed47527b094f5..09473cf03d2d68fa2c9bca1516b3c429c059e31f 100644 (file)
@@ -120,6 +120,21 @@ namespace Utilities
 #ifdef DEAL_II_WITH_MPI
         if (job_supports_mpi())
           {
+#ifdef DEBUG
+            {
+              const unsigned int rank = this_mpi_process(mpi_communicator);
+              const int size = values.size();
+              int size_min = 0;
+              int size_max = 0;
+              int ierr2 = 0;
+              ierr2 = MPI_Reduce(&size, &size_min, 1, MPI_INT, MPI_MIN, 0, mpi_communicator);
+              AssertThrowMPI(ierr2);
+              ierr2 = MPI_Reduce(&size, &size_max, 1, MPI_INT, MPI_MAX, 0, mpi_communicator);
+              AssertThrowMPI(ierr2);
+              if (rank==0)
+                Assert (size_min == size_max, ExcMessage("values has different size across MPI processes."));
+            }
+#endif
             const int ierr = MPI_Allreduce
                              (values != output
                               ?

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.