From cef8ac0cb33fe5543611e5860691e5ac6d4de965 Mon Sep 17 00:00:00 2001 From: Sebastian Eibl <sebastian.eibl@fau.de> Date: Mon, 12 Feb 2018 13:41:21 +0100 Subject: [PATCH] fixed wrong initialization of communicator --- src/pe/utility/CreateWorld.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/pe/utility/CreateWorld.cpp b/src/pe/utility/CreateWorld.cpp index a95db6201..3ede915c6 100644 --- a/src/pe/utility/CreateWorld.cpp +++ b/src/pe/utility/CreateWorld.cpp @@ -59,7 +59,8 @@ std::unique_ptr<SetupBlockForest> createSetupBlockForest(const math::AABB simula { WALBERLA_MPI_SECTION() { - MPIManager::instance()->useWorldComm(); + if (!MPIManager::instance()->rankValid()) + MPIManager::instance()->useWorldComm(); } if (isPeriodic[0] && blocks[0]<2) @@ -95,6 +96,12 @@ shared_ptr<BlockForest> createBlockForest(const math::AABB simulationDomain, const uint_t numberOfProcesses, const uint_t initialRefinementLevel) { + WALBERLA_MPI_SECTION() + { + if (!MPIManager::instance()->rankValid()) + MPIManager::instance()->useWorldComm(); + } + std::unique_ptr<SetupBlockForest> sforest( createSetupBlockForest( simulationDomain, blocks, isPeriodic, numberOfProcesses, initialRefinementLevel )); return shared_ptr< BlockForest >( new BlockForest( uint_c( MPIManager::instance()->rank() ), *sforest, false ) ); } @@ -127,6 +134,12 @@ shared_ptr<BlockForest> createBlockForest(const math::AABB simulationDomain, return shared_ptr<BlockForest>(); } + WALBERLA_MPI_SECTION() + { + if (!MPIManager::instance()->rankValid()) + MPIManager::instance()->useWorldComm(); + } + WALBERLA_LOG_INFO_ON_ROOT( "Production Run!" ); WALBERLA_LOG_INFO_ON_ROOT( "Creating the block structure: loading from file \'" << sbffile << "\' ..." ); return shared_ptr< BlockForest >( new BlockForest( uint_c( MPIManager::instance()->rank() ), sbffile.c_str(), true, false ) ); -- GitLab