[bugfix] 1) create asyncOutput object on all ranks to avoid deadlock in

MPI_Bcast call in writeTimeStepWithCellProperties.
2) ThreadHandle waits on destruction until all objects have been dealt with.
This commit is contained in:
Robert Kloefkorn
2017-05-29 18:08:18 +02:00
parent a61d8ab14a
commit e46810d2dc
2 changed files with 60 additions and 29 deletions

View File

@@ -372,22 +372,6 @@ namespace Opm
// Ensure that output dir exists
ensureDirectoryExists(outputDir_);
// create output thread if enabled and rank is I/O rank
// async output is enabled by default if pthread are enabled
#if HAVE_PTHREAD
const bool asyncOutputDefault = false;
#else
const bool asyncOutputDefault = false;
#endif
if( param.getDefault("async_output", asyncOutputDefault ) )
{
#if HAVE_PTHREAD
asyncOutput_.reset( new ThreadHandle() );
#else
OPM_THROW(std::runtime_error,"Pthreads were not found, cannot enable async_output");
#endif
}
std::string backupfilename = param.getDefault("backupfile", std::string("") );
if( ! backupfilename.empty() )
{
@@ -395,6 +379,23 @@ namespace Opm
}
}
}
// create output thread if enabled and rank is I/O rank
// async output is enabled by default if pthread are enabled
#if HAVE_PTHREAD
const bool asyncOutputDefault = true;
#else
const bool asyncOutputDefault = false;
#endif
if( param.getDefault("async_output", asyncOutputDefault ) )
{
#if HAVE_PTHREAD
asyncOutput_.reset( new ThreadHandle( parallelOutput_->isIORank() ) );
#else
OPM_THROW(std::runtime_error,"Pthreads were not found, cannot enable async_output");
#endif
}
}