Peano 4
Loading...
Searching...
No Matches
amrRoutinesModel.py
Go to the documentation of this file.
22
23
24from .abstractModelBaseClass import AbstractModelBaseClass
25
26from ..utils import MatmulConfig
27
28
30
31 def generateCode(self):
32 self.render(("aderdg", "amrRoutines_cpp.template"), "amrRoutines.cpp")
33 # generates gemms
34 if(self.context["useLibxsmm"]):
35 self.controller.generateGemms("asm_amrRoutines.c", self.context["matmulConfigs"].values())
36
37
39 # define a sequence of matmul configs
40 self.context["matmulConfigs"] = {}
41 # shortcut
42 nVar = self.context["nVar"]
43 nVarPad = self.context["nVarPad"]
44 nData = self.context["nData"]
45 nDataPad = self.context["nDataPad"]
46 nDof = self.context["nDof"]
47 nDof2 = nDof*nDof
48 nDofPad = self.context["nDofPad"]
49 nDim = self.context["nDim"]
50
51 # Always overwrite input (no need to set to 0), except if add
52 # nDim-1 face projection, inputs are padded
53 self.context["matmulConfigs"]["face_Q_x"] = MatmulConfig(nDataPad, nDof, nDof, nDataPad, nDofPad, nDataPad, 1, 0, 1, 1, "face_Q_x", "nopf", "gemm", self.context["correctorStoragePrecision"])
54 self.context["matmulConfigs"]["face_F_x"] = MatmulConfig(nVarPad , nDof, nDof, nVarPad , nDofPad, nVarPad , 1, 0, 1, 1, "face_F_x", "nopf", "gemm", self.context["correctorStoragePrecision"])
55 if(nDim == 3):
56 self.context["matmulConfigs"]["face_Q_y"] = MatmulConfig(nDataPad, nDof, nDof, nDataPad*nDof, nDofPad, nDataPad*nDof, 1, 0, 1, 1, "face_Q_y", "nopf", "gemm", self.context["correctorStoragePrecision"])
57 self.context["matmulConfigs"]["face_F_y"] = MatmulConfig(nVarPad , nDof, nDof, nVarPad*nDof , nDofPad, nVarPad*nDof , 1, 0, 1, 1, "face_F_y", "nopf", "gemm", self.context["correctorStoragePrecision"])
58 # nDim volume projection, luh (input/output) is not padded
59 self.context["matmulConfigs"]["volume_x"] = MatmulConfig(nData , nDof, nDof, nData , nDofPad, nDataPad , 1, 0, 0, 1, "volume_x", "nopf", "gemm", self.context["correctorStoragePrecision"]) # input slice not aligned
60 if(nDim==3):
61 self.context["matmulConfigs"]["volume_y"] = MatmulConfig(nDataPad, nDof, nDof, nDataPad*nDof , nDofPad, nDataPad*nDof, 1, 0, 1, 1, "volume_y", "nopf", "gemm", self.context["correctorStoragePrecision"])
62 self.context["matmulConfigs"]["volume_z"] = MatmulConfig(nData , nDof, nDof, nDataPad*nDof2, nDofPad, nData*nDof2 , 1, 0, 1, 0, "volume_z", "nopf", "gemm", self.context["correctorStoragePrecision"]) # output slice not aligned
63 self.context["matmulConfigs"]["volume_z_add"] = MatmulConfig(nData, nDof, nDof, nDataPad*nDof2, nDofPad, nData*nDof2 , 1, 1, 1, 0, "volume_z_add", "nopf", "gemm", self.context["correctorStoragePrecision"]) # output slice not aligned, add to result
64 else:
65 self.context["matmulConfigs"]["volume_y"] = MatmulConfig(nData , nDof, nDof, nDataPad*nDof , nDofPad, nData*nDof , 1, 0, 1, 0, "volume_y", "nopf", "gemm", self.context["correctorStoragePrecision"]) # output slice not aligned
66 self.context["matmulConfigs"]["volume_y_add"] = MatmulConfig(nData, nDof, nDof, nDataPad*nDof , nDofPad, nData*nDof , 1, 1, 1, 0, "volume_y_add", "nopf", "gemm", self.context["correctorStoragePrecision"]) # output slice not aligned, add to result
And from this we can write down f$ nabla phi_i nabla phi_i dx but since we are constructing matrix let s investigate the f$ our matrix elements will nabla phi_i dx f By this will be a sparse as these basis functions are chosen to not overlap with each other almost everywhere In other they have only local support We can read off the right hand side values
Specification of a dense matrix-matrix multiplication.