mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-29 20:43:49 -06:00
fixed: handle exceptions in I/O in parallel
properly exit on all processes, instead of deadlocking. async output will still deadlock as there is no way to handle this without syncronization which would defeat the purpose of async.
This commit is contained in:
parent
c9813886ba
commit
b5b42faba4
@ -288,6 +288,8 @@ namespace Opm
|
||||
const WellStateFullyImplicitBlackoil& wellState = (parallelOutput_ && parallelOutput_->isParallel() ) ? parallelOutput_->globalWellState() : localWellState;
|
||||
|
||||
// serial output is only done on I/O rank
|
||||
int err = 0;
|
||||
std::string emsg;
|
||||
if( isIORank )
|
||||
{
|
||||
if( asyncOutput_ ) {
|
||||
@ -296,7 +298,25 @@ namespace Opm
|
||||
}
|
||||
else {
|
||||
// just write the data to disk
|
||||
writeTimeStepSerial( timer, state, wellState, cellData, substep );
|
||||
try {
|
||||
writeTimeStepSerial( timer, state, wellState, cellData, substep );
|
||||
} catch (std::runtime_error& msg) {
|
||||
err = 1;
|
||||
emsg = msg.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!asyncOutput_) {
|
||||
#if HAVE_MPI
|
||||
MPI_Bcast(&err, 1, MPI_INT, 0, MPI_COMM_WORLD);
|
||||
#endif
|
||||
if (err) {
|
||||
if (isIORank) {
|
||||
throw std::runtime_error(emsg);
|
||||
} else {
|
||||
throw std::runtime_error("I/O process encountered problems.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,6 +132,8 @@ namespace Opm
|
||||
const WellStateFullyImplicitBlackoil& wellState = (parallelOutput_ && parallelOutput_->isParallel() ) ? parallelOutput_->globalWellState() : localWellState;
|
||||
|
||||
// serial output is only done on I/O rank
|
||||
int err = 0;
|
||||
std::string emsg;
|
||||
if( isIORank )
|
||||
{
|
||||
if( asyncOutput_ ) {
|
||||
@ -140,7 +142,25 @@ namespace Opm
|
||||
}
|
||||
else {
|
||||
// just write the data to disk
|
||||
writeTimeStepSerial( timer, state, wellState, sol, substep );
|
||||
try {
|
||||
writeTimeStepSerial( timer, state, wellState, sol, substep );
|
||||
} catch (std::runtime_error& msg) {
|
||||
err = 1;
|
||||
emsg = msg.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!asyncOutput_) {
|
||||
#if HAVE_MPI
|
||||
MPI_Bcast(&err, 1, MPI_INT, 0, MPI_COMM_WORLD);
|
||||
#endif
|
||||
if (err) {
|
||||
if (isIORank) {
|
||||
throw std::runtime_error(emsg);
|
||||
} else {
|
||||
throw std::runtime_error("I/O process encountered problems.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user