Skip to content
Snippets Groups Projects
Commit b1e31625 authored by Robert K's avatar Robert K
Browse files

Fix threading fallout.

parent 480120ec
No related branches found
No related tags found
1 merge request!4Latest features added to dune-fem-dg.
Pipeline #12268 failed
......@@ -43,7 +43,7 @@ namespace Fem
typedef Fem::SpaceOperatorInterface< typename Traits::DestinationType > BaseType;
static const bool threaded = Traits :: threaded ;
static const bool threading = Traits :: threading ;
//note: ExtraParameterTuple contains non pointer types from now on
template <class Tuple, class StartPassImp, unsigned long int i >
......@@ -110,7 +110,7 @@ namespace Fem
// select non-blocking communication handle
typedef typename
std::conditional< threaded,
std::conditional< threading,
NonBlockingCommHandle< AdvDFunctionType >,
EmptyNonBlockingComm > :: type NonBlockingCommHandleType;
......@@ -126,7 +126,7 @@ namespace Fem
typedef Fem::ThreadIterator< GridPartType > ThreadIteratorType;
typedef LocalCDGPass< DiscreteModelType, InsertFunctionPassType, cdgpass > InnerPassType;
typedef typename std::conditional< threaded,
typedef typename std::conditional< threading,
ThreadPass< InnerPassType, ThreadIteratorType, true >,
InnerPassType > :: type Pass1Type;
......
......@@ -87,7 +87,7 @@ namespace Fem
static const int limiterPolynomialOrder = (polynomialOrder == 0) ? 1 : polynomialOrder;
// enables the possibility to run in threaded mode
static const bool threaded = enableThreaded ;
static const bool threading = enableThreaded ;
static_assert( std::is_same<typename ModelType::RangeType, typename DestinationType::RangeType>::value, "range type does not fit.");
......
......@@ -298,11 +298,11 @@ namespace Fem
typedef typename LimiterTraitsType::DestinationType LimiterDestinationType ;
typedef typename LimiterDestinationType::DiscreteFunctionSpaceType LimiterSpaceType;
static constexpr bool threaded = Traits :: threaded ;
static constexpr bool threading = Traits :: threading ;
// select non-blocking communication handle
typedef typename
std::conditional< threaded,
std::conditional< threading,
NonBlockingCommHandle< DestinationType >,
EmptyNonBlockingComm > :: type NonBlockingCommHandleType;
......@@ -312,13 +312,13 @@ namespace Fem
typedef LimitDGPass< LimiterDiscreteModelType, Pass0Type, limitPassId > InnerPass1Type;
typedef typename std::conditional< threaded,
typedef typename std::conditional< threading,
ThreadPass < InnerPass1Type, ThreadIteratorType, true>,
InnerPass1Type > :: type Pass1Type;
typedef LocalCDGPass< DiscreteModel1Type, Pass1Type, advectPassId > InnerPass2Type;
typedef typename std::conditional< threaded,
typedef typename std::conditional< threading,
ThreadPass < InnerPass2Type, ThreadIteratorType, true>,
InnerPass2Type > :: type Pass2Type;
......@@ -590,11 +590,11 @@ namespace Fem
typedef typename LimiterTraitsType::DestinationType LimiterDestinationType ;
typedef typename LimiterDestinationType::DiscreteFunctionSpaceType LimiterSpaceType;
static constexpr bool threaded = Traits :: threaded ;
static constexpr bool threading = Traits :: threading ;
// select non-blocking communication handle
typedef typename
std::conditional< threaded,
std::conditional< threading,
NonBlockingCommHandle< DestinationType >,
EmptyNonBlockingComm > :: type NonBlockingCommHandleType;
......@@ -604,13 +604,13 @@ namespace Fem
typedef ScalingLimitDGPass< LimiterDiscreteModelType, Pass0Type, limitPassId > InnerPass1Type;
typedef typename std::conditional< threaded,
typedef typename std::conditional< threading,
ThreadPass < InnerPass1Type, ThreadIteratorType, true>,
InnerPass1Type > :: type Pass1Type;
typedef LocalCDGPass < DiscreteModel1Type, Pass1Type, advectPassId > InnerPass2Type;
typedef typename std::conditional< threaded,
typedef typename std::conditional< threading,
ThreadPass < InnerPass2Type, ThreadIteratorType, true>,
InnerPass2Type > :: type Pass2Type;
......
......@@ -80,13 +80,13 @@ namespace Fem
static constexpr bool symmetric = false ;
static constexpr bool matrixfree = true ;
static constexpr bool threaded = Additional::threaded;
static constexpr bool threading = Additional::nThreads > 1 ;
typedef DGAdvectionFlux< ModelType, advFluxId > AdvectionFluxType;
typedef typename DiffusionFluxSelector< ModelType, DiscreteFunctionSpaceType, diffFluxId, formId >::type DiffusionFluxType;
typedef DefaultOperatorTraits< ModelType, DestinationType, AdvectionFluxType, DiffusionFluxType,
std::tuple<>, typename DiscreteFunctionSpaceType::FunctionSpaceType, threaded > OpTraits;
std::tuple<>, typename DiscreteFunctionSpaceType::FunctionSpaceType, threading > OpTraits;
typedef AdvectionDiffusionOperatorSelector< OpTraits, formId, limiterId > OperatorSelectorType ;
......@@ -121,6 +121,8 @@ namespace Fem
rkSolver_( tp_, fullOperator_, explOperator_, implOperator_, name() ),
initialized_( false )
{
Dune::Fem::Parameter::append("fem.parallel.numberofthreads", std::to_string( Additional::nThreads ) );
const double maxTimeStep = param.maxTimeStep();
fixedTimeStep_ = param.fixedTimeStep();
......@@ -153,6 +155,7 @@ namespace Fem
rkSolver_( tp_, fullOperator_, explOperator_, implOperator_, name() ),
initialized_( false )
{
Dune::Fem::Parameter::append("fem.parallel.numberofthreads", std::to_string( Additional::nThreads ) );
std::cout << "cfl = " << double(tp_.factor()) << " " << tp_.time() << std::endl;
}
......
dune_add_subdirs(scalar)
dune_add_subdirs(shallowWater)
#dune_add_subdirs(scalar)
#dune_add_subdirs(shallowWater)
dune_add_subdirs(euler)
......@@ -154,7 +154,7 @@ def generateMethod(struct,expr, cppType, name,
# create DG operator + solver (limiter = none,minmod,vanleer,superbee),
# (diffusionScheme = cdg2,br2,ip,nipg,...)
def createFemDGSolver(Model, space,
limiter="minmod", diffusionScheme = "cdg2"):
limiter="minmod", diffusionScheme = "cdg2", nThreads=1 ):
import dune.create as create
if limiter is None or limiter is False:
......@@ -413,6 +413,9 @@ def createFemDGSolver(Model, space,
struct.append([Declaration(
Variable("const bool", "hasFlux"), initializer=hasAdvFlux or hasDiffFlux,
static=True)])
struct.append([Declaration(
Variable("const int", "nThreads"), initializer=nThreads,
static=True)])
###################################################
## choose details of discretization (i.e. fluxes)
......
......@@ -11,7 +11,7 @@ def run(Model, initial, x0,x1,N, endTime, name, exact,
primitive=None, saveStep=None, subsamp=0,
dt=None):
domain = cartesianDomain(x0,x1,N,periodic=[False,False])
grid = create.grid("yasp",domain)
grid = create.grid("alucube",domain)
grid.hierarchicalGrid.globalRefine(startLevel)
dimR = Model.dimension
t = 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment