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

Commit a568a554 authored by Jean-Matthieu's avatar Jean-Matthieu

KernelGen - add flux to splitck

parent 53c5f606
......@@ -101,15 +101,20 @@ class FusedSpaceTimePredictorVolumeIntegralModel(AbstractModelBaseClass):
if(self.context["isLinear"]):
if(self.context["useSplitCKScalar"]):
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["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"] = 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
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"]):
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_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
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:
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
......
......@@ -95,7 +95,7 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
{% endif %}
// local tmp array
double tmpArray[{{nVarPad}}] __attribute__((aligned(ALIGNMENT))); //used by flux and ncp
double tmpArray[{{nVarPad*nDof}}] __attribute__((aligned(ALIGNMENT))); //used by flux and ncp
double dudxT_by_dx[{{nDof*nDofPad}}] __attribute__((aligned(ALIGNMENT)));
{% if useLibxsmm %}
#if defined(USE_IPO) && ! defined(UNSAFE_IPO)
......@@ -198,10 +198,20 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
// reset lQi_next
std::memset(lQi_next, 0, {{(nDof**nDim)*nVarPad}} *sizeof(double));
{% if useFlux %}
//call flux in x
for (int yz = 0; yz < {{nDof*nDof3D}}; yz++) {
for (int x = 0; x < {{nDof}} ; x++){
solver.{{solverName}}::flux_x(lQi+{{idx(0,yz,x,0)}}, lPi+{{idxLPi(0,yz,x,0)}}, tmpArray+x*{{nVarPad}}); //nVar
}
{{ m.matmul('flux_x_sck', 'tmpArray', 'dudxT_by_dx', 'lQi_next', '0', '0', idx(0,yz,0,0)) | indent(6) }}{##}
}
{% endif %}
//ncp in x
// x direction (independent from the y and z derivatives)
for (int yz = 0; yz < {{nDof*nDof3D}}; yz++) {
{{ m.matmul('gradQ_x_sck', 'lQi', 'dudxT_by_dx', 'gradQ', idx(0,"yz",0,0), '0', idx(0,"yz",0,0)) | indent(6) }}{##}
{{ m.matmul('gradQ_x_sck', 'lQi', 'dudxT_by_dx', 'gradQ', idx(0,yz,0,0), '0', idx(0,yz,0,0)) | indent(6) }}{##}
}
//call ncp in x
......@@ -212,6 +222,18 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
lQi_next[{{idx(0,0,xyz,n)}}] -= tmpArray[n];
}
}
{% if useFlux %}
//call flux in y
for (int z = 0; z < {{nDof3D}}; z++) {
for (int x = 0; x < {{nDof}}; x++) {
for (int y = 0; y < {{nDof}} ; y++){
solver.{{solverName}}::flux_y(lQi+{{idx(z,y,x,0)}}, lPi+{{idxLPi(z,y,x,0)}}, tmpArray+y*{{nVarPad}}); //nVar
}
{{ m.matmul('flux_y_sck', 'tmpArray', 'dudxT_by_dx', 'lQi_next', '0', '0', idx(z,0,x,0)) | indent(8) }}{##}
}
}
{% endif %}
//ncp in y
// y direction (independent from the x and z derivatives)
......@@ -231,6 +253,16 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
}
{% if nDim ==3 %}
{% if useFlux %}
//call flux in z
for (int xy = 0; xy < {{nDof*nDof}}; y++){
for (int z = 0; z < {{nDof}}; z++) {
solver.{{solverName}}::flux_z(lQi+{{idx(z,0,xy,0)}}, lPi+{{idxLPi(z,0,xy,0)}}, tmpArray+z*{{nVarPad}}); //nVar
}
{{ m.matmul('flux_z_sck', 'tmpArray', 'dudxT_by_dx', 'lQi_next', '0', '0', idx(0,0,xy,0)) | indent(6) }}{##}
}
{% endif %}
//ncp in z
// z direction (independent from the x and y derivatives)
for (int xy = 0; xy < {{nDof*nDof}}; xy++) {
......@@ -379,14 +411,24 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
{% endif %}
//recompute lFhi in x
for (int yz = 0; yz < {{nDof*nDof3D}}; yz++) {
{{ m.matmul('gradQ_x_sck', 'lQhi', 'dudxT_by_dx', 'gradQ', idx(0,yz,0,0), '0', idx(0,yz,0,0)) | indent(4) }}{##}
}
{% if usePointSources %}
std::copy_n(PSi, {{(nDof**nDim)*nVarPad}}, lFhi); //start with the pointsource values
{%else%}
std::memset(lFhi, 0, {{(nDof**nDim)*nVarPad}}*sizeof(double)); // TODO JMG flux ersatzt
{% endif %}
{% if useFlux %}
//call flux in x
for (int yz = 0; yz < {{nDof*nDof3D}}; yz++) {
for (int x = 0; x < {{nDof}} ; x++){
solver.{{solverName}}::flux_x(lQhi+{{idx(0,yz,x,0)}}, lPi+{{idxLPi(0,yz,x,0)}}, tmpArray+x*{{nVarPad}}); //nVar
}
{{ m.matmul('flux_x_sck', 'tmpArray', 'dudxT_by_dx', 'lFhi', '0', '0', idx(0,yz,0,0)) | indent(6) }}{##}
}
{% endif %}
// ncp in x
for (int yz = 0; yz < {{nDof*nDof3D}}; yz++) {
{{ m.matmul('gradQ_x_sck', 'lQhi', 'dudxT_by_dx', 'gradQ', idx(0,yz,0,0), '0', idx(0,yz,0,0)) | indent(4) }}{##}
}
for (int xyz = 0; xyz < {{nDof**nDim}}; xyz++) {
//include flux here
//std::memset(lFhi+xyz*{{nVarPad}}, 0, {{nVarPad}}*sizeof(double)); // TODO JMG flux ersatzt
......@@ -415,16 +457,28 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
}
//recompute lFhi in y
for (int z = 0; z < {{nDof3D}}; z++) {
for (int x = 0; x < {{nDof}}; x++) {
{{ m.matmul('gradQ_y_sck', 'lQhi', 'dudxT_by_dx', 'gradQ', idx(z,0,x,0), '0', idx(z,0,x,0)) | indent(6) }}{##}
}
}
{% if usePointSources %}
std::copy_n(PSi, {{(nDof**nDim)*nVarPad}}, lFhi); //start with the pointsource values
{%else%}
std::memset(lFhi, 0, {{(nDof**nDim)*nVarPad}}*sizeof(double)); // TODO JMG flux ersatzt
{% endif %}
{% if useFlux %}
//call flux in y
for (int z = 0; z < {{nDof3D}}; z++) {
for (int x = 0; x < {{nDof}}; x++) {
for (int y = 0; y < {{nDof}} ; y++){
solver.{{solverName}}::flux_y(lQhi+{{idx(z,y,x,0)}}, lPi+{{idxLPi(z,y,x,0)}}, tmpArray+y*{{nVarPad}}); //nVar
}
{{ m.matmul('flux_y_sck', 'tmpArray', 'dudxT_by_dx', 'lFhi', '0', '0', idx(z,0,x,0)) | indent(8) }}{##}
}
}
{% endif %}
// ncp in y
for (int z = 0; z < {{nDof3D}}; z++) {
for (int x = 0; x < {{nDof}}; x++) {
{{ m.matmul('gradQ_y_sck', 'lQhi', 'dudxT_by_dx', 'gradQ', idx(z,0,x,0), '0', idx(z,0,x,0)) | indent(6) }}{##}
}
}
for (int xyz = 0; xyz < {{nDof**nDim}}; xyz++) {
//include flux here
//std::memset(lFhi+xyz*{{nVarPad}}+{{nVarPad*(nDof**nDim)}}, 0, {{nVarPad}}*sizeof(double)); // TODO JMG flux ersatzt
......@@ -455,14 +509,24 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
{% if nDim==3 %}
//recompute lFhi in z
for (int xy = 0; xy < {{nDof*nDof}}; xy++) {
{{ m.matmul('gradQ_z_sck', 'lQhi', 'dudxT_by_dx', 'gradQ', idx(0,0,xy,0), '0', idx(0,0,xy,0)) | indent(4) }}{##}
}
{% if usePointSources %}
std::copy_n(PSi, {{(nDof**nDim)*nVarPad}}, lFhi); //start with the pointsource values
{%else%}
std::memset(lFhi, 0, {{(nDof**nDim)*nVarPad}}*sizeof(double)); // TODO JMG flux ersatzt
{% endif %}
{% if useFlux %}
//call flux in z
for (int xy = 0; xy < {{nDof*nDof}}; y++){
for (int z = 0; z < {{nDof}}; z++) {
solver.{{solverName}}::flux_z(lQhi+{{idx(z,0,xy,0)}}, lPi+{{idxLPi(z,0,xy,0)}}, tmpArray+z*{{nVarPad}}); //nVar
}
{{ m.matmul('flux_z_sck', 'tmpArray', 'dudxT_by_dx', 'lFhi', '0', '0', idx(0,0,xy,0)) | indent(6) }}{##}
}
{% endif %}
// ncp in z
for (int xy = 0; xy < {{nDof*nDof}}; xy++) {
{{ m.matmul('gradQ_z_sck', 'lQhi', 'dudxT_by_dx', 'gradQ', idx(0,0,xy,0), '0', idx(0,0,xy,0)) | indent(4) }}{##}
}
for (int xyz = 0; xyz < {{nDof**nDim}}; xyz++) {
//include flux here
//std::memset(lFhi+xyz*{{nVarPad}}+{{2*nVarPad*(nDof**nDim)}}, 0, {{nVarPad}}*sizeof(double)); // TODO JMG flux ersatzt
......
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