Ejemplo n.º 1
0
    adg = equations.Viscoelastic2ADERDG(**cmdArgsDict)

include_tensors = set()
include_tensors = set()
g = Generator(arch)

# Equation-specific kernels
adg.addInit(g)
adg.addLocal(g)
adg.addNeighbor(g)
adg.addTime(g)
adg.add_include_tensors(include_tensors)

# Common kernels
include_tensors |= DynamicRupture.addKernels(
    NamespacedGenerator(g, namespace="dynamicRupture"), adg,
    cmdLineArgs.matricesDir, cmdLineArgs.dynamicRuptureMethod)
Plasticity.addKernels(g, adg, cmdLineArgs.matricesDir,
                      cmdLineArgs.PlasticityMethod)
NodalBoundaryConditions.addKernels(g, adg, include_tensors,
                                   cmdLineArgs.matricesDir, cmdLineArgs)
SurfaceDisplacement.addKernels(g, adg)
Point.addKernels(g, adg)

# pick up the user's defined gemm tools
gemm_tool_list = cmdLineArgs.gemm_tools.replace(" ", "").split(",")
generators = []

for tool in gemm_tool_list:
    if hasattr(gemm_configuration, tool):
        specific_gemm_class = getattr(gemm_configuration, tool)
Ejemplo n.º 2
0
numberOfQuantities = numberOfElasticQuantities + 6*numberOfMechanisms

clones = {
  'star': [ 'AstarT', 'BstarT', 'CstarT' ]
}

# Load matrices
db = Tools.parseMatrixFile('{}/matrices_{}.xml'.format(cmdLineArgs.matricesDir, numberOfBasisFunctions), clones)
db.update(Tools.parseMatrixFile('{}/matrices_viscoelastic.xml'.format(cmdLineArgs.matricesDir), clones))

# Determine sparsity patterns that depend on the number of mechanisms
riemannSolverSpp = np.bmat([[np.matlib.ones((9, numberOfReducedQuantities), dtype=np.float64)], [np.matlib.zeros((numberOfReducedQuantities-9, numberOfReducedQuantities), dtype=np.float64)]])
db.insert(DB.MatrixInfo('AplusT', numberOfReducedQuantities, numberOfReducedQuantities, matrix=riemannSolverSpp))
db.insert(DB.MatrixInfo('AminusT', numberOfReducedQuantities, numberOfReducedQuantities, matrix=riemannSolverSpp))

DynamicRupture.addMatrices(db, cmdLineArgs.matricesDir, order, cmdLineArgs.dynamicRuptureMethod, numberOfElasticQuantities, numberOfReducedQuantities)
Plasticity.addMatrices(db, cmdLineArgs.matricesDir, cmdLineArgs.PlasticityMethod, order)
SurfaceDisplacement.addMatrices(db, order)

# Load sparse-, dense-, block-dense-config
Tools.memoryLayoutFromFile(cmdLineArgs.memLayout, db, clones)

