mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-26 19:46:24 -06:00
ThreadsPerProcess moved to TypeTag-free parameter system
This commit is contained in:
parent
a20cb10572
commit
9e11888ccb
@ -122,14 +122,6 @@ struct LinearSolverBackend<TypeTag, TTag::FlowExpTypeTag> {
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// if openMP is available, set the default the number of threads per process for the main
|
||||
// simulation to 2 (instead of grabbing everything that is available).
|
||||
#if _OPENMP
|
||||
template<class TypeTag>
|
||||
struct ThreadsPerProcess<TypeTag, Properties::TTag::FlowExpTypeTag>
|
||||
{ static constexpr int value = 2; };
|
||||
#endif
|
||||
|
||||
// By default, flowexp accepts the result of the time integration unconditionally if the
|
||||
// smallest time step size is reached.
|
||||
template<class TypeTag>
|
||||
@ -230,6 +222,12 @@ public:
|
||||
Parameters::hideParam<TypeTag, Parameters::UseUpdateStabilization>();
|
||||
Parameters::hideParam<TypeTag, Parameters::MatrixAddWellContributions>();
|
||||
Parameters::hideParam<TypeTag, Parameters::EnableTerminalOutput>();
|
||||
|
||||
// if openMP is available, set the default the number of threads per process for the main
|
||||
// simulation to 2 (instead of grabbing everything that is available).
|
||||
#if _OPENMP
|
||||
Parameters::SetDefault<Parameters::ThreadsPerProcess>(2);
|
||||
#endif
|
||||
}
|
||||
|
||||
// inherit the constructors
|
||||
|
@ -121,10 +121,6 @@ struct NewtonTolerance<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
|
||||
static constexpr type value = 1e-2;
|
||||
};
|
||||
|
||||
template<class TypeTag>
|
||||
struct ThreadsPerProcess<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
|
||||
{ static constexpr int value = 1; };
|
||||
|
||||
template<class TypeTag>
|
||||
struct EclNewtonStrictIterations<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
|
||||
{ static constexpr int value = 100; };
|
||||
|
@ -455,15 +455,6 @@ template<class TypeTag>
|
||||
struct LocalDomainsOrderingMeasure<TypeTag, Properties::TTag::FlowModelParameters>
|
||||
{ static constexpr auto value = "maxpressure"; };
|
||||
|
||||
// if openMP is available, determine the number threads per process automatically.
|
||||
#if _OPENMP
|
||||
template<class TypeTag>
|
||||
struct ThreadsPerProcess<TypeTag, Properties::TTag::FlowModelParameters>
|
||||
{
|
||||
static constexpr int value = -1;
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
@ -790,7 +781,13 @@ public:
|
||||
Parameters::registerParam<TypeTag, Parameters::DebugEmitCellPartition>
|
||||
("Whether or not to emit cell partitions as a debugging aid.");
|
||||
|
||||
|
||||
Parameters::hideParam<TypeTag, Parameters::DebugEmitCellPartition>();
|
||||
|
||||
// if openMP is available, determine the number threads per process automatically.
|
||||
#if _OPENMP
|
||||
Parameters::SetDefault<Parameters::ThreadsPerProcess>(-1);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -107,6 +107,7 @@ namespace Opm {
|
||||
("Developer option to see whether logging was on non-root processors. "
|
||||
"In that case it will be appended to the *.DBG or *.PRT files");
|
||||
|
||||
ThreadManager<TypeTag>::registerParameters();
|
||||
Simulator::registerParameters();
|
||||
|
||||
// register the base parameters
|
||||
@ -362,7 +363,7 @@ namespace Opm {
|
||||
// Issue a warning if both OMP_NUM_THREADS and --threads-per-process are set,
|
||||
// but let the environment variable take precedence.
|
||||
constexpr int default_threads = 2;
|
||||
const int requested_threads = Parameters::get<TypeTag, Parameters::ThreadsPerProcess>();
|
||||
const int requested_threads = Parameters::Get<Parameters::ThreadsPerProcess>();
|
||||
int threads = requested_threads > 0 ? requested_threads : default_threads;
|
||||
|
||||
const char* env_var = getenv("OMP_NUM_THREADS");
|
||||
|
@ -717,7 +717,7 @@ private:
|
||||
// Hence we duplicate the code of setupParallelism to get the number of threads.
|
||||
static bool first_time = true;
|
||||
constexpr int default_threads = 2;
|
||||
const int requested_threads = Parameters::get<TypeTag, Parameters::ThreadsPerProcess>();
|
||||
const int requested_threads = Parameters::Get<Parameters::ThreadsPerProcess>();
|
||||
threads = requested_threads > 0 ? requested_threads : default_threads;
|
||||
|
||||
const char* env_var = getenv("OMP_NUM_THREADS");
|
||||
|
@ -127,14 +127,6 @@ template<class TypeTag>
|
||||
struct UseMultisegmentWell<TypeTag, Properties::TTag::TestTypeTag>
|
||||
{ static constexpr bool value = false; };
|
||||
|
||||
// if openMP is available, set the default the number of threads per process for the main
|
||||
// simulation to 2 (instead of grabbing everything that is available).
|
||||
#if _OPENMP
|
||||
template<class TypeTag>
|
||||
struct ThreadsPerProcess<TypeTag, Properties::TTag::TestTypeTag>
|
||||
{ static constexpr int value = 2; };
|
||||
#endif
|
||||
|
||||
// By default, ebos accepts the result of the time integration unconditionally if the
|
||||
// smallest time step size is reached.
|
||||
template<class TypeTag>
|
||||
|
@ -511,6 +511,7 @@ struct AquiferFixture {
|
||||
"test_RestartSerialization",
|
||||
"--ecl-deck-file-name=GLIFT1.DATA"
|
||||
};
|
||||
Opm::ThreadManager<TT>::registerParameters();
|
||||
AdaptiveTimeStepping<TT>::registerParameters();
|
||||
BlackoilModelParameters<TT>::registerParameters();
|
||||
Parameters::registerParam<TT, Parameters::EnableTerminalOutput>("Do *NOT* use!");
|
||||
|
@ -239,6 +239,7 @@ struct EquilFixture {
|
||||
#endif
|
||||
using namespace Opm;
|
||||
FlowGenericVanguard::setCommunication(std::make_unique<Opm::Parallel::Communication>());
|
||||
Opm::ThreadManager<TypeTag>::registerParameters();
|
||||
BlackoilModelParameters<TypeTag>::registerParameters();
|
||||
AdaptiveTimeStepping<TypeTag>::registerParameters();
|
||||
Parameters::registerParam<TypeTag,
|
||||
|
@ -90,6 +90,7 @@ initSimulator(const char *filename)
|
||||
registerEclTimeSteppingParameters<TypeTag>();
|
||||
BlackoilModelParameters<TypeTag>::registerParameters();
|
||||
Parameters::registerParam<TypeTag, Parameters::EnableTerminalOutput>("Do *NOT* use!");
|
||||
Opm::Parameters::SetDefault<Opm::Parameters::ThreadsPerProcess>(2);
|
||||
Parameters::endRegistration();
|
||||
setupParameters_<TypeTag>(/*argc=*/sizeof(argv) / sizeof(argv[0]),
|
||||
argv, /*registerParams=*/false);
|
||||
|
@ -116,6 +116,7 @@ BOOST_FIXTURE_TEST_CASE(WithOutputDir, Fixture)
|
||||
|
||||
Opm::Parameters::reset();
|
||||
|
||||
Opm::ThreadManager<int>::registerParameters();
|
||||
Opm::Main main(3, const_cast<char**>(no_param), false);
|
||||
|
||||
BOOST_CHECK_EQUAL(main.justInitialize(), EXIT_SUCCESS);
|
||||
@ -153,6 +154,7 @@ BOOST_FIXTURE_TEST_CASE(NoOutputDir, Fixture)
|
||||
const char* no_param[] = {"test_outputdir", input_file_path.c_str(), nullptr};
|
||||
|
||||
Opm::Parameters::reset();
|
||||
Opm::ThreadManager<int>::registerParameters();
|
||||
|
||||
Opm::Main main(2, const_cast<char**>(no_param), false);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user