From 2312026409b61e4c591f3d7a71cbd8c345c9afd8 Mon Sep 17 00:00:00 2001 From: Christoph Schwarzmeier <christoph.schwarzmeier@fau.de> Date: Mon, 10 Dec 2018 15:34:14 +0100 Subject: [PATCH] Bypass MPI/IO bug from OpenMPI 2.1.1 --- src/core/mpi/MPIManager.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/core/mpi/MPIManager.cpp b/src/core/mpi/MPIManager.cpp index a48f7304d..b855a67c7 100644 --- a/src/core/mpi/MPIManager.cpp +++ b/src/core/mpi/MPIManager.cpp @@ -22,12 +22,14 @@ //====================================================================================================================== #include "MPIManager.h" +#include "core/logging/Logging.h" #include <boost/exception_ptr.hpp> #include <exception> #include <iostream> #include <stdexcept> #include <vector> +#include <string> namespace walberla{ @@ -107,6 +109,22 @@ void MPIManager::initializeMPI( int* argc, char*** argv, bool abortOnException ) MPI_Comm_size( MPI_COMM_WORLD, &numProcesses_ ); MPI_Comm_rank( MPI_COMM_WORLD, &worldRank_ ); + // Avoid using the Cartesian MPI-communicator with certain versions of OpenMPI (see waLBerla issue #73) + #if defined(OMPI_MAJOR_VERSION) && defined(OMPI_MINOR_VERSION) && defined(OMPI_RELEASE_VERSION) + std::string ompi_ver = std::to_string(OMPI_MAJOR_VERSION) + "." + std::to_string(OMPI_MINOR_VERSION) + "." + + std::to_string(OMPI_RELEASE_VERSION); + + if (ompi_ver == "2.0.0" || ompi_ver == "2.0.1" || ompi_ver == "2.0.2" || ompi_ver == "2.0.3" || + ompi_ver == "2.1.0" || ompi_ver == "2.1.1") { + + useWorldComm(); + + WALBERLA_LOG_WARNING_ON_ROOT( "Your version of OpenMPI (" << ompi_ver << ") contains a bug. See waLBerla " + "issue #73 for more information. Using MPI_COMM_WORLD instead of a Cartesian " + "MPI communicator as a workaround." ); + } + #endif + if( abortOnException ) std::set_terminate( customTerminateHandler ); } -- GitLab