From: Timo Heister Date: Mon, 8 Feb 2016 14:20:18 +0000 (-0500) Subject: fix several scary MPI bugs X-Git-Tag: v8.4.0-rc2~23^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2148%2Fhead;p=dealii.git fix several scary MPI bugs I am surprised the code in question used to work at all because we are just overwriting random memory. I detected those using clang's argument type warnings and extensible clang type annotation within MPICH. --- diff --git a/include/deal.II/numerics/vector_tools.templates.h b/include/deal.II/numerics/vector_tools.templates.h index f693089c39..e6889a36b4 100644 --- a/include/deal.II/numerics/vector_tools.templates.h +++ b/include/deal.II/numerics/vector_tools.templates.h @@ -7082,7 +7082,7 @@ namespace VectorTools double my_values[3] = { mean_double.real(), mean_double.imag(), area }; double global_values[3]; - MPI_Allreduce (&my_values, &global_values, 3, MPI_DOUBLE, + MPI_Allreduce (my_values, global_values, 3, MPI_DOUBLE, MPI_SUM, p_triangulation->get_communicator()); diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index ff0005d352..8e5a78bbd7 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -6173,7 +6173,7 @@ void DataOutInterface::write_vtu_in_parallel (const char *filename MPI_File_write(fh, const_cast(ss.str().c_str()), header_size, MPI_CHAR, MPI_STATUS_IGNORE); } - MPI_Bcast(&header_size, 1, MPI_INT, 0, comm); + MPI_Bcast(&header_size, 1, MPI_UNSIGNED, 0, comm); MPI_File_seek_shared( fh, header_size, MPI_SEEK_SET ); { diff --git a/source/distributed/grid_refinement.cc b/source/distributed/grid_refinement.cc index 262c50e7b4..0c772583a8 100644 --- a/source/distributed/grid_refinement.cc +++ b/source/distributed/grid_refinement.cc @@ -96,7 +96,7 @@ namespace // compute the minimum on // processor zero - MPI_Reduce (&comp, &result, 2, MPI_DOUBLE, + MPI_Reduce (comp, result, 2, MPI_DOUBLE, MPI_MIN, 0, mpi_communicator); // make sure only processor zero