diff --git a/opm/simulators/utils/readDeck.cpp b/opm/simulators/utils/readDeck.cpp index 181b71099..42550d686 100644 --- a/opm/simulators/utils/readDeck.cpp +++ b/opm/simulators/utils/readDeck.cpp @@ -324,9 +324,17 @@ void readDeck(int rank, std::string& deckFilename, std::unique_ptr& d eclipseState = std::make_unique(); } + // In case of parse errors eclipseState/schedule might be null + // and trigger segmentation faults in parallel during broadcast + // (e.g. when serializing the non-existent TableManager) + auto comm = Dune::MPIHelper::getCollectiveCommunication(); + parseSuccess = comm.min(parseSuccess); try { - Opm::eclStateBroadcast(*eclipseState, *schedule, *summaryConfig); + if (parseSuccess) + { + Opm::eclStateBroadcast(*eclipseState, *schedule, *summaryConfig); + } } catch(const std::exception& broadcast_error) { @@ -344,8 +352,6 @@ void readDeck(int rank, std::string& deckFilename, std::unique_ptr& d errorGuard->clear(); } - - auto comm = Dune::MPIHelper::getCollectiveCommunication(); parseSuccess = comm.min(parseSuccess); if (!parseSuccess)