Skip to content
Snippets Groups Projects
Commit 24983f11 authored by Michael Kuron's avatar Michael Kuron :mortar_board:
Browse files

Work around MPI startup race condition on macOS

If a process started by mpiexec finishes too quickly, sometimes some of the other processes are not started.
It is unclear whether this is an OpenMPI or macOS bug, but appears significantly more often since moving from macOS 10.13 to 10.15. OpenMPI 4.0.1 and 3.0.0 both show the issue on macOS 10.15.
parent ce8db003
Branches
No related merge requests found
......@@ -32,6 +32,9 @@
#include <stdexcept>
#include <string>
#include <vector>
#ifdef __APPLE__
#include <thread>
#endif
namespace walberla
{
......@@ -94,6 +97,12 @@ void MPIManager::initializeMPI(int* argc, char*** argv, bool abortOnException)
MPI_Initialized(&mpiAlreadyInitialized);
if (!mpiAlreadyInitialized)
{
#ifdef __APPLE__
/* Work around a race condition on macOS.
If a process started by mpiexec finishes too quickly, it sometimes doesn't start all processes.
*/
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
#endif
MPI_Init(argc, argv);
finalizeOnDestruction_ = true;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment