16 source_implementation,
17 compute_max_eigenvalue_of_next_time_step,
23 I return only the unqualified function call, i.e. without any namespaces.
24 So by setting the right namespace as prefix, you can direct it to particular
29 KernelVariant.PatchWiseAoSHeap:
"timeStep_patchwise_heap",
30 KernelVariant.PatchWiseAoSoAHeap:
"timeStep_patchwise_heap",
31 KernelVariant.PatchWiseSoAHeap:
"timeStep_patchwise_heap",
32 KernelVariant.BatchedAoSHeap:
"timeStep_batched_heap",
33 KernelVariant.BatchedAoSoAHeap:
"timeStep_batched_heap",
34 KernelVariant.BatchedSoAHeap:
"timeStep_batched_heap",
35 KernelVariant.TaskGraphAoSHeap:
"timeStep_taskgraph_heap",
36 KernelVariant.TaskGraphAoSoAHeap:
"timeStep_taskgraph_heap",
37 KernelVariant.TaskGraphSoAHeap:
"timeStep_taskgraph_heap",
40 EnumeratorTemplateTypes = {
41 KernelVariant.PatchWiseAoSHeap:
"::exahype2::enumerator::AoSLexicographicEnumerator",
42 KernelVariant.PatchWiseAoSoAHeap:
"::exahype2::enumerator::AoSoALexicographicEnumerator",
43 KernelVariant.PatchWiseSoAHeap:
"::exahype2::enumerator::SoALexicographicEnumerator",
44 KernelVariant.BatchedAoSHeap:
"::exahype2::enumerator::AoSLexicographicEnumerator",
45 KernelVariant.BatchedAoSoAHeap:
"::exahype2::enumerator::AoSoALexicographicEnumerator",
46 KernelVariant.BatchedSoAHeap:
"::exahype2::enumerator::SoALexicographicEnumerator",
47 KernelVariant.TaskGraphAoSHeap:
"::exahype2::enumerator::AoSLexicographicEnumerator",
48 KernelVariant.TaskGraphAoSoAHeap:
"::exahype2::enumerator::AoSoALexicographicEnumerator",
49 KernelVariant.TaskGraphSoAHeap:
"::exahype2::enumerator::SoALexicographicEnumerator",
52 template = KernelCalls[kernel_variant]
54 if solver_variant == SolverVariant.WithVirtualFunctions:
55 template +=
"""_functors(
57 {{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}},
59 {{NUMBER_OF_UNKNOWNS}},
60 {{NUMBER_OF_AUXILIARY_VARIABLES}},
62 {% if FLUX_IMPLEMENTATION=="<none>" %} false {% else %} true {% endif %},
63 {% if NCP_IMPLEMENTATION=="<none>" %} false {% else %} true {% endif %},
64 {% if SOURCE_IMPLEMENTATION=="<none>" %} false {% else %} true {% endif %},
65 false, // Runge-Kutta, so no need to copy old data over or to take dt into account
66 ::exahype2::fd::fd4::DifferentialSourceTermVariant::CentralDifferencesWithLopsidedAdvection,
68 const double * __restrict__ Q,
69 const tarch::la::Vector<Dimensions,double>& faceCentre,
70 const tarch::la::Vector<Dimensions,double>& volumeH,
74 double * __restrict__ F
76 {% if FLUX_IMPLEMENTATION!="<none>" %}
77 repositories::{{SOLVER_INSTANCE}}.flux( Q, faceCentre, volumeH, t, dt, normal, F );
81 const double * __restrict__ Q,
82 const double * __restrict__ deltaQ,
83 const tarch::la::Vector<Dimensions,double>& faceCentre,
84 const tarch::la::Vector<Dimensions,double>& volumeH,
88 double * __restrict__ BTimesDeltaQ
90 {% if NCP_IMPLEMENTATION!="<none>" %}
91 repositories::{{SOLVER_INSTANCE}}.nonconservativeProduct( Q, deltaQ, faceCentre, volumeH, t, dt, normal, BTimesDeltaQ );
95 const double * __restrict__ Q,
96 const tarch::la::Vector<Dimensions,double>& volumeX,
97 const tarch::la::Vector<Dimensions,double>& volumeH,
100 double * __restrict__ S
102 {% if SOURCE_IMPLEMENTATION!="<none>" %}
103 repositories::{{SOLVER_INSTANCE}}.sourceTerm( Q, volumeX, volumeH, t, dt, S );
108 elif solver_variant == SolverVariant.Stateless:
109 template +=
"""_static_calls<{{SOLVER_NAME}},{{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}},{{HALO_SIZE}}, {{NUMBER_OF_UNKNOWNS}}, {{NUMBER_OF_AUXILIARY_VARIABLES}}, {{TEMP_DATA_ENUMERATOR}}>(
112 {% if FLUX_IMPLEMENTATION=="<none>" %} false {% else %} true {% endif %},
113 {% if NCP_IMPLEMENTATION=="<none>" %} false {% else %} true {% endif %},
114 {% if SOURCE_IMPLEMENTATION=="<none>" %} false {% else %} true {% endif %},
115 false, // Runge-Kutta, so no need to copy old data over or to take dt into account
116 ::exahype2::fd::fd4::DifferentialSourceTermVariant::CentralDifferencesWithLopsidedAdvection
119 elif solver_variant == SolverVariant.Multicore:
120 template +=
"""_multicore_static_calls<{{SOLVER_NAME}},{{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}},{{HALO_SIZE}}, {{NUMBER_OF_UNKNOWNS}}, {{NUMBER_OF_AUXILIARY_VARIABLES}}, {{TEMP_DATA_ENUMERATOR}}>(
123 {% if FLUX_IMPLEMENTATION=="<none>" %} false {% else %} true {% endif %},
124 {% if NCP_IMPLEMENTATION=="<none>" %} false {% else %} true {% endif %},
125 {% if SOURCE_IMPLEMENTATION=="<none>" %} false {% else %} true {% endif %},
126 false, // Runge-Kutta, so no need to copy old data over or to take dt into account
127 ::exahype2::fd::fd4::DifferentialSourceTermVariant::CentralDifferencesWithLopsidedAdvection
130 elif solver_variant == SolverVariant.AcceleratorWithExplicitCopy:
131 template +=
"""_static_calls<{{SOLVER_NAME}},{{NUMBER_OF_GRID_CELLS_PER_PATCH_PER_AXIS}},{{HALO_SIZE}}, {{NUMBER_OF_UNKNOWNS}}, {{NUMBER_OF_AUXILIARY_VARIABLES}}, {{TEMP_DATA_ENUMERATOR}}>(
135 {% if FLUX_IMPLEMENTATION=="<none>" %} false {% else %} true {% endif %},
136 {% if NCP_IMPLEMENTATION=="<none>" %} false {% else %} true {% endif %},
137 {% if SOURCE_IMPLEMENTATION=="<none>" %} false {% else %} true {% endif %},
138 false, // Runge-Kutta, so no need to copy old data over or to take dt into account
139 ::exahype2::fd::fd4::DifferentialSourceTermVariant::CentralDifferencesWithLopsidedAdvection
143 assert False,
"not supported combination: {} x {}".format( solver_variant, kernel_variant )
145 result = jinja2.Template( template, undefined=jinja2.DebugUndefined)
147 d[
"FLUX_IMPLEMENTATION" ] = flux_implementation
148 d[
"NCP_IMPLEMENTATION" ] = ncp_implementation
149 d[
"SOURCE_IMPLEMENTATION" ] = source_implementation
150 d[
"COMPUTE_MAX_EIGENVALUE" ] = compute_max_eigenvalue_of_next_time_step
151 d[
"KOSIGMA" ] = KOSigma
152 d[
"TEMP_DATA_ENUMERATOR" ] = EnumeratorTemplateTypes[kernel_variant]
153 return result.render(**d)
create_compute_kernel_for_FD4(flux_implementation, ncp_implementation, source_implementation, compute_max_eigenvalue_of_next_time_step, solver_variant, kernel_variant, KOSigma)
I return only the unqualified function call, i.e.