Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 (https://www.gitkraken.com/blog/weak-ssh-key-fix). If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

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

Commit 197ff2eb authored by Jean-Matthieu Gallard's avatar Jean-Matthieu Gallard
Browse files

KernelGen - simplified abstractmodel

parent dfdb9cd3
......@@ -48,6 +48,9 @@ class Configuration:
# path to markupsafe
pathToMarkupsafe = os.path.abspath(os.path.join(pathToExaHyPERoot, "Submodules", "markupsafe", "src"))
# internal path to templates
pathToTemplate = os.path.abspath(os.path.join(os.path.dirname(__file__), "templates"))
# simd size of the accepted architectures
simdWidth = { "noarch" : 1,
"wsm" : 2,
......
......@@ -267,7 +267,7 @@ class Controller:
model.generateCode()
if self.config["runtimeDebug"]:
t = time.perf_counter() - start
print(name+": "+str(value))
print(name+": "+str(t))
def generateGemms(self, outputFileName, matmulConfigList):
"""Generate the gemms with the given config list using LIBXSMM"""
......
......@@ -71,18 +71,15 @@ class AbstractModelBaseClass():
sys.exit("Abstract method") # needs to be overriden
# render a template to outputFilename using the given context (default = local context)
# render a template to outputFilename using the local context
# templateName can either be a string if the template is at the root of the template folder
# or a tuple/list with the path from here (e.g. ["a", "b.tmp"] for a/b.tmp)
def render(self, templateName, outputFilename, context=None):
# set default context to local context if none given
if context == None:
context = self.context
loader = jinja2.FileSystemLoader(os.path.realpath(os.path.join(os.path.dirname(__file__),"..","templates")))
def render(self, templateName, outputFilename):
loader = jinja2.FileSystemLoader(Configuration.pathToTemplate)
env = jinja2.Environment(loader=loader, trim_blocks=True, lstrip_blocks=True)
if isinstance(templateName, str):
template = env.get_template(templateName)
else:
template = env.get_template(os.path.join(*templateName))
with open(os.path.join(context["pathToOutputDirectory"],outputFilename), "w") as output:
output.write(template.render(context))
with open(os.path.join(self.context["pathToOutputDirectory"],outputFilename), "w") as output:
output.write(template.render(self.context))
......@@ -50,11 +50,10 @@ class FusedSpaceTimePredictorVolumeIntegralModel(AbstractModelBaseClass):
self.render(("aderdg", template), "fusedSpaceTimePredictorVolumeIntegral.cpp")
if self.context["usePointSources"]:
localContext = copy.copy(self.context)
localContext["usePointSources"] = False
localContext["nameSuffix"] = "_WithoutPS"
self.context["usePointSources"] = False
self.context["nameSuffix"] = "_WithoutPS"
self.render(("aderdg", template), "fusedSpaceTimePredictorVolumeIntegral_WithoutPS.cpp", localContext)
self.render(("aderdg", template), "fusedSpaceTimePredictorVolumeIntegral_WithoutPS.cpp")
else:
# size of the tmpArray
......@@ -64,11 +63,10 @@ class FusedSpaceTimePredictorVolumeIntegralModel(AbstractModelBaseClass):
self.render(("aderdg", "fusedSPTVI_linear_cpp.template"), "fusedSpaceTimePredictorVolumeIntegral.cpp")
if self.context["usePointSources"]:
localContext = copy.copy(self.context)
localContext["usePointSources"] = False
localContext["nameSuffix"] = "_WithoutPS"
self.context["usePointSources"] = False
self.context["nameSuffix"] = "_WithoutPS"
self.render(("aderdg", "fusedSPTVI_linear_cpp.template"), "fusedSpaceTimePredictorVolumeIntegral_WithoutPS.cpp", localContext)
self.render(("aderdg", "fusedSPTVI_linear_cpp.template"), "fusedSpaceTimePredictorVolumeIntegral_WithoutPS.cpp")
else: #nonlinear
self.context["nDof_seq"] = range(0,self.context["nDof"])
......
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