changed: start splitting compile time properties from runtime parameters

working towards putting the latter in the Opm::Parameters namespace.
start by moving the ThreadsPerProcess parameter
This commit is contained in:
Arne Morten Kvarving 2024-06-28 12:16:28 +02:00
parent 055734ec23
commit 7e304296a5
4 changed files with 53 additions and 7 deletions

View File

@ -213,8 +213,6 @@ struct ConstraintsContext<TypeTag, TTag::FvBaseDiscretization> { using type = Fv
template<class TypeTag>
struct ThreadManager<TypeTag, TTag::FvBaseDiscretization> { using type = ::Opm::ThreadManager<TypeTag>; };
template<class TypeTag>
struct ThreadsPerProcess<TypeTag, TTag::FvBaseDiscretization> { static constexpr int value = 1; };
template<class TypeTag>
struct UseLinearizationLock<TypeTag, TTag::FvBaseDiscretization> { static constexpr bool value = true; };
/*!
@ -337,6 +335,14 @@ struct DiscreteFunction<TypeTag, TTag::FvBaseDiscretization> {
} // namespace Opm::Properties
namespace Opm::Parameters {
template<class TypeTag>
struct ThreadsPerProcess<TypeTag, Properties::TTag::FvBaseDiscretization>
{ static constexpr int value = 1; };
} // namespace Opm::Parameters
namespace Opm {
/*!

View File

@ -0,0 +1,42 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
/*!
* \file
* \ingroup FiniteVolumeDiscretizations
*
* \brief Declare the properties used by the infrastructure code of
* the finite volume discretizations.
*/
#ifndef EWOMS_FV_BASE_PARAMETERS_HH
#define EWOMS_FV_BASE_PARAMETERS_HH
#include <opm/models/utils/propertysystem.hh>
namespace Opm::Parameters {
template<class TypeTag, class MyTypeTag>
struct ThreadsPerProcess { using type = Properties::UndefinedProperty; };
} // namespace Opm::Parameters
#endif

View File

@ -189,8 +189,6 @@ struct GridCommHandleFactory { using type = UndefinedProperty; };
*/
template<class TypeTag, class MyTypeTag>
struct ThreadManager { using type = UndefinedProperty; };
template<class TypeTag, class MyTypeTag>
struct ThreadsPerProcess { using type = UndefinedProperty; };
//! use locking to prevent race conditions when linearizing the global system of
//! equations in multi-threaded mode. (setting this property to true is always save, but

View File

@ -31,7 +31,7 @@
#include <omp.h>
#endif
#include <opm/models/discretization/common/fvbaseproperties.hh>
#include <opm/models/discretization/common/fvbaseparameters.hh>
#include <opm/models/utils/parametersystem.hh>
#include <opm/models/utils/propertysystem.hh>
@ -60,7 +60,7 @@ public:
*/
static void registerParameters()
{
Parameters::registerParam<TypeTag, Properties::ThreadsPerProcess>
Parameters::registerParam<TypeTag, Parameters::ThreadsPerProcess>
("The maximum number of threads to be instantiated per process "
"('-1' means 'automatic')");
}
@ -78,7 +78,7 @@ public:
{
if (queryCommandLineParameter)
{
numThreads_ = Parameters::get<TypeTag, Properties::ThreadsPerProcess>();
numThreads_ = Parameters::get<TypeTag, Parameters::ThreadsPerProcess>();
// some safety checks. This is pretty ugly macro-magic, but so what?
#if !defined(_OPENMP)