mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
changed: ThreadsPerProcess parameter moved to Opm::Parameters namespace
This commit is contained in:
parent
ddb984c24e
commit
afa62ee428
@ -176,15 +176,6 @@ struct NewtonMaxIterations<TypeTag, TTag::FlowExpTypeTag> {
|
||||
static constexpr int value = 8;
|
||||
};
|
||||
|
||||
// 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, 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>
|
||||
@ -198,6 +189,18 @@ struct LinearSolverBackend<TypeTag, TTag::FlowExpTypeTag> {
|
||||
|
||||
} // namespace Opm::Properties
|
||||
|
||||
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
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm {
|
||||
template <class TypeTag>
|
||||
class FlowExpProblem : public FlowProblem<TypeTag> //, public FvBaseProblem<TypeTag>
|
||||
|
@ -54,12 +54,6 @@ struct Problem<TypeTag, TTag::FlowExpProblemBlackOil>
|
||||
using type = FlowExpProblem<TypeTag>;
|
||||
};
|
||||
|
||||
template<class TypeTag>
|
||||
struct ThreadsPerProcess<TypeTag, TTag::FlowExpProblemBlackOil>
|
||||
{
|
||||
static constexpr int value = 1;
|
||||
};
|
||||
|
||||
template<class TypeTag>
|
||||
struct ContinueOnConvergenceError<TypeTag, TTag::FlowExpProblemBlackOil>
|
||||
{
|
||||
@ -117,6 +111,14 @@ struct Simulator<TypeTag, TTag::FlowExpProblemBlackOil>
|
||||
|
||||
}
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
template<class TypeTag>
|
||||
struct ThreadsPerProcess<TypeTag, Properties::TTag::FlowExpProblemBlackOil>
|
||||
{ static constexpr int value = 1; };
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
using TypeTag = Opm::Properties::TTag::FlowExpProblemBlackOil;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#ifndef OPM_BLACKOILMODELPARAMETERS_HEADER_INCLUDED
|
||||
#define OPM_BLACKOILMODELPARAMETERS_HEADER_INCLUDED
|
||||
|
||||
#include <opm/models/discretization/common/fvbaseparameters.hh>
|
||||
#include <opm/models/discretization/common/fvbaseproperties.hh>
|
||||
|
||||
#include <opm/models/utils/basicproperties.hh>
|
||||
@ -467,15 +468,21 @@ template<class TypeTag>
|
||||
struct LocalDomainsOrderingMeasure<TypeTag, TTag::FlowModelParameters> {
|
||||
static constexpr auto value = "maxpressure";
|
||||
};
|
||||
|
||||
} // namespace Opm::Properties
|
||||
|
||||
namespace Opm::Parameters {
|
||||
|
||||
// if openMP is available, determine the number threads per process automatically.
|
||||
#if _OPENMP
|
||||
template<class TypeTag>
|
||||
struct ThreadsPerProcess<TypeTag, TTag::FlowModelParameters> {
|
||||
struct ThreadsPerProcess<TypeTag, Properties::TTag::FlowModelParameters>
|
||||
{
|
||||
static constexpr int value = -1;
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace Opm::Properties
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
@ -388,7 +388,7 @@ namespace Opm {
|
||||
if (!getenv("OMP_NUM_THREADS"))
|
||||
{
|
||||
int threads = 2;
|
||||
const int requested_threads = Parameters::get<TypeTag, Properties::ThreadsPerProcess>();
|
||||
const int requested_threads = Parameters::get<TypeTag, Parameters::ThreadsPerProcess>();
|
||||
if (requested_threads > 0)
|
||||
threads = requested_threads;
|
||||
|
||||
|
@ -719,7 +719,7 @@ private:
|
||||
else {
|
||||
threads = 2;
|
||||
|
||||
const int input_threads = Parameters::get<TypeTag, Properties::ThreadsPerProcess>();
|
||||
const int input_threads = Parameters::get<TypeTag, Parameters::ThreadsPerProcess>();
|
||||
|
||||
if (input_threads > 0)
|
||||
threads = input_threads;
|
||||
|
@ -126,15 +126,6 @@ struct NewtonMaxIterations<TypeTag, TTag::TestTypeTag> {
|
||||
static constexpr int value = 8;
|
||||
};
|
||||
|
||||
// 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, 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>
|
||||
@ -144,4 +135,16 @@ struct ContinueOnConvergenceError<TypeTag, TTag::TestTypeTag> {
|
||||
|
||||
} // namespace Opm::Properties
|
||||
|
||||
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::TestTypeTag>
|
||||
{ static constexpr int value = 2; };
|
||||
#endif
|
||||
|
||||
} // namespace Opm::Parameters
|
||||
|
||||
#endif // OPM_TEST_TYPETAG_HPP
|
||||
|
Loading…
Reference in New Issue
Block a user