From 2c4ad17354c9cf9992e819e3bd300f36febc651d Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Mon, 8 Feb 2016 09:20:18 -0500 Subject: [PATCH] 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. --- include/deal.II/numerics/vector_tools.templates.h | 2 +- source/base/data_out_base.cc | 2 +- source/distributed/grid_refinement.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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 -- 2.39.5