mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
move Damaris parameters to TypeTag-free parameter system
This commit is contained in:
parent
94c30a74b8
commit
9141f2c2d5
@ -31,51 +31,22 @@
|
||||
#ifndef OPM_DAMARIS_PARAMETERS_HPP
|
||||
#define OPM_DAMARIS_PARAMETERS_HPP
|
||||
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct EnableDamarisOutput { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct DamarisOutputHdfCollective { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct DamarisSaveMeshToHdf { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct DamarisSaveToHdf { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct DamarisPythonScript { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct DamarisPythonParaviewScript { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct DamarisSimName { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct DamarisDedicatedCores { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct DamarisDedicatedNodes { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct DamarisSharedMemoryName { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct DamarisSharedMemorySizeBytes { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct DamarisLogLevel { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct DamarisDaskFile { using type = Properties::UndefinedProperty; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct DamarisLimitVariables { using type = Properties::UndefinedProperty; };
|
||||
struct EnableDamarisOutput { static constexpr bool value = false; };
|
||||
struct DamarisOutputHdfCollective { static constexpr bool value = true; };
|
||||
struct DamarisSaveMeshToHdf { static constexpr bool value = false; };
|
||||
struct DamarisSaveToHdf { static constexpr bool value = true; };
|
||||
struct DamarisPythonScript { static constexpr auto value = ""; };
|
||||
struct DamarisPythonParaviewScript { static constexpr auto value = ""; };
|
||||
struct DamarisSimName { static constexpr auto value = ""; };
|
||||
struct DamarisDedicatedCores { static constexpr int value = 1; };
|
||||
struct DamarisDedicatedNodes { static constexpr int value = 0; };
|
||||
struct DamarisSharedMemoryName { static constexpr auto value = "" ; };
|
||||
struct DamarisSharedMemorySizeBytes { static constexpr long value = 536870912; }; // 512 MB
|
||||
struct DamarisLogLevel { static constexpr auto value = "info"; };
|
||||
struct DamarisDaskFile { static constexpr auto value = ""; };
|
||||
struct DamarisLimitVariables { static constexpr auto value = ""; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
|
@ -105,58 +105,58 @@ class DamarisWriter : public EclGenericWriter<GetPropType<TypeTag, Properties::G
|
||||
public:
|
||||
static void registerParameters()
|
||||
{
|
||||
Parameters::registerParam<TypeTag, Parameters::DamarisOutputHdfCollective>
|
||||
Parameters::Register<Parameters::DamarisOutputHdfCollective>
|
||||
("Write output via Damaris using parallel HDF5 to "
|
||||
"get single file and dataset per timestep instead "
|
||||
"of one per Damaris core with multiple datasets.");
|
||||
Parameters::registerParam<TypeTag, Parameters::DamarisSaveToHdf>
|
||||
Parameters::Register<Parameters::DamarisSaveToHdf>
|
||||
("Set to false to prevent output to HDF5. "
|
||||
"Uses collective output by default or "
|
||||
"set --enable-damaris-collective=false to"
|
||||
"use file per core (file per Damaris server).");
|
||||
Parameters::registerParam<TypeTag, Parameters::DamarisSaveMeshToHdf>
|
||||
Parameters::Register<Parameters::DamarisSaveMeshToHdf>
|
||||
("Saves the mesh data to the HDF5 file (1st iteration only). "
|
||||
"Will set --damaris-output-hdf-collective to false "
|
||||
"so will use file per core (file per Damaris server) output "
|
||||
"(global sizes and offset values of mesh variables are not being provided as yet).");
|
||||
Parameters::registerParam<TypeTag, Parameters::DamarisPythonScript>
|
||||
Parameters::Register<Parameters::DamarisPythonScript>
|
||||
("Set to the path and filename of a Python script to run on "
|
||||
"Damaris server resources with access to OPM flow data.");
|
||||
Parameters::registerParam<TypeTag, Parameters::DamarisPythonParaviewScript>
|
||||
Parameters::Register<Parameters::DamarisPythonParaviewScript>
|
||||
("Set to the path and filename of a Paraview Python script "
|
||||
"to run on Paraview Catalyst (1 or 2) on Damaris server "
|
||||
"resources with access to OPM flow data.");
|
||||
Parameters::registerParam<TypeTag, Parameters::DamarisSimName>
|
||||
Parameters::Register<Parameters::DamarisSimName>
|
||||
("The name of the simulation to be used by Damaris. "
|
||||
"If empty (the default) then Damaris uses \"opm-sim-<random-number>\". "
|
||||
"This name is used for the Damaris HDF5 file name prefix. "
|
||||
"Make unique if writing to the same output directory.");
|
||||
Parameters::registerParam<TypeTag, Parameters::DamarisLogLevel>
|
||||
Parameters::Register<Parameters::DamarisLogLevel>
|
||||
("The log level for the Damaris logging system (boost log based). "
|
||||
"Levels are: [trace, debug, info, warning, error, fatal]. "
|
||||
"Currently debug and info are useful. ");
|
||||
Parameters::registerParam<TypeTag, Parameters::DamarisDaskFile>
|
||||
Parameters::Register<Parameters::DamarisDaskFile>
|
||||
("The name of a Dask json configuration file (if using Dask for processing).");
|
||||
Parameters::registerParam<TypeTag, Parameters::DamarisDedicatedCores>
|
||||
Parameters::Register<Parameters::DamarisDedicatedCores>
|
||||
("Set the number of dedicated cores (MPI processes) "
|
||||
"that should be used for Damaris processing (per node). "
|
||||
"Must divide evenly into the number of simulation ranks (client ranks).");
|
||||
Parameters::registerParam<TypeTag, Parameters::DamarisDedicatedNodes>
|
||||
Parameters::Register<Parameters::DamarisDedicatedNodes>
|
||||
("Set the number of dedicated nodes (full nodes) "
|
||||
"that should be used for Damaris processing (per simulation). "
|
||||
"Must divide evenly into the number of simulation nodes.");
|
||||
Parameters::registerParam<TypeTag, Parameters::DamarisSharedMemorySizeBytes>
|
||||
Parameters::Register<Parameters::DamarisSharedMemorySizeBytes>
|
||||
("Set the size of the shared memory buffer used for IPC "
|
||||
"between the simulation and the Damaris resources. "
|
||||
"Needs to hold all the variables published, possibly over "
|
||||
"multiple simulation iterations.");
|
||||
Parameters::registerParam<TypeTag, Parameters::DamarisSharedMemoryName>
|
||||
Parameters::Register<Parameters::DamarisSharedMemoryName>
|
||||
("The name of the shared memory area to be used by Damaris for the current. "
|
||||
"If empty (the default) then Damaris uses \"opm-damaris-<random-string>\". "
|
||||
"This name should be unique if multiple simulations are running on "
|
||||
"the same node/server as it is used for the Damaris shmem name and by "
|
||||
"the Python Dask library to locate sections of variables.");
|
||||
Parameters::registerParam<TypeTag, Parameters::DamarisLimitVariables>
|
||||
Parameters::Register<Parameters::DamarisLimitVariables>
|
||||
("A comma separated list of variable names that a user wants to pass "
|
||||
"through via DamarisOutput::DamarisWriter::writeOutput)() to the "
|
||||
"damaris_write() call. This can be used to limit the number of "
|
||||
@ -351,7 +351,8 @@ private:
|
||||
|
||||
static bool enableDamarisOutput_()
|
||||
{
|
||||
return Parameters::get<TypeTag, Parameters::EnableDamarisOutput>();
|
||||
static bool enable = Parameters::Get<Parameters::EnableDamarisOutput>();
|
||||
return enable;
|
||||
}
|
||||
|
||||
void setGlobalIndexForDamaris ()
|
||||
|
@ -228,7 +228,7 @@ public:
|
||||
("Write binary output which is compatible with the commercial "
|
||||
"Eclipse simulator");
|
||||
#if HAVE_DAMARIS
|
||||
Parameters::registerParam<TypeTag, Parameters::EnableDamarisOutput>
|
||||
Parameters::Register<Parameters::EnableDamarisOutput>
|
||||
("Write a specific variable using Damaris in a separate core");
|
||||
#endif
|
||||
Parameters::registerParam<TypeTag, Parameters::EclOutputDoublePrecision>
|
||||
@ -331,7 +331,7 @@ public:
|
||||
#if HAVE_DAMARIS
|
||||
// create Damaris writer
|
||||
damarisWriter_ = std::make_unique<DamarisWriterType>(simulator);
|
||||
enableDamarisOutput_ = Parameters::get<TypeTag, Parameters::EnableDamarisOutput>();
|
||||
enableDamarisOutput_ = Parameters::Get<Parameters::EnableDamarisOutput>();
|
||||
#endif
|
||||
enableDriftCompensation_ = Parameters::get<TypeTag, Parameters::EnableDriftCompensation>();
|
||||
|
||||
|
@ -268,89 +268,6 @@ struct EnableExperiments<TypeTag, TTag::FlowBaseProblem>
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
#ifdef HAVE_DAMARIS
|
||||
//! Disable the Damaris HDF5 output by default
|
||||
template<class TypeTag>
|
||||
struct EnableDamarisOutput<TypeTag, Properties::TTag::FlowBaseProblem>
|
||||
{ static constexpr bool value = false; };
|
||||
|
||||
// If Damaris is available, write specific variable output in parallel
|
||||
template<class TypeTag>
|
||||
struct DamarisOutputHdfCollective<TypeTag, Properties::TTag::FlowBaseProblem>
|
||||
{ static constexpr bool value = true; };
|
||||
|
||||
// Save the reservoir model mesh data to the HDF5 file
|
||||
// (even if field data HDF5 output is disabled)
|
||||
template<class TypeTag>
|
||||
struct DamarisSaveMeshToHdf<TypeTag, Properties::TTag::FlowBaseProblem>
|
||||
{ static constexpr bool value = false; };
|
||||
|
||||
// Save the simulation fields (currently only PRESSURE) variables to HDF5 file
|
||||
template<class TypeTag>
|
||||
struct DamarisSaveToHdf<TypeTag, Properties::TTag::FlowBaseProblem>
|
||||
{ static constexpr bool value = true; };
|
||||
|
||||
// Specify path and filename of a Python script to run on each end of iteration output
|
||||
template<class TypeTag>
|
||||
struct DamarisPythonScript<TypeTag, Properties::TTag::FlowBaseProblem>
|
||||
{ static constexpr auto value = ""; };
|
||||
|
||||
// Specifiy a Paraview Catalyst in situ visualisation script
|
||||
// (if Paraview is enabled in Damaris)
|
||||
template<class TypeTag>
|
||||
struct DamarisPythonParaviewScript<TypeTag, Properties::TTag::FlowBaseProblem>
|
||||
{ static constexpr auto value = ""; };
|
||||
|
||||
// Specify a unique name for the Damaris simulation (used as prefix to HDF5 filenames)
|
||||
template<class TypeTag>
|
||||
struct DamarisSimName<TypeTag, Properties::TTag::FlowBaseProblem>
|
||||
{ static constexpr auto value = ""; };
|
||||
|
||||
// Specify the number of Damaris cores (dc) to create (per-node).
|
||||
// Must divide into the remaining ranks
|
||||
// equally, e.g. mpirun -np 16 ... -> (if running on one node)
|
||||
// The following are allowed:
|
||||
// 1 dc + 15 sim ranks
|
||||
// or 2 dc + 14 sim
|
||||
// or 4 dc + 12 sim
|
||||
// *not* 3 dc + 13 sim ranks
|
||||
template<class TypeTag>
|
||||
struct DamarisDedicatedCores<TypeTag, Properties::TTag::FlowBaseProblem>
|
||||
{ static constexpr int value = 1; };
|
||||
|
||||
// Specify the number of Damaris nodes to create
|
||||
template<class TypeTag>
|
||||
struct DamarisDedicatedNodes<TypeTag, Properties::TTag::FlowBaseProblem>
|
||||
{ static constexpr int value = 0; };
|
||||
|
||||
// Specify a name for the Damaris shared memory file
|
||||
// (a unique name will be created by default)
|
||||
template<class TypeTag>
|
||||
struct DamarisSharedMemoryName<TypeTag, Properties::TTag::FlowBaseProblem>
|
||||
{ static constexpr auto value = "" ; };
|
||||
|
||||
// Specify the shared memory file size
|
||||
template<class TypeTag>
|
||||
struct DamarisSharedMemorySizeBytes<TypeTag, Properties::TTag::FlowBaseProblem>
|
||||
{ static constexpr long value = 536870912; }; // 512 MB
|
||||
|
||||
// Specify the Damaris log level - if set to debug then log is flushed regularly
|
||||
template<class TypeTag>
|
||||
struct DamarisLogLevel<TypeTag, Properties::TTag::FlowBaseProblem>
|
||||
{ static constexpr auto value = "info"; };
|
||||
|
||||
// Specify the dask file jason file that specifies the Dask scheduler etc.
|
||||
template<class TypeTag>
|
||||
struct DamarisDaskFile<TypeTag, Properties::TTag::FlowBaseProblem>
|
||||
{ static constexpr auto value = ""; };
|
||||
|
||||
// Specify the the exact variables to be passed through
|
||||
// to Damaris (must exist in the XML file / intiDamarisXmlFile.cpp)
|
||||
template<class TypeTag>
|
||||
struct DamarisLimitVariables<TypeTag, Properties::TTag::FlowBaseProblem>
|
||||
{ static constexpr auto value = ""; };
|
||||
#endif
|
||||
|
||||
// By default, use single precision for the ECL formated results
|
||||
template<class TypeTag>
|
||||
struct EclOutputDoublePrecision<TypeTag, Properties::TTag::FlowBaseProblem>
|
||||
|
@ -342,7 +342,7 @@ private:
|
||||
}
|
||||
|
||||
#if HAVE_DAMARIS
|
||||
enableDamarisOutput_ = Parameters::get<PreTypeTag, Parameters::EnableDamarisOutput>();
|
||||
enableDamarisOutput_ = Parameters::Get<Parameters::EnableDamarisOutput>();
|
||||
|
||||
// Reset to false as we cannot use Damaris if there is only one rank.
|
||||
if ((enableDamarisOutput_ == true) && (FlowGenericVanguard::comm().size() == 1)) {
|
||||
|
@ -97,18 +97,18 @@ getDamarisKeywords(const Parallel::Communication& comm, const std::string& Outpu
|
||||
// which is used in simulators/flow/Main.hpp)
|
||||
// These command line arguments are defined in opm/simulators/flow/DamarisWriter.hpp and
|
||||
// defaults are set in opm/simulators/flow/FlowProblemProperties.hpp
|
||||
settings.enableDamarisOutputCollective_ = Parameters::get<TypeTag, Parameters::DamarisOutputHdfCollective>();
|
||||
settings.saveMeshToHDF5_ = Parameters::get<TypeTag, Parameters::DamarisSaveMeshToHdf>();
|
||||
settings.saveToDamarisHDF5_ = Parameters::get<TypeTag, Parameters::DamarisSaveToHdf>();
|
||||
settings.pythonFilename_ = Parameters::get<TypeTag, Parameters::DamarisPythonScript>();
|
||||
settings.paraviewPythonFilename_ = Parameters::get<TypeTag, Parameters::DamarisPythonParaviewScript>();
|
||||
settings.damarisSimName_ = Parameters::get<TypeTag, Parameters::DamarisSimName>();
|
||||
settings.nDamarisCores_ = Parameters::get<TypeTag, Parameters::DamarisDedicatedCores>();
|
||||
settings.nDamarisNodes_ = Parameters::get<TypeTag, Parameters::DamarisDedicatedNodes>();
|
||||
settings.shmemSizeBytes_ = Parameters::get<TypeTag, Parameters::DamarisSharedMemorySizeBytes>();
|
||||
settings.shmemName_ = Parameters::get<TypeTag, Parameters::DamarisSharedMemoryName>();
|
||||
settings.damarisLogLevel_ = Parameters::get<TypeTag, Parameters::DamarisLogLevel>();
|
||||
settings.damarisDaskFile_ = Parameters::get<TypeTag, Parameters::DamarisDaskFile>();
|
||||
settings.enableDamarisOutputCollective_ = Parameters::Get<Parameters::DamarisOutputHdfCollective>();
|
||||
settings.saveMeshToHDF5_ = Parameters::Get<Parameters::DamarisSaveMeshToHdf>();
|
||||
settings.saveToDamarisHDF5_ = Parameters::Get<Parameters::DamarisSaveToHdf>();
|
||||
settings.pythonFilename_ = Parameters::Get<Parameters::DamarisPythonScript>();
|
||||
settings.paraviewPythonFilename_ = Parameters::Get<Parameters::DamarisPythonParaviewScript>();
|
||||
settings.damarisSimName_ = Parameters::Get<Parameters::DamarisSimName>();
|
||||
settings.nDamarisCores_ = Parameters::Get<Parameters::DamarisDedicatedCores>();
|
||||
settings.nDamarisNodes_ = Parameters::Get<Parameters::DamarisDedicatedNodes>();
|
||||
settings.shmemSizeBytes_ = Parameters::Get<Parameters::DamarisSharedMemorySizeBytes>();
|
||||
settings.shmemName_ = Parameters::Get<Parameters::DamarisSharedMemoryName>();
|
||||
settings.damarisLogLevel_ = Parameters::Get<Parameters::DamarisLogLevel>();
|
||||
settings.damarisDaskFile_ = Parameters::Get<Parameters::DamarisDaskFile>();
|
||||
|
||||
return settings.getKeywords(comm, OutputDir);
|
||||
}
|
||||
@ -120,7 +120,7 @@ getSetOfIncludedVariables(void)
|
||||
std::unordered_set<std::string> resuset ;
|
||||
std::string tstr;
|
||||
// The --damaris-limit-variables command line option (defaults to empty string)
|
||||
std::string damarisLimitVars = Parameters::get<TypeTag, Parameters::DamarisLimitVariables>();
|
||||
std::string damarisLimitVars = Parameters::Get<Parameters::DamarisLimitVariables>();
|
||||
std::stringstream ss(damarisLimitVars);
|
||||
|
||||
// Use while loop to check the getline() function condition.
|
||||
|
Loading…
Reference in New Issue
Block a user