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

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

KernelGen SplitCK Vect - add flux and source

parent a8e53591
......@@ -111,7 +111,12 @@ class FusedSpaceTimePredictorVolumeIntegralModel(AbstractModelBaseClass):
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"]):
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
if(self.context["useFlux"]):
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"]["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
......
......@@ -91,7 +91,7 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
// local tmp array
double tmpArray[{{nVarPad*nDofPad}}] __attribute__((aligned(ALIGNMENT))); //used by flux and ncp
double tmpArray[{{nVarPad*nDofPad*nDof}}] __attribute__((aligned(ALIGNMENT))); //used by flux and ncp
double dudxT_by_dx[{{nDof*nDofPad}}] __attribute__((aligned(ALIGNMENT)));
double dudx_by_dx[{{nDof*nDofPad}}] __attribute__((aligned(ALIGNMENT)));
double negativeDudxT_by_dx[{{nDof*nDofPad}}] __attribute__((aligned(ALIGNMENT)));
......@@ -218,15 +218,11 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
std::memset(lQi_next, 0, {{(nDof**nDim)*nVarPad}} *sizeof(double));
{% if useFlux %}
/* TODO JMG
//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', 'negativeDudxT_by_dx', 'lQi_next', '0', '0', idx(0,yz,0,0)) | indent(6) }}{##}
solver.{{solverName}}::flux_x_vect(lQi+{{idx(0,yz,0,0)}}, {% if nPar != 0 %}lPi+{{idxLPi(0,yz,0,0)}}{% else %}nullptr{%endif%}, tmpArray); //tmpArray[N][X]
{{ m.matmul('flux_x_sck_vect', 'negativeDudx_by_dx', 'tmpArray', 'lQi_next', '0', '0', idx(0,yz,0,0)) | indent(6) }}{##}
}
*/
{% endif %}
//ncp in x
......@@ -244,17 +240,15 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
}
{% if useFlux %}
/* TODO JMG
//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
solver.{{solverName}}::flux_y_vect(lQi+{{idx(z,y,0,0)}}, {% if nPar != 0 %}lPi+{{idxLPi(z,y,0,0)}}{% else %}nullptr{%endif%}, tmpArray+y*{{nDofPad*nVar}}); //tmpArray[Y][N][X]
}
{{ m.matmul('flux_y_sck', 'tmpArray', 'negativeDudxT_by_dx', 'lQi_next', '0', '0', idx(z,0,x,0)) | indent(8) }}{##}
//fuse n and x
{{ m.matmul('flux_y_sck_vect', 'tmpArray', 'negativeDudxT_by_dx', 'lQi_next', '0', '0', idx(z,0,0,0)) | indent(8) }}{##}
}
}
*/
{% endif %}
//ncp in y
......@@ -274,15 +268,14 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
{% if nDim ==3 %}
{% if useFlux %}
/* TODO JMG
//call flux in z
for (int xy = 0; xy < {{nDof*nDof}}; xy++){
for (int y = 0; y < {{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
solver.{{solverName}}::flux_z(lQi+{{idx(z,y,0,0)}}, {% if nPar != 0 %}lPi+{{idxLPi(z,y,0,0)}}{% else %}nullptr{%endif%}, tmpArray+z*{{nDofPad*nVar}}); //tmpArray[Z][N][X]
}
{{ m.matmul('flux_z_sck', 'tmpArray', 'negativeDudxT_by_dx', 'lQi_next', '0', '0', idx(0,0,xy,0)) | indent(6) }}{##}
//fuse n and x
{{ m.matmul('flux_z_sck_vect', 'tmpArray', 'negativeDudxT_by_dx', 'lQi_next', '0', '0', idx(0,y,0,0)) | indent(6) }}{##}
}
*/
{% endif %}
//ncp in z
......@@ -299,6 +292,16 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
}
}
{% endif%}
{% if useSource %}
//call source
for (int yz = 0; yz < {{nDof*nDof3D}}; yz++) {
solver.{{solverName}}::algebraicSource_scalar(lQi+{{idx(0,yz,0,0)}}, {% if nPar != 0 %}lPi+{{idxLPi(0,yz,0,0)}}{% else %}nullptr{%endif%}, tmpArray, center, tStep, {{nDofPad}});
#pragma omp simd aligned(lQi_next,tmpArray:ALIGNMENT)
for (int nx = 0; nx < {{nVar*nDofPad}}; nx++) {
lQi_next[{{idx(0,0,0,nx)}}] -= tmpArray[nx];
}
}
{% endif %}
{% if usePointSources %}
//add ith Ps derivative to lQi_next
for (int it_t = 0; it_t < {{nDof}}; it_t++) {
......@@ -440,15 +443,11 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
std::memset(lFhi, 0, {{nDof3D*nDof*nVar*nDofPad}}*sizeof(double)); // TODO JMG flux ersatzt
{% endif %}
{% if useFlux %}
/* Todo JMG
//call flux in x
// 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) }}{##}
solver.{{solverName}}::flux_x_vect(lQhi+{{idx(0,yz,0,0)}}, {% if nPar != 0 %}lPi+{{idxLPi(0,yz,0,0)}}{% else %}nullptr{%endif%}, tmpArray); //tmpArray[N][X]
{{ m.matmul('flux_x_sck_vect', 'dudx_by_dx', 'tmpArray', 'lFhi', '0', '0', idx(0,yz,0,0)) | indent(4) }}{##}
}
*/
{% endif %}
// ncp in x
{{ m.matmul('gradQ_x_sck_vect', 'dudx_by_dx', 'lQhi', 'gradQ', '0', '0', '0') | indent(4) }}{##}
......@@ -484,17 +483,15 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
std::memset(lFhi, 0, {{nDof3D*nDof*nVar*nDofPad}}*sizeof(double)); // TODO JMG flux ersatzt
{% endif %}
{% if useFlux %}
/* Todo JMG
//call flux in y
// 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
solver.{{solverName}}::flux_y_vect(lQhi+{{idx(z,y,0,0)}}, {% if nPar != 0 %}lPi+{{idxLPi(z,y,0,0)}}{% else %}nullptr{%endif%}, tmpArray+y*{{nDofPad*nVar}}); //tmpArray[Y][N][X]
}
{{ m.matmul('flux_y_sck', 'tmpArray', 'dudxT_by_dx', 'lFhi', '0', '0', idx(z,0,x,0)) | indent(8) }}{##}
//fuse n and x
{{ m.matmul('flux_y_sck_vect', 'tmpArray', 'dudxT_by_dx', 'lFhi', '0', '0', idx(z,0,0,0)) | indent(6) }}{##}
}
}
*/
{% endif %}
// ncp in y
for (int z = 0; z < {{nDof3D}}; z++) { //fuse n and x
......@@ -536,15 +533,14 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
std::memset(lFhi, 0, {{nDof3D*nDof*nVar*nDofPad}}*sizeof(double)); // TODO JMG flux ersatzt
{% endif %}
{% if useFlux %}
/* TODO JMG
//call flux in z
for (int xy = 0; xy < {{nDof*nDof}}; xy++){
//flux in z
for (int y = 0; y < {{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
solver.{{solverName}}::flux_z(lQhi+{{idx(z,y,0,0)}}, {% if nPar != 0 %}lPi+{{idxLPi(z,y,0,0)}}{% else %}nullptr{%endif%}, tmpArray+z*{{nDofPad*nVar}}); //tmpArray[Z][N][X]
}
{{ m.matmul('flux_z_sck', 'tmpArray', 'dudxT_by_dx', 'lFhi', '0', '0', idx(0,0,xy,0)) | indent(6) }}{##}
//fuse n and x
{{ m.matmul('flux_z_sck_vect', 'tmpArray', 'dudxT_by_dx', 'lFhi', '0', '0', idx(0,y,0,0)) | indent(6) }}{##}
}
*/
{% endif %}
// ncp in z
{{ m.matmul('gradQ_z_sck_vect', 'lQhi', 'dudxT_by_dx', 'gradQ', '0', '0', '0') | indent(4) }}{##}
......@@ -577,6 +573,18 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
}
{% endif %}
{% if useSource %}
//call source
for (int yz = 0; yz < {{nDof*nDof3D}}; yz++) {
solver.{{solverName}}::algebraicSource_scalar(lQhi+{{idx(0,yz,0,0)}}, {% if nPar != 0 %}lPi+{{idxLPi(0,yz,0,0)}}{% else %}nullptr{%endif%}, tmpArray, center, tStep, {{nDofPad}});
for (int x = 0; x < {{nDof}}; x++) {
for (int n = 0; n < {{nVar}}; n++) {
lduh[{{idxLduh(0,yz,x,n)}}] -= tmpArray[x*{{nDofPad}}+n] * weights3[{{idxW3(0,yz,x)}}];
}
}
}
{% endif %}
return -1; //no picard iteration in linear 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