11.08., 9:00 - 11:00: Due to updates GitLab will be unavailable for some minutes between 09:00 and 11:00.

Commit 5226d521 authored by Jean-Matthieu Gallard's avatar Jean-Matthieu Gallard

KernelGen - adapt splitCK Scalar/Vect to new API (boolean + use vectorise_terms for scalar/vect)

parent 316a1fd6
......@@ -115,9 +115,9 @@ optional arguments:
* --useMaterialParamVect enable vectorized material parameters
* --usePointSources numberOfPointSources enable numberOfPointSources point sources
* --useCERKGuess use CERK for SpaceTimePredictor inital guess (nonlinear only)
* --useSplitCKScalar use split Cauchy–Kowalevski formulation (linear only)
* --useSplitCKVect use split Cauchy–Kowalevski formulation with vect PDE (linear only)
* --useSplitCK use split Cauchy–Kowalevski formulation (linear only)
* --useGaussLobatto use Gauss Lobatto Quadrature instead of Gauss Legendre
* --useVectPDE use vectorized PDE terms (applies when present to: Flux, NCP, Source, FusedSource and MaterialParam)
* --tempVarsOnStack put the big scratch arrays on the stack instead of the
heap (you can use ulimit -s to increase the stack size)
......@@ -194,7 +194,7 @@ generated converter
Using the C index order convention with index in italic being absent in dim 2
Advanced options like ``--useSplitCKVect`` may use other data layout, see the
Advanced options like ``--useSplitCK`` or ``--useVectPDE`` may use other data layout, see the
respective templates
......
......@@ -74,8 +74,7 @@ class ArgumentParser:
("useMaterialParamVect",ArgType.OptionalBool, "enable vectorized material parameters"), #TODO JMG: legacy, use usePDEVect instead
("usePointSources", ArgType.OptionalInt , "enable numberOfPointSources point sources", -1, "numberOfPointSources"),
("useCERKGuess", ArgType.OptionalBool, "use CERK for SpaceTimePredictor inital guess (nonlinear only)"),
("useSplitCKScalar", ArgType.OptionalBool, "use split Cauchy–Kowalevski formulation (linear only)"), #TODO JMG: legacy, merge with vect and use usePDEVect
("useSplitCKVect", ArgType.OptionalBool, "use split Cauchy–Kowalevski formulation with vect PDE (linear only)"), #TODO JMG: legacy, merge with scalar and use usePDEVect
("useSplitCK", ArgType.OptionalBool, "use split Cauchy–Kowalevski formulation (linear only)"),
("useGaussLobatto", ArgType.OptionalBool, "use Gauss Lobatto Quadrature instead of Gauss Legendre"),
("predictorRecompute", ArgType.OptionalBool, "predictor step will recompute the PDE instead of relying on stored values from the picard loop (nonlinear only)"),
("useVectPDE", ArgType.OptionalBool, "use vectorized PDE terms (applies when present to: Flux, NCP, Source, FusedSource and MaterialParam)"),
......
......@@ -98,8 +98,7 @@ class Controller:
"useMaterialParamVect" : args["useMaterialParamVect"],
"quadratureType" : ("Gauss-Lobatto" if args["useGaussLobatto"] else "Gauss-Legendre"),
"useCERKGuess" : args["useCERKGuess"],
"useSplitCKScalar" : args["useSplitCKScalar"],
"useSplitCKVect" : args["useSplitCKVect"],
"useSplitCK" : args["useSplitCK"],
"useVectPDE" : args["useVectPDE"],
"predictorRecompute" : args["predictorRecompute"]
})
......
......@@ -63,24 +63,25 @@ class ConfigurationParametersModel(AbstractModelBaseClass):
self.context["PSiSize"] = -1
self.context["PSiDerivativeSize"] = -1
if self.context["isLinear"]:
if(self.context["useSplitCKScalar"]):
# Linear + split CK
self.context["lQiSize"] = nVarPad*(nDof**nDim)
self.context["lQiNextSize"] = nVarPad*(nDof**nDim)
self.context["lPiSize"] = nParPad*(nDof**nDim)
self.context["lQhiSize"] = nVarPad*(nDof**nDim)
self.context["lFhiSize"] = nVarPad*(nDof**nDim)
self.context["gradQSize"] = nVarPad*(nDof**nDim)
self.context["PSiSize"] = nDof*(nDof**nDim)*nVarPad
elif(self.context["useSplitCKVect"]):
# Linear + split CK
self.context["lQiSize"] = nDof3D*nDof*nVar*nDofPad
self.context["lQiNextSize"] = nDof3D*nDof*nVar*nDofPad
self.context["lPiSize"] = nDof3D*nDof*nPar*nDofPad
self.context["lQhiSize"] = nDof3D*nDof*nVar*nDofPad
self.context["lFhiSize"] = nDof3D*nDof*nVar*nDofPad
self.context["gradQSize"] = nDof3D*nDof*nVar*nDofPad
self.context["PSiSize"] = nDof*nDof3D*nDof*nVar*nDofPad
if(self.context["useSplitCK"]):
if self.context["useVectPDE"]:
# Linear + split CK vect
self.context["lQiSize"] = nDof3D*nDof*nVar*nDofPad
self.context["lQiNextSize"] = nDof3D*nDof*nVar*nDofPad
self.context["lPiSize"] = nDof3D*nDof*nPar*nDofPad
self.context["lQhiSize"] = nDof3D*nDof*nVar*nDofPad
self.context["lFhiSize"] = nDof3D*nDof*nVar*nDofPad
self.context["gradQSize"] = nDof3D*nDof*nVar*nDofPad
self.context["PSiSize"] = nDof*nDof3D*nDof*nVar*nDofPad
else:
# Linear + split CK scalar
self.context["lQiSize"] = nVarPad*(nDof**nDim)
self.context["lQiNextSize"] = nVarPad*(nDof**nDim)
self.context["lPiSize"] = nParPad*(nDof**nDim)
self.context["lQhiSize"] = nVarPad*(nDof**nDim)
self.context["lFhiSize"] = nVarPad*(nDof**nDim)
self.context["gradQSize"] = nVarPad*(nDof**nDim)
self.context["PSiSize"] = nDof*(nDof**nDim)*nVarPad
else:
# default linear
self.context["lQiSize"] = nDataPad*(nDof**nDim)*(1+nDof)
......
......@@ -38,26 +38,21 @@ class FusedSpaceTimePredictorVolumeIntegralModel(AbstractModelBaseClass):
if self.context["isLinear"]:
if self.context["useSplitCKScalar"]:
self.render(("aderdg", "fusedSPTVI_linear_split_ck_cpp.template"), "fusedSpaceTimePredictorVolumeIntegral.cpp")
if self.context["usePointSources"]:
localContext = copy.copy(self.context)
localContext["usePointSources"] = False
localContext["nameSuffix"] = "_WithoutPS"
self.render(("aderdg", "fusedSPTVI_linear_split_ck_cpp.template"), "fusedSpaceTimePredictorVolumeIntegral_WithoutPS.cpp", localContext)
elif self.context["useSplitCKVect"]:
if self.context["useSplitCK"]:
if self.context["useVectPDE"]:
template = "fusedSPTVI_linear_split_ck_vect_cpp.template"
else:
template = "fusedSPTVI_linear_split_ck_cpp.template"
self.render(("aderdg", "fusedSPTVI_linear_split_ck_vect_cpp.template"), "fusedSpaceTimePredictorVolumeIntegral.cpp")
self.render(("aderdg", template), "fusedSpaceTimePredictorVolumeIntegral.cpp")
if self.context["usePointSources"]:
localContext = copy.copy(self.context)
localContext["usePointSources"] = False
localContext["nameSuffix"] = "_WithoutPS"
self.render(("aderdg", "fusedSPTVI_linear_split_ck_vect_cpp.template"), "fusedSpaceTimePredictorVolumeIntegral_WithoutPS.cpp", localContext)
self.render(("aderdg", template), "fusedSpaceTimePredictorVolumeIntegral_WithoutPS.cpp", localContext)
else:
# size of the tmpArray
self.context["tmpArraySize"] = max((self.context["nDof"]*self.context["nVarPad"] if self.context["useFlux"] else 0), \
......@@ -105,31 +100,32 @@ class FusedSpaceTimePredictorVolumeIntegralModel(AbstractModelBaseClass):
nDim = self.context["nDim"]
if self.context["isLinear"]:
if self.context["useSplitCKScalar"]:
if self.context["useFlux"]:
self.context["matmulConfigs"]["flux_x_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad , nDofPad, nVarPad , 1, 1, 1, 1, "flux_x_sck", "nopf", "gemm")
self.context["matmulConfigs"]["flux_y_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad , nDofPad, nVarPad*nDof , 1, 1, 1, 1, "flux_y_sck", "nopf", "gemm")
if self.context["useSplitCK"]:
if self.context["useVectPDE"]: # split_ck vect
if self.context["useFlux"]:
if self.context["useMaterialParam"]:
self.context["matmulConfigs"]["flux_x_sck_vect"] = MatmulConfig(nDofPad, nVar, nDof, nDofPad , nDofPad, nDofPad , 1, 0, 1, 1, "flux_x_sck_vect", "nopf", "gemm")
self.context["matmulConfigs"]["flux_y_or_z_sck_vect"] = MatmulConfig(nDofPad*nVar, nVar, nDof, nDofPad*nVar , nDofPad, nDofPad*nVar , 1, 0, 1, 1, "flux_y_or_z_sck_vect", "nopf", "gemm")
else:
self.context["matmulConfigs"]["flux_x_sck_vect"] = MatmulConfig(nDofPad, nVar, nDof, nDofPad , nDofPad, nDofPad , 1, 1, 1, 1, "flux_x_sck_vect", "nopf", "gemm")
self.context["matmulConfigs"]["flux_y_sck_vect"] = MatmulConfig(nDofPad*nVar, nDof, nDof, nDofPad*nVar , nDofPad, nDofPad*nVar , 1, 1, 1, 1, "flux_y_sck_vect", "nopf", "gemm")
if self.context["nDim"]>=3:
self.context["matmulConfigs"]["flux_z_sck_vect"] = MatmulConfig(nDofPad*nVar, nDof, nDof, nDofPad*nVar , nDofPad, nDofPad*nVar*nDof, 1, 1, 1, 1, "flux_z_sck_vect", "nopf", "gemm")
self.context["matmulConfigs"]["gradQ_x_sck_vect"] = MatmulConfig(nDofPad, nVar*nDof*nDof3D, nDof, nDofPad , nDofPad, nDofPad , 1, 0, 1, 1, "gradQ_x_sck_vect", "nopf", "gemm") # beta, 0 => overwrite C
self.context["matmulConfigs"]["gradQ_y_sck_vect"] = MatmulConfig(nDofPad*nVar, nDof, nDof, nDofPad*nVar , nDofPad, nDofPad*nVar , 1, 0, 1, 1, "gradQ_y_sck_vect", "nopf", "gemm") # beta, 0 => overwrite C
if self.context["nDim"]>=3:
self.context["matmulConfigs"]["flux_z_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad , nDofPad, nVarPad*nDof2, 1, 1, 1, 1, "flux_z_sck", "nopf", "gemm")
self.context["matmulConfigs"]["gradQ_x_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad , nDofPad, nVarPad , 1, 0, 1, 1, "gradQ_x_sck", "nopf", "gemm") # beta, 0 => overwrite C
self.context["matmulConfigs"]["gradQ_y_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad*nDof , nDofPad, nVarPad*nDof , 1, 0, 1, 1, "gradQ_y_sck", "nopf", "gemm") # beta, 0 => overwrite C
if self.context["nDim"]>=3:
self.context["matmulConfigs"]["gradQ_z_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad*nDof2, nDofPad, nVarPad*nDof2, 1, 0, 1, 1, "gradQ_z_sck", "nopf", "gemm") # beta, 0 => overwrite C
elif self.context["useSplitCKVect"]:
if self.context["useFlux"]:
if self.context["useMaterialParam"]:
self.context["matmulConfigs"]["flux_x_sck_vect"] = MatmulConfig(nDofPad, nVar, nDof, nDofPad , nDofPad, nDofPad , 1, 0, 1, 1, "flux_x_sck_vect", "nopf", "gemm")
self.context["matmulConfigs"]["flux_y_or_z_sck_vect"] = MatmulConfig(nDofPad*nVar, nVar, nDof, nDofPad*nVar , nDofPad, nDofPad*nVar , 1, 0, 1, 1, "flux_y_or_z_sck_vect", "nopf", "gemm")
else:
self.context["matmulConfigs"]["flux_x_sck_vect"] = MatmulConfig(nDofPad, nVar, nDof, nDofPad , nDofPad, nDofPad , 1, 1, 1, 1, "flux_x_sck_vect", "nopf", "gemm")
self.context["matmulConfigs"]["flux_y_sck_vect"] = MatmulConfig(nDofPad*nVar, nDof, nDof, nDofPad*nVar , nDofPad, nDofPad*nVar , 1, 1, 1, 1, "flux_y_sck_vect", "nopf", "gemm")
self.context["matmulConfigs"]["gradQ_z_sck_vect"] = MatmulConfig(nDofPad*nVar*nDof, nDof, nDof, nDofPad*nVar*nDof, nDofPad, nDofPad*nVar*nDof, 1, 0, 1, 1, "gradQ_z_sck_vect", "nopf", "gemm") # beta, 0 => overwrite C
else: # split_ck scalar
if self.context["useFlux"]:
self.context["matmulConfigs"]["flux_x_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad , nDofPad, nVarPad , 1, 1, 1, 1, "flux_x_sck", "nopf", "gemm")
self.context["matmulConfigs"]["flux_y_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad , nDofPad, nVarPad*nDof , 1, 1, 1, 1, "flux_y_sck", "nopf", "gemm")
if self.context["nDim"]>=3:
self.context["matmulConfigs"]["flux_z_sck_vect"] = MatmulConfig(nDofPad*nVar, nDof, nDof, nDofPad*nVar , nDofPad, nDofPad*nVar*nDof, 1, 1, 1, 1, "flux_z_sck_vect", "nopf", "gemm")
self.context["matmulConfigs"]["gradQ_x_sck_vect"] = MatmulConfig(nDofPad, nVar*nDof*nDof3D, nDof, nDofPad , nDofPad, nDofPad , 1, 0, 1, 1, "gradQ_x_sck_vect", "nopf", "gemm") # beta, 0 => overwrite C
self.context["matmulConfigs"]["gradQ_y_sck_vect"] = MatmulConfig(nDofPad*nVar, nDof, nDof, nDofPad*nVar , nDofPad, nDofPad*nVar , 1, 0, 1, 1, "gradQ_y_sck_vect", "nopf", "gemm") # beta, 0 => overwrite C
if self.context["nDim"]>=3:
self.context["matmulConfigs"]["gradQ_z_sck_vect"] = MatmulConfig(nDofPad*nVar*nDof, nDof, nDof, nDofPad*nVar*nDof, nDofPad, nDofPad*nVar*nDof, 1, 0, 1, 1, "gradQ_z_sck_vect", "nopf", "gemm") # beta, 0 => overwrite C
else:
self.context["matmulConfigs"]["flux_z_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad , nDofPad, nVarPad*nDof2, 1, 1, 1, 1, "flux_z_sck", "nopf", "gemm")
self.context["matmulConfigs"]["gradQ_x_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad , nDofPad, nVarPad , 1, 0, 1, 1, "gradQ_x_sck", "nopf", "gemm") # beta, 0 => overwrite C
self.context["matmulConfigs"]["gradQ_y_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad*nDof , nDofPad, nVarPad*nDof , 1, 0, 1, 1, "gradQ_y_sck", "nopf", "gemm") # beta, 0 => overwrite C
if self.context["nDim"]>=3:
self.context["matmulConfigs"]["gradQ_z_sck"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad*nDof2, nDofPad, nVarPad*nDof2, 1, 0, 1, 1, "gradQ_z_sck", "nopf", "gemm") # beta, 0 => overwrite C
else: # default linear
if self.context["useFlux"]:
self.context["matmulConfigs"]["flux_x"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad , nDofPad, nVarPad, 1, 0, 1, 1, "flux_x", "nopf", "gemm") # beta, 0 => overwrite C
self.context["matmulConfigs"]["flux_y"] = MatmulConfig(nVarPad, nDof, nDof, nVarPad*nDof , nDofPad, nVarPad, 1, 0, 1, 1, "flux_y", "nopf", "gemm") # beta, 0 => overwrite C
......
......@@ -36,7 +36,7 @@ namespace {{namespaceName}} {
double* restrict lduh,
double* restrict lQhbnd,
double* restrict lFhbnd,
{% if useSplitCKScalar or useSplitCKVect %}
{% if useSplitCK %}
double* restrict lQi,
double* restrict lQiNext,
double* restrict lPi, // for NCP or Source
......@@ -68,7 +68,7 @@ namespace {{namespaceName}} {
double* restrict lduh,
double* restrict lQhbnd,
double* restrict lFhbnd,
{% if useSplitCKScalar or useSplitCKVect %}
{% if useSplitCK %}
double* restrict lQi,
double* restrict lQiNext,
double* restrict lPi, // for NCP or Source
......
......@@ -683,11 +683,10 @@
"title" : "Use the continous extrapolated Runge Kutta initial guess for the space time predictor"
},
"split_ck" : {
"type" : "string",
"type" : "boolean",
"available-for" : ["optimised"],
"title" : "Use a split Cauchy–Kowalevski for the space time predictor (linear only)",
"enum" : ["disabled","scalar","vectorised"],
"default" : "disabled"
"default" : false
},
"predictor_recompute" : {
"type" : "boolean",
......
......@@ -319,7 +319,7 @@ class SpecFile1Reader():
if token_s==term:
context[opt_dbg].append(term)
found_token=True
for term in ["cerkguess","notimeavg","maxpicarditer","split_ck"]:
for term in ["cerkguess","notimeavg","maxpicarditer"]:
if token_s.startswith(term):
mappedTerm = term.replace("maxpicarditer","fix_picard_iterations")
context[stp][mappedTerm]=True
......
......@@ -61,8 +61,7 @@ class KernelgeneratorModel:
"useMaterialParam" : solverContext["useMaterialParameters"],
"useMaterialParamVect" : solverContext["useMaterialParametersVect"], #TODO JMG: legacy
"useCERKGuess" : solverContext["useCERK"],
"useSplitCKScalar" : solverContext["useSplitCKScalar"], #TODO JMG: legacy, merge with vect and use usePDEVect
"useSplitCKVect" : solverContext["useSplitCKVect"], #TODO JMG: legacy, merge with scalar and use usePDEVect
"useSplitCK" : solverContext["useSplitCK"],
"useGaussLobatto" : solverContext["basis"] == "lobatto",
"predictorRecompute" : solverContext["predictorRecompute"],
"useVectPDE" : solverContext["useVectPDE"],
......
......@@ -218,8 +218,7 @@ class SolverController:
context["linearOrNonlinear"] = "Linear" if context["isLinear"] else "Nonlinear"
context["isFortran"] = kernel.get("language",False)=="Fortran"
context["useCERK"] = kernel.get("space_time_predictor",{}).get("cerkguess",False)
context["useSplitCKScalar"] = kernel.get("space_time_predictor",{}).get("split_ck","disabled") == "scalar"
context["useSplitCKVect"] = kernel.get("space_time_predictor",{}).get("split_ck","disabled") == "vectorised"
context["useSplitCK"] = kernel.get("space_time_predictor",{}).get("split_ck",False)
context["noTimeAveraging"] = kernel.get("space_time_predictor",{}).get("notimeavg",False)
context["noTimeAveraging_s"] = "true" if kernel.get("space_time_predictor",{}).get("notimeavg",False) else "false"
context["predictorRecompute"] = kernel.get("space_time_predictor",{}).get("predictor_recompute",False)
......
......@@ -168,7 +168,7 @@ int {{project}}::{{abstractSolver}}::fusedSpaceTimePredictorVolumeIntegral(doubl
{% endif %}
{% if isLinear %}
{% if useSplitCKScalar or useSplitCKVect %}
{% if useSplitCK %}
{% set SPTbufferSignature="lQi, lQi_next, lPi, lQhi, lFhi, gradQ, PSi" %}
double* lQi = memory + {{optNamespace}}::getlQiShift();
double* lQi_next= memory + {{optNamespace}}::getlQiNextShift();
......@@ -202,7 +202,7 @@ int {{project}}::{{abstractSolver}}::fusedSpaceTimePredictorVolumeIntegral(doubl
constexpr double* PSi = nullptr;
constexpr double* PSderivatives = nullptr;
{% endif %}
{% endif %}{# useSplitCKScalar or useSplitCKVect #}
{% endif %}{# useSplitCK #}
{% else %}{#
nonlinear case
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment