mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #681 from dr-robertk/PR/use_have_pthread
Use HAVE_PTHREAD to enable async output.
This commit is contained in:
commit
ca40a31e7b
@ -302,12 +302,6 @@ namespace Opm
|
||||
eclipseState_(eclipseState),
|
||||
asyncOutput_()
|
||||
{
|
||||
// create output thread if needed
|
||||
if( output_ && param.getDefault("async_output", bool( false ) ) )
|
||||
{
|
||||
asyncOutput_.reset( new ThreadHandle() );
|
||||
}
|
||||
|
||||
// For output.
|
||||
if (output_ && parallelOutput_->isIORank() ) {
|
||||
// Ensure that output dir exists
|
||||
@ -319,6 +313,22 @@ namespace Opm
|
||||
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
|
||||
}
|
||||
|
||||
// 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() );
|
||||
#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() )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user