# Set rules for the global matrix memory order
stiffnessOrder = { 'Xi': 0, 'Eta': 1, 'Zeta': 2 }
globalMatrixIdRules = [
  (r'^k(Xi|Eta|Zeta)DivMT$', lambda x: stiffnessOrder[x[0]]),
  (r'^k(Xi|Eta|Zeta)DivM$', lambda x: 3 + stiffnessOrder[x[0]]),  
  (r'^r(\d{1})DivM$', lambda x: 6 + int(x[0])-1),
  (r'^rT(\d{1})$', lambda x: 10 + int(x[0])-1),
  (r'^fMrT(\d{1})$', lambda x: 14 + int(x[0])-1),
  (r'^fP(\d{1})$', lambda x: 18 + (int(x[0])-1))
Ejemplo n.º 3
0
    adg = equations.PoroelasticADERDG(**cmdArgsDict)

include_tensors = set()
generator = Generator(arch)

# Equation-specific kernels
adg.addInit(generator)
adg.addLocal(generator, targets)
adg.addNeighbor(generator, targets)
adg.addTime(generator, targets)
adg.add_include_tensors(include_tensors)

# Common kernels
include_tensors.update(DynamicRupture.addKernels(NamespacedGenerator(generator, namespace="dynamicRupture"),
                                                 adg,
                                                 cmdLineArgs.matricesDir,
                                                 cmdLineArgs.dynamicRuptureMethod,
                                                 targets))

Plasticity.addKernels(generator, 
                      adg,
                      cmdLineArgs.matricesDir,
                      cmdLineArgs.PlasticityMethod,
                      targets)
NodalBoundaryConditions.addKernels(generator, adg, include_tensors, cmdLineArgs.matricesDir, cmdLineArgs)
SurfaceDisplacement.addKernels(generator, adg, include_tensors, targets)
Point.addKernels(generator, adg)

# pick up the user's defined gemm tools
gemm_tool_list = cmdLineArgs.gemm_tools.replace(" ", "").split(",")
gemm_generators = []
Ejemplo n.º 4
0
arch = useArchitectureIdentifiedBy(cmdLineArgs.arch)

equationsSpec = importlib.util.find_spec(cmdLineArgs.equations)
try:
  equations = equationsSpec.loader.load_module()
except:
  raise RuntimeError('Could not find kernels for ' + cmdLineArgs.equations)

adgArgs = inspect.getargspec(equations.ADERDG.__init__).args[1:]
cmdArgsDict = vars(cmdLineArgs)
args = [cmdArgsDict[key] for key in adgArgs]
adg = equations.ADERDG(*args)

g = Generator(arch)

# Equation-specific kernels
adg.addInit(g)
adg.addLocal(g)
adg.addNeighbor(g)
adg.addTime(g)

# Common kernels
DynamicRupture.addKernels(g, adg, cmdLineArgs.matricesDir, cmdLineArgs.dynamicRuptureMethod) 
Plasticity.addKernels(g, adg, cmdLineArgs.matricesDir, cmdLineArgs.PlasticityMethod)
SurfaceDisplacement.addKernels(g, adg)
Point.addKernels(g, adg)

# Generate code
gemmTools = GeneratorCollection([LIBXSMM(arch), PSpaMM(arch)])
g.generate(cmdLineArgs.outputDir, 'seissol', gemmTools)
Ejemplo n.º 5
0
             (numberOfReducedQuantities - 9, numberOfReducedQuantities),
             dtype=np.float64)
     ]])
db.insert(
    DB.MatrixInfo('AplusT',
                  numberOfReducedQuantities,
                  numberOfReducedQuantities,
                  matrix=riemannSolverSpp))
db.insert(
    DB.MatrixInfo('AminusT',
                  numberOfReducedQuantities,
                  numberOfReducedQuantities,
                  matrix=riemannSolverSpp))

DynamicRupture.addMatrices(db, cmdLineArgs.matricesDir, order,
                           cmdLineArgs.dynamicRuptureMethod,
                           numberOfElasticQuantities,
                           numberOfReducedQuantities)
Plasticity.addMatrices(db, cmdLineArgs.matricesDir,
                       cmdLineArgs.PlasticityMethod, order)
SurfaceDisplacement.addMatrices(db, order)

# Load sparse-, dense-, block-dense-config
Tools.memoryLayoutFromFile(cmdLineArgs.memLayout, db, clones)

# Set rules for the global matrix memory order
stiffnessOrder = {'Xi': 0, 'Eta': 1, 'Zeta': 2}
globalMatrixIdRules = [
    (r'^k(Xi|Eta|Zeta)DivMT$', lambda x: stiffnessOrder[x[0]]),
    (r'^k(Xi|Eta|Zeta)DivM$', lambda x: 3 + stiffnessOrder[x[0]]),
    (r'^r(\d{1})DivM$', lambda x: 6 + int(x[0]) - 1),
    (r'^rT(\d{1})$', lambda x: 10 + int(x[0]) - 1),