In January 2021 we will introduce a 10 GB quota for project repositories. Higher limits for individual projects will be available on request. Please see https://doku.lrz.de/display/PUBLIC/GitLab for more information.

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

KernelGen - add matmul precision option

parent 74557523
......@@ -97,7 +97,9 @@ class Controller:
"useCERKGuess" : args["useCERKGuess"],
"useSplitCK" : args["useSplitCK"],
"useVectPDE" : args["useVectPDE"],
"predictorRecompute" : args["predictorRecompute"]
"predictorRecompute" : args["predictorRecompute"],
"initialGuess" : "mixedPicard" #TODO JMG put as proper toolkit arg
#"initialGuess" : "default" #TODO JMG put as proper toolkit arg
})
self.config["useSourceOrNCP"] = self.config["useSource"] or self.config["useNCP"]
elif self.config["kernelType"] == "limiter":
......@@ -265,7 +267,7 @@ class Controller:
"""Generate the gemms with the given config list using LIBXSMM"""
for matmul in matmulConfigList:
# add the gemm name to the list of generated gemm
self.gemmList.append(matmul.baseroutinename)
self.gemmList.append((matmul.baseroutinename, matmul.precision))
# for plain assembly code (rather than inline assembly) choose dense_asm
commandLineArguments = " " + "dense" + \
" " + os.path.join(self.config["pathToOutputDirectory"], outputFileName) + \
......@@ -282,6 +284,6 @@ class Controller:
" " + str(matmul.alignment_C) + \
" " + self.config["architecture"] + \
" " + matmul.prefetchStrategy + \
" " + "DP" #always use double precision, "SP" for single
" " + matmul.precision
bashCommand = self.config["pathToLibxsmmGemmGenerator"] + commandLineArguments
subprocess.call(bashCommand.split())
......@@ -20,8 +20,12 @@
namespace {{namespaceName}} {
{% endfor %}
{% for gemm in gemmList %}
void {{gemm}}(const double* A, const double* B, double* C);
{% for gemm,precision in gemmList %}
{% if precision == "DP" %}
void {{gemm}}(const double* A, const double* B, double* C);
{% else %}
void {{gemm}}(const float* A, const float* B, float* C);
{% endif %}
{% endfor %}
{% for namespaceName in codeNamespaceList %}
......
......@@ -20,8 +20,12 @@
namespace {{namespaceName}} {
{% endfor %}
{% for gemm in gemmList %}
void {{gemm}}(const double* A, const double* B, double* C);
{% for gemm,precision in gemmList %}
{% if precision == "DP" %}
void {{gemm}}(const double* A, const double* B, double* C);
{% else %}
void {{gemm}}(const float* A, const float* B, float* C);
{% endif %}
{% endfor %}
{% for namespaceName in codeNamespaceList %}
......
......@@ -69,8 +69,14 @@ class MatmulConfig:
# prefetching
prefetchStrategy = ""
# precision
precision="DP" # "DP" = double, "SP" = float
# Constructor
def __init__(self, M, N, K, LDA, LDB, LDC, alpha, beta, alignment_A, alignment_C, name, prefetchStrategy, operationType="gemm"):
def __init__(self, M, N, K, LDA, LDB, LDC, alpha, beta, alignment_A, alignment_C, name, prefetchStrategy, operationType="gemm", precision="DP"):
if precision not in ["DP", "SP"]:
print("MatmulConfig: Unknown precision")
exit()
if((M > LDC) or (K > LDB) or (M > LDA)):
print("MatmulConfig: Incompatible matrix sizes and leading dimensions")
exit()
......@@ -95,6 +101,7 @@ class MatmulConfig:
self.name = name
self.prefetchStrategy = prefetchStrategy
self.baseroutinename = operationType+"_"+str(M)+"_"+str(N)+"_"+str(K)+"_"+name
self.precision = precision
def __repr__(self):
......
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