mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Only warn and show parallel logging fallout on demand.
This commit adds an option that allows to enable detecting parallel logging fallout (option --enable-logging-fallout-warning). It is now false by default (previous behavior was as if the option was true). If option is true a warning will be printed for any process with nonzero rank that does try to log to *.PRT or *.DBG and the logged output will be appended to these files at the end.
This commit is contained in:
parent
52270e7ac7
commit
4b6144bb65
@ -58,12 +58,14 @@ NEW_PROP_TAG(OutputMode);
|
|||||||
NEW_PROP_TAG(EnableDryRun);
|
NEW_PROP_TAG(EnableDryRun);
|
||||||
NEW_PROP_TAG(OutputInterval);
|
NEW_PROP_TAG(OutputInterval);
|
||||||
NEW_PROP_TAG(UseAmg);
|
NEW_PROP_TAG(UseAmg);
|
||||||
|
NEW_PROP_TAG(EnableLoggingFalloutWarning);
|
||||||
|
|
||||||
SET_STRING_PROP(EclFlowProblem, OutputMode, "all");
|
SET_STRING_PROP(EclFlowProblem, OutputMode, "all");
|
||||||
|
|
||||||
// TODO: enumeration parameters. we use strings for now.
|
// TODO: enumeration parameters. we use strings for now.
|
||||||
SET_STRING_PROP(EclFlowProblem, EnableDryRun, "auto");
|
SET_STRING_PROP(EclFlowProblem, EnableDryRun, "auto");
|
||||||
|
// Do not merge parallel output files or warn about them
|
||||||
|
SET_BOOL_PROP(EclFlowProblem, EnableLoggingFalloutWarning, false);
|
||||||
SET_INT_PROP(EclFlowProblem, OutputInterval, 1);
|
SET_INT_PROP(EclFlowProblem, OutputInterval, 1);
|
||||||
|
|
||||||
END_PROPERTIES
|
END_PROPERTIES
|
||||||
@ -106,6 +108,9 @@ namespace Opm
|
|||||||
"Specify if the simulation ought to be actually run, or just pretended to be");
|
"Specify if the simulation ought to be actually run, or just pretended to be");
|
||||||
EWOMS_REGISTER_PARAM(TypeTag, int, OutputInterval,
|
EWOMS_REGISTER_PARAM(TypeTag, int, OutputInterval,
|
||||||
"Specify the number of report steps between two consecutive writes of restart data");
|
"Specify the number of report steps between two consecutive writes of restart data");
|
||||||
|
EWOMS_REGISTER_PARAM(TypeTag, bool, EnableLoggingFalloutWarning,
|
||||||
|
"Developer option to see whether logging was on non-root processors. In that case it will be appended to the *.DBG or *.PRT files");
|
||||||
|
|
||||||
Simulator::registerParameters();
|
Simulator::registerParameters();
|
||||||
|
|
||||||
ISTLSolverType::registerParameters();
|
ISTLSolverType::registerParameters();
|
||||||
@ -422,10 +427,11 @@ namespace Opm
|
|||||||
const std::string& output_dir = eclState().getIOConfig().getOutputDir();
|
const std::string& output_dir = eclState().getIOConfig().getOutputDir();
|
||||||
fs::path output_path(output_dir);
|
fs::path output_path(output_dir);
|
||||||
fs::path deck_filename(EWOMS_GET_PARAM(TypeTag, std::string, EclDeckFileName));
|
fs::path deck_filename(EWOMS_GET_PARAM(TypeTag, std::string, EclDeckFileName));
|
||||||
std::string basename = boost::to_upper_copy(deck_filename.stem().string());
|
std::string basename = boost::to_upper_copy(fs::path(deck_filename).stem().string());
|
||||||
std::for_each(fs::directory_iterator(output_path),
|
std::for_each(fs::directory_iterator(output_path),
|
||||||
fs::directory_iterator(),
|
fs::directory_iterator(),
|
||||||
detail::ParallelFileMerger(output_path, basename));
|
detail::ParallelFileMerger(output_path, basename,
|
||||||
|
EWOMS_GET_PARAM(TypeTag, bool, EnableLoggingFalloutWarning));
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupEbosSimulator()
|
void setupEbosSimulator()
|
||||||
|
@ -48,19 +48,25 @@ public:
|
|||||||
/// \param output_dir The output directory to use for reading/Writing.
|
/// \param output_dir The output directory to use for reading/Writing.
|
||||||
/// \param deckanme The name of the deck.
|
/// \param deckanme The name of the deck.
|
||||||
ParallelFileMerger(const fs::path& output_dir,
|
ParallelFileMerger(const fs::path& output_dir,
|
||||||
const std::string& deckname)
|
const std::string& deckname,
|
||||||
|
bool show_fallout = false)
|
||||||
: debugFileRegex_(deckname+"\\.\\d+\\.DBG"),
|
: debugFileRegex_(deckname+"\\.\\d+\\.DBG"),
|
||||||
logFileRegex_(deckname+"\\.\\d+\\.PRT"),
|
logFileRegex_(deckname+"\\.\\d+\\.PRT"),
|
||||||
fileWarningRegex_(deckname+"\\.(\\d+)\\.[^.]+")
|
fileWarningRegex_(deckname+"\\.(\\d+)\\.[^.]+"),
|
||||||
|
show_fallout_(show_fallout)
|
||||||
{
|
{
|
||||||
auto debugPath = output_dir;
|
std::cout<<"show_fallout="<<show_fallout_<<" "<<deckname<<std::endl;
|
||||||
debugPath /= (deckname + ".DBG");
|
if ( show_fallout_ )
|
||||||
debugStream_.reset(new fs::ofstream(debugPath,
|
{
|
||||||
std::ofstream::app));
|
auto debugPath = output_dir;
|
||||||
auto logPath = output_dir;
|
debugPath /= (deckname + ".DBG");
|
||||||
logPath /= ( deckname + ".PRT");
|
debugStream_.reset(new fs::ofstream(debugPath,
|
||||||
logStream_.reset(new fs::ofstream(logPath,
|
std::ofstream::app));
|
||||||
std::ofstream::app));
|
auto logPath = output_dir;
|
||||||
|
logPath /= ( deckname + ".PRT");
|
||||||
|
logStream_.reset(new fs::ofstream(logPath,
|
||||||
|
std::ofstream::app));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(const fs::path& file)
|
void operator()(const fs::path& file)
|
||||||
@ -74,20 +80,31 @@ public:
|
|||||||
|
|
||||||
if( boost::regex_match(filename, logFileRegex_) )
|
if( boost::regex_match(filename, logFileRegex_) )
|
||||||
{
|
{
|
||||||
appendFile(*logStream_, file, rank);
|
if ( show_fallout_ ){
|
||||||
|
appendFile(*logStream_, file, rank);
|
||||||
|
}else{
|
||||||
|
fs::remove(filename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (boost::regex_match(filename, debugFileRegex_) )
|
if (boost::regex_match(filename, debugFileRegex_) )
|
||||||
{
|
{
|
||||||
appendFile(*debugStream_, file, rank);
|
if ( show_fallout_ ){
|
||||||
|
appendFile(*debugStream_, file, rank);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
fs::remove(filename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING: Unrecognized file with name "
|
if ( show_fallout_ ){
|
||||||
<< filename
|
std::cerr << "WARNING: Unrecognized file with name "
|
||||||
<< " that might stem from a parallel run."
|
<< filename
|
||||||
<< std::endl;
|
<< " that might stem from a parallel run."
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,6 +146,8 @@ private:
|
|||||||
std::unique_ptr<fs::ofstream> debugStream_;
|
std::unique_ptr<fs::ofstream> debugStream_;
|
||||||
/// \brief Stream to *.PRT file
|
/// \brief Stream to *.PRT file
|
||||||
std::unique_ptr<fs::ofstream> logStream_;
|
std::unique_ptr<fs::ofstream> logStream_;
|
||||||
|
/// \brief Whether to show any logging fallout
|
||||||
|
bool show_fallout_;
|
||||||
};
|
};
|
||||||
} // end namespace detail
|
} // end namespace detail
|
||||||
} // end namespace OPM
|
} // end namespace OPM
|
||||||
|
Loading…
Reference in New Issue
Block a user