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

Commit e2733dd2 authored by Jean-Matthieu Gallard's avatar Jean-Matthieu Gallard

KernelGen - add nonlinear option predictor_recompute (/!\ PDE user function...

KernelGen - add nonlinear option predictor_recompute (/!\ PDE user function signatures changed to remove param and make gradQ like F)
parent 71bbd773
......@@ -77,6 +77,7 @@ class ArgumentParser:
("useSplitCKScalar", ArgType.OptionalBool, "use split Cauchy–Kowalevski formulation (linear only)"),
("useSplitCKVect", ArgType.OptionalBool, "use split Cauchy–Kowalevski formulation with vect PDE (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)"),
("tempVarsOnStack", ArgType.OptionalBool, "put the big scratch arrays on the stack instead of the heap (you can use ulimit -s to increase the stack size)")
]
......
......@@ -99,7 +99,8 @@ class Controller:
"quadratureType" : ("Gauss-Lobatto" if args["useGaussLobatto"] else "Gauss-Legendre"),
"useCERKGuess" : args["useCERKGuess"],
"useSplitCKScalar" : args["useSplitCKScalar"],
"useSplitCKVect" : args["useSplitCKVect"]
"useSplitCKVect" : args["useSplitCKVect"],
"predictorRecompute" : args["predictorRecompute"]
})
self.config["useSourceOrNCP"] = self.config["useSource"] or self.config["useNCP"]
elif self.config["kernelType"] == "limiter":
......
......@@ -96,17 +96,29 @@ class ConfigurationParametersModel(AbstractModelBaseClass):
self.context["PSiSize"] = (nDof+1)*(nDof**nDim)*nVarPad
self.context["PSiDerivativeSize"] = self.context["PSiSize"]
else:
# nonlinear
self.context["lQiSize"] = nDataPad*(nDof**(nDim+1))
self.context["lQhiSize"] = nDataPad*(nDof**nDim)
if self.context["useFlux"]:
self.context["lFiSize"] = nVarPad*(nDof**(nDim+1))*nDim
self.context["lFhiSize"] = nVarPad*(nDof**nDim)*nDim
if self.context["useSource"] or self.context["useNCP"]:
self.context["lSiSize"] = nVarPad*(nDof**(nDim+1))
self.context["lShiSize"] = nVarPad*(nDof**nDim)
if self.context["useNCP"]:
self.context["gradQSize"] = nVarPad*(nDof**nDim)*nDim
# nonlinear
if self.context["predictorRecompute"]:
self.context["lQiSize"] = nVarPad*(nDof**(nDim+1))
self.context["lQhiSize"] = nVarPad*(nDof**nDim)
if nPar > 0:
self.context["lPiSize"] = nParPad*(nDof**nDim)
if self.context["useFlux"]:
self.context["lFhiSize"] = nVarPad*(nDof**nDim)*nDim
if self.context["useSource"] or self.context["useNCP"]:
self.context["lShiSize"] = nVarPad*(nDof**nDim)
if self.context["useNCP"] or self.context["useViscousFlux"]:
self.context["gradQSize"] = nVarPad*(nDof**nDim)*nDim
else:
self.context["lQiSize"] = nDataPad*(nDof**(nDim+1))
self.context["lQhiSize"] = nDataPad*(nDof**nDim)
if self.context["useFlux"]:
self.context["lFiSize"] = nVarPad*(nDof**(nDim+1))*nDim
self.context["lFhiSize"] = nVarPad*(nDof**nDim)*nDim
if self.context["useSource"] or self.context["useNCP"]:
self.context["lSiSize"] = nVarPad*(nDof**(nDim+1))
self.context["lShiSize"] = nVarPad*(nDof**nDim)
if self.context["useNCP"] or self.context["useViscousFlux"]:
self.context["gradQSize"] = nVarPad*(nDof**nDim)*nDim
# Face buffer size (Riemann)
self.context["BndFaceSize"] = nDataPad*(nDof*nDof3D)
......
......@@ -104,13 +104,19 @@ namespace {{namespaceName}} {
double* restrict lFhbnd,
double* restrict lQi,
double* restrict rhs,
{% if predictorRecompute %}
double* restrict lPi,
{% else %}
double* restrict lFi,
double* restrict lSi, // for NCP or Source
{% endif %}
double* restrict lQhi,
double* restrict lFhi,
double* restrict lShi, // for NCP or Source
double* restrict gradQ, // for NCP or Source or viscousFlux
{% if not predictorRecompute %}
double* restrict gradQVg, // for viscousFlux
{% endif %}
const double* const restrict luh,
const double inverseDx, //Assume dx[0] == dx[1] == dx[2]
const double dt
......
......@@ -79,7 +79,7 @@ namespace {{namespaceName}} {
constexpr int getgradQShift() {return {{shift}};}
{% set shift = shift+gradQSize %}
{% endif %}
{% if gradQSize > 0 and useViscousFlux %}
{% if useViscousFlux and not predictorRecompute %}
constexpr int getgradQAvgShift() {return {{shift}};}
{% set shift = shift+gradQSize %}
{% endif %}
......
......@@ -29,7 +29,7 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral(
{{solverName}}& solver,
double* restrict lduh,
double* restrict lQhbnd,
double* restrict lGradQhbnd,
double* restrict lGradQhbnd,
double* restrict lFhbnd,
double* restrict lQi,
double* restrict rhs,
......
......@@ -688,6 +688,12 @@
"title" : "Use a split Cauchy–Kowalevski for the space time predictor (linear only)",
"enum" : ["disabled","scalar","vectorised"],
"default" : "disabled"
},
"predictor_recompute" : {
"type" : "boolean",
"available-for" : ["optimised"],
"title" : "Recompute on-the-fly the PDE outputs (e.g. flux, source, ncp) during the predictor step to avoid storing them all during the picard iteration and saving memory requirement at the cost of more flops (nonlinear only).",
"default" : false
}
}
},
......
......@@ -64,6 +64,7 @@ class KernelgeneratorModel:
"useSplitCKScalar" : solverContext["useSplitCKScalar"],
"useSplitCKVect" : solverContext["useSplitCKVect"],
"useGaussLobatto" : solverContext["basis"] == "lobatto",
"predictorRecompute" : solverContext["predictorRecompute"],
# Optional int parameters (may set redundant flags)
"usePointSources" : solverContext["numberOfPointSources"] if solverContext["numberOfPointSources"] > 0 else -1,
"tempVarsOnStack" : solverContext["tempVarsOnStack"]
......
......@@ -222,6 +222,7 @@ class SolverController:
context["useSplitCKVect"] = kernel.get("space_time_predictor",{}).get("split_ck","disabled") == "vectorised"
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)
context.update(self.buildKernelTermsContext(kernel["terms"]))
return context
......
......@@ -203,19 +203,34 @@ int {{project}}::{{abstractSolver}}::fusedSpaceTimePredictorVolumeIntegral(doubl
constexpr double* PSderivatives = nullptr;
{% endif %}
{% endif %}{# useSplitCKScalar or useSplitCKVect #}
{% else %}{# nonlinear case #}
{% else %}{#
nonlinear case
#}
double* lQi = memory + {{optNamespace}}::getlQiShift();
double* lQhi = memory + {{optNamespace}}::getlQhiShift();
{% if predictorRecompute %}
{% if numberOfMaterialParameters > 0 %}
double* lPi = memory + {{optNamespace}}::getlPiShift();
{% else %}
constexpr double* lPi = nullptr;
{% endif %}
{% endif %}
double* rhs = memory + {{optNamespace}}::getrhsShift(); //same size as lQi
{% if useFlux %}
{% if not predictorRecompute %}
double* lFi = memory + {{optNamespace}}::getlFiShift();
{% endif %}
double* lFhi = memory + {{optNamespace}}::getlFhiShift();
{% else %}
constexpr double* lFi = nullptr;
constexpr double* lFhi = nullptr;
{% endif %}
{% if useNCP or useSource %}
{% if not predictorRecompute %}
double* lSi = memory + {{optNamespace}}::getlSiShift();
{% endif %}
double* lShi = memory + {{optNamespace}}::getlShiShift();
{% else %}
constexpr double* lSi = nullptr;
......@@ -226,10 +241,10 @@ int {{project}}::{{abstractSolver}}::fusedSpaceTimePredictorVolumeIntegral(doubl
{% else %}
constexpr double* gradQ = nullptr;
{% endif %}
{% if useViscousFlux %}
{% if useViscousFlux and not predictorRecompute %}
double* gradQAvg = memory + {{optNamespace}}::getgradQAvgShift();
{% else %}
double* gradQAvg = nullptr;
constexpr double* gradQAvg = nullptr;
{% endif %}
{% endif %}{# if case useNCP or useViscousFlux #}
......@@ -261,8 +276,12 @@ int {{project}}::{{abstractSolver}}::fusedSpaceTimePredictorVolumeIntegral(doubl
{% endif %}
{% else %}{# case non linear #}
{% if predictorRecompute %}
const int picardIt = {{optNamespace}}::fusedSpaceTimePredictorVolumeIntegral(*static_cast<{{solver}}*>(this), update, lQhbnd, lGradQhbnd, lFhbnd, lQi, rhs, lPi, lQhi, lFhi, lShi, gradQ, luh, 1./cellSize[0] /*inverseDx*/, dt);
{% else %}
const int picardIt = {{optNamespace}}::fusedSpaceTimePredictorVolumeIntegral(*static_cast<{{solver}}*>(this), update, lQhbnd, lGradQhbnd, lFhbnd, lQi, rhs, lFi, lSi, lQhi, lFhi, lShi, gradQ, gradQAvg, luh, 1./cellSize[0] /*inverseDx*/, dt);
{% endif %}
{% endif %}
// this switch should probably moved into the fusedSpaceTimePredictorVolumeIntegral kernel
if ( !addVolumeIntegralResultToUpdate ) {
......
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