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

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

KernelGen SplitCK vect - add MaterialParam

parent b3ccade4
......@@ -112,10 +112,14 @@ class FusedSpaceTimePredictorVolumeIntegralModel(AbstractModelBaseClass):
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"]):
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")
if(self.context["useMaterialParam"]):
self.context["matmulConfigs"]["flux_x_sck_vect"] = MatmulConfig(nDofPad, nVar, nDof, nDofPad , nDofPad, nDofPad , 1, 0, 1, 1, "flux_x_sck_vect", "nopf", "gemm")
self.context["matmulConfigs"]["flux_y_or_z_sck_vect"] = MatmulConfig(nDofPad*nVar, nVar, nDof, nDofPad*nVar , nDofPad, nDofPad*nVar , 1, 0, 1, 1, "flux_y_or_z_sck_vect", "nopf", "gemm")
else:
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):
......
......@@ -207,9 +207,21 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
for (int x = 0; x < {{nDof}} ; x++){
solver.{{solverName}}::flux_x(lQi+{{idx(0,yz,x,0)}}, {% if nPar != 0 %}lPi+{{idxLPi(0,yz,x,0)}}{% else %}nullptr{%endif%}, tmpArray+x*{{nVarPad}}); //nVar
}
{% if useMaterialParam %}
// store M*rhs in gradQ [x][n]
{{ m.matmul('flux_sck', 'tmpArray', 'negativeDudxT_by_dx', 'gradQ', '0', '0', '0') | indent(6) }}{##}
for (int x = 0; x < {{nDof}} ; x++){
solver.{{solverName}}::multiplyMaterialParameterMatrix_scalar(lPi+{{idxLPi(0,yz,x,0)}}, gradQ+x*{{nVarPad}});
for (int n = 0; n < {{nVarPad}} ; n++){
lQi_next[{{idx(0,yz,x,n)}}] += gradQ[{{idx(0,0,x,n)}}];
}
}
{% else %}
{{ m.matmul('flux_x_sck', 'tmpArray', 'negativeDudxT_by_dx', 'lQi_next', '0', '0', idx(0,yz,0,0)) | indent(6) }}{##}
{% endif %}{# useMaterialParam #}
}
{% endif %}
{% endif %}{# useFlux #}
//ncp in x
// x direction (independent from the y and z derivatives)
......@@ -233,10 +245,21 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
for (int y = 0; y < {{nDof}} ; y++){
solver.{{solverName}}::flux_y(lQi+{{idx(z,y,x,0)}}, {% if nPar != 0 %}lPi+{{idxLPi(z,y,x,0)}}{% else %}nullptr{%endif%}, tmpArray+y*{{nVarPad}}); //nVar
}
{{ m.matmul('flux_y_sck', 'tmpArray', 'negativeDudxT_by_dx', 'lQi_next', '0', '0', idx(z,0,x,0)) | indent(8) }}{##}
{% if useMaterialParam %}
// store M*rhs in gradQ [y][n]
{{ m.matmul('flux_sck', 'tmpArray', 'negativeDudxT_by_dx', 'gradQ', '0', '0', '0') | indent(6) }}{##}
for (int y = 0; y < {{nDof}} ; y++){
solver.{{solverName}}::multiplyMaterialParameterMatrix_scalar(lPi+{{idxLPi(z,y,x,0)}}, gradQ+y*{{nVarPad}});
for (int n = 0; n < {{nVarPad}} ; n++){
lQi_next[{{idx(z,y,x,n)}}] += gradQ[{{idx(0,0,y,n)}}];
}
}
{% else %}
{{ m.matmul('flux_y_sck', 'tmpArray', 'negativeDudxT_by_dx', 'lQi_next', '0', '0', idx(z,0,x,0)) | indent(8) }}{##}
{% endif %}{# useMaterialParam #}
}
}
{% endif %}
{% endif %}{# useFlux #}
//ncp in y
// y direction (independent from the x and z derivatives)
......@@ -262,9 +285,20 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
for (int z = 0; z < {{nDof}}; z++) {
solver.{{solverName}}::flux_z(lQi+{{idx(z,0,xy,0)}}, {% if nPar != 0 %}lPi+{{idxLPi(z,0,xy,0)}}{% else %}nullptr{%endif%}, tmpArray+z*{{nVarPad}}); //nVar
}
{% if useMaterialParam %}
// store M*rhs in gradQ [z][n]
{{ m.matmul('flux_sck', 'tmpArray', 'negativeDudxT_by_dx', 'gradQ', '0', '0', '0') | indent(6) }}{##}
for (int z = 0; z < {{nDof}} ; z++){
solver.{{solverName}}::multiplyMaterialParameterMatrix_scalar(lPi+{{idxLPi(z,0,xy,0)}}, gradQ+z*{{nVarPad}});
for (int n = 0; n < {{nVarPad}} ; n++){
lQi_next[{{idx(z,0,xy,n)}}] += gradQ[{{idx(0,0,z,n)}}];
}
}
{% else %}
{{ m.matmul('flux_z_sck', 'tmpArray', 'negativeDudxT_by_dx', 'lQi_next', '0', '0', idx(0,0,xy,0)) | indent(6) }}{##}
{% endif %}{# useMaterialParam #}
}
{% endif %}
{% endif %}{# useFlux #}
//ncp in z
// z direction (independent from the x and y derivatives)
......@@ -435,9 +469,21 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
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) }}{##}
{% if useMaterialParam %}
// store M*rhs in gradQ [x][n]
{{ m.matmul('flux_sck', 'tmpArray', 'dudxT_by_dx', 'gradQ', '0', '0', '0') | indent(6) }}{##}
for (int x = 0; x < {{nDof}} ; x++){
solver.{{solverName}}::multiplyMaterialParameterMatrix_scalar(lPi+{{idxLPi(0,yz,x,0)}}, gradQ+x*{{nVarPad}});
for (int n = 0; n < {{nVarPad}} ; n++){
lFhi[{{idx(0,yz,x,n)}}] += gradQ[{{idx(0,0,x,n)}}];
}
}
{% else %}
{{ m.matmul('flux_x_sck', 'tmpArray', 'dudxT_by_dx', 'lFhi', '0', '0', idx(0,yz,0,0)) | indent(6) }}{##}
{% endif %}{# useMaterialParam #}
}
{% endif %}
{% endif %}{# useFlux #}
// 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) }}{##}
......@@ -482,10 +528,21 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
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
}
{% if useMaterialParam %}
// store M*rhs in gradQ [x][n]
{{ m.matmul('flux_sck', 'tmpArray', 'dudxT_by_dx', 'gradQ', '0', '0', '0') | indent(6) }}{##}
for (int y = 0; y < {{nDof}} ; y++){
solver.{{solverName}}::multiplyMaterialParameterMatrix_scalar(lPi+{{idxLPi(z,y,x,0)}}, gradQ+y*{{nVarPad}});
for (int n = 0; n < {{nVarPad}} ; n++){
lFhi[{{idx(z,y,x,n)}}] += gradQ[{{idx(0,0,y,n)}}];
}
}
{% else %}
{{ m.matmul('flux_y_sck', 'tmpArray', 'dudxT_by_dx', 'lFhi', '0', '0', idx(z,0,x,0)) | indent(8) }}{##}
{% endif %}{# useMaterialParam #}
}
}
{% endif %}
{% endif %}{# useFlux #}
// ncp in y
for (int z = 0; z < {{nDof3D}}; z++) {
for (int x = 0; x < {{nDof}}; x++) {
......@@ -533,9 +590,20 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
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) }}{##}
{% if useMaterialParam %}
// store M*rhs in gradQ [z][n]
{{ m.matmul('flux_sck', 'tmpArray', 'dudxT_by_dx', 'gradQ', '0', '0', '0') | indent(6) }}{##}
for (int z = 0; z < {{nDof}} ; z++){
solver.{{solverName}}::multiplyMaterialParameterMatrix_scalar(lPi+{{idxLPi(z,0,xy,0)}}, gradQ+z*{{nVarPad}});
for (int n = 0; n < {{nVarPad}} ; n++){
lFhi[{{idx(z,0,xy,n)}}] += gradQ[{{idx(0,0,z,n)}}];
}
}
{% else %}
{{ m.matmul('flux_z_sck', 'tmpArray', 'dudxT_by_dx', 'lFhi', '0', '0', idx(0,0,xy,0)) | indent(6) }}{##}
{% endif %}{# useMaterialParam #}
}
{% endif %}
{% endif %}{# useFlux #}
// 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) }}{##}
......
......@@ -221,9 +221,18 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
//call flux in x
for (int yz = 0; yz < {{nDof*nDof3D}}; yz++) {
solver.{{solverName}}::flux_x_vect(lQi+{{idx(0,yz,0,0)}}, {% if nPar != 0 %}lPi+{{idxLPi(0,yz,0,0)}}{% else %}nullptr{%endif%}, tmpArray, {{nDofPad}}); //tmpArray[N][X]
{% if useMaterialParam %}
// store M*rhs in gradQ [n][x]
{{ m.matmul('flux_x_sck_vect', 'negativeDudx_by_dx', 'tmpArray', 'gradQ', '0', '0', '0') | indent(6) }}{##}
solver.{{solverName}}::multiplyMaterialParameterMatrix_vect(lPi+{{idxLPi(0,yz,0,0)}}, gradQ, {{nDofPad}});
for (int nx = 0; nx < {{nVar*nDofPad}} ; nx++){
lQi_next[{{idx(0,yz,0,nx)}}] += gradQ[{{idx(0,0,0,nx)}}];
}
{% else %}
{{ m.matmul('flux_x_sck_vect', 'negativeDudx_by_dx', 'tmpArray', 'lQi_next', '0', '0', idx(0,yz,0,0)) | indent(6) }}{##}
{% endif %}{# useMaterialParam #}
}
{% endif %}
{% endif %}{# useFlux #}
//ncp in x
// x direction (independent from the y and z derivatives)
......@@ -245,10 +254,21 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
for (int y = 0; y < {{nDof}} ; y++){
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}}, {{nDofPad}}); //tmpArray[Y][N][X]
}
{% if useMaterialParam %}
// store M*rhs in gradQ [y][n][x], fuse n and x
{{ m.matmul('flux_y_or_z_sck_vect', 'tmpArray', 'negativeDudxT_by_dx', 'gradQ', '0', '0', '0') | indent(6) }}{##}
for (int y = 0; y < {{nDof}} ; y++){
solver.{{solverName}}::multiplyMaterialParameterMatrix_vect(lPi+{{idxLPi(z,y,0,0)}}, gradQ+y*{{nDofPad*nVar}}, {{nDofPad}});
for (int nx = 0; nx < {{nVar*nDofPad}} ; nx++){
lQi_next[{{idx(z,y,0,nx)}}] += gradQ[{{idx(0,y,0,nx)}}];
}
}
{% else %}
//fuse n and x
{{ m.matmul('flux_y_sck_vect', 'tmpArray', 'negativeDudxT_by_dx', 'lQi_next', '0', '0', idx(z,0,0,0)) | indent(6) }}{##}
{% endif %}{# useMaterialParam #}
}
{% endif %}
{% endif %}{# useFlux #}
//ncp in y
// y direction (independent from the x and z derivatives)
......@@ -272,10 +292,21 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
for (int z = 0; z < {{nDof}}; z++) {
solver.{{solverName}}::flux_z_vect(lQi+{{idx(z,y,0,0)}}, {% if nPar != 0 %}lPi+{{idxLPi(z,y,0,0)}}{% else %}nullptr{%endif%}, tmpArray+z*{{nDofPad*nVar}}, {{nDofPad}}); //tmpArray[Z][N][X]
}
{% if useMaterialParam %}
// store M*rhs in gradQ [z][n][x], fuse n and x
{{ m.matmul('flux_y_or_z_sck_vect', 'tmpArray', 'negativeDudxT_by_dx', 'gradQ', '0', '0', '0') | indent(6) }}{##}
for (int z = 0; z < {{nDof}} ; z++){
solver.{{solverName}}::multiplyMaterialParameterMatrix_vect(lPi+{{idxLPi(z,y,0,0)}}, gradQ+z*{{nDofPad*nVar}}, {{nDofPad}});
for (int nx = 0; nx < {{nVar*nDofPad}} ; nx++){
lQi_next[{{idx(z,y,0,nx)}}] += gradQ[{{idx(0,z,0,nx)}}];
}
}
{% else %}
//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 %}{# useMaterialParam #}
}
{% endif %}
{% endif %}{# useFlux #}
//ncp in z
// z direction (independent from the x and y derivatives)
......@@ -445,9 +476,18 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
// flux in x
for (int yz = 0; yz < {{nDof*nDof3D}}; yz++) {
solver.{{solverName}}::flux_x_vect(lQhi+{{idx(0,yz,0,0)}}, {% if nPar != 0 %}lPi+{{idxLPi(0,yz,0,0)}}{% else %}nullptr{%endif%}, tmpArray, {{nDofPad}}); //tmpArray[N][X]
{% if useMaterialParam %}
// store M*rhs in gradQ [n][x]
{{ m.matmul('flux_x_sck_vect', 'dudx_by_dx', 'tmpArray', 'gradQ', '0', '0', '0') | indent(4) }}{##}
solver.{{solverName}}::multiplyMaterialParameterMatrix_vect(lPi+{{idxLPi(0,yz,0,0)}}, gradQ, {{nDofPad}});
for (int nx = 0; nx < {{nVar*nDofPad}} ; nx++){
lFhi[{{idx(0,yz,0,nx)}}] += gradQ[{{idx(0,0,0,nx)}}];
}
{% else %}
{{ m.matmul('flux_x_sck_vect', 'dudx_by_dx', 'tmpArray', 'lFhi', '0', '0', idx(0,yz,0,0)) | indent(4) }}{##}
{% endif %}{# useMaterialParam #}
}
{% endif %}
{% endif %}{# useFlux #}
// ncp in x
{{ m.matmul('gradQ_x_sck_vect', 'dudx_by_dx', 'lQhi', 'gradQ', '0', '0', '0') | indent(4) }}{##}
for (int yz = 0; yz < {{nDof*nDof3D}}; yz++) {
......@@ -487,10 +527,21 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
for (int y = 0; y < {{nDof}} ; y++){
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}}, {{nDofPad}}); //tmpArray[Y][N][X]
}
{% if useMaterialParam %}
// store M*rhs in gradQ [y][n][x], fuse n and x
{{ m.matmul('flux_y_or_z_sck_vect', 'tmpArray', 'dudxT_by_dx', 'gradQ', '0', '0', '0') | indent(4) }}{##}
for (int y = 0; y < {{nDof}} ; y++){
solver.{{solverName}}::multiplyMaterialParameterMatrix_vect(lPi+{{idxLPi(z,y,0,0)}}, gradQ+y*{{nDofPad*nVar}}, {{nDofPad}});
for (int nx = 0; nx < {{nVar*nDofPad}} ; nx++){
lFhi[{{idx(z,y,0,nx)}}] += gradQ[{{idx(0,y,0,nx)}}];
}
}
{% else %}
//fuse n and x
{{ m.matmul('flux_y_sck_vect', 'tmpArray', 'dudxT_by_dx', 'lFhi', '0', '0', idx(z,0,0,0)) | indent(4) }}{##}
{% endif %}{# useMaterialParam #}
}
{% endif %}
{% endif %}{# useFlux #}
// ncp in y
for (int z = 0; z < {{nDof3D}}; z++) { //fuse n and x
{{ m.matmul('gradQ_y_sck_vect', 'lQhi', 'dudxT_by_dx', 'gradQ', idx(z,0,0,0), '0', idx(z,0,0,0)) | indent(6) }}{##}
......@@ -536,10 +587,21 @@ int {{codeNamespace}}::fusedSpaceTimePredictorVolumeIntegral{{nameSuffix}}(
for (int z = 0; z < {{nDof}}; z++) {
solver.{{solverName}}::flux_z_vect(lQhi+{{idx(z,y,0,0)}}, {% if nPar != 0 %}lPi+{{idxLPi(z,y,0,0)}}{% else %}nullptr{%endif%}, tmpArray+z*{{nDofPad*nVar}}, {{nDofPad}}); //tmpArray[Z][N][X]
}
{% if useMaterialParam %}
// store M*rhs in gradQ [z][n][x], fuse n and x
{{ m.matmul('flux_y_or_z_sck_vect', 'tmpArray', 'dudxT_by_dx', 'gradQ', '0', '0', '0') | indent(4) }}{##}
for (int z = 0; z < {{nDof}} ; z++){
solver.{{solverName}}::multiplyMaterialParameterMatrix_vect(lPi+{{idxLPi(z,y,0,0)}}, gradQ+z*{{nDofPad*nVar}}, {{nDofPad}});
for (int nx = 0; nx < {{nVar*nDofPad}} ; nx++){
lFhi[{{idx(z,y,0,nx)}}] += gradQ[{{idx(0,z,0,nx)}}];
}
}
{% else %}
//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 %}{# useMaterialParam #}
}
{% endif %}
{% endif %}{# useFlux #}
// ncp in z
{{ m.matmul('gradQ_z_sck_vect', 'lQhi', 'dudxT_by_dx', 'gradQ', '0', '0', '0') | indent(4) }}{##}
......
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