3 import sys, os, argparse
4 import peano4, exahype2
6 sys.path.insert(0, os.path.abspath(
"../../../../tests/exahype2/aderdg"))
9 available_scenarios = {
19 parser = argparse.ArgumentParser(
20 description=
"ExaHyPE 2 - ADER-DG Kernel Benchmarking Script"
24 choices=peano4.output.CompileModes,
25 default=peano4.output.CompileModes[0],
26 help=
"|".join(peano4.output.CompileModes),
29 "-t",
"--num-threads",
32 help=
"Number of launching threads",
38 help=
"Order of the underlying ADER-DG solver.",
43 default=[32, 64, 128, 256, 512, 1024, 2048],
44 help=
"Number of patches to study",
47 "-samples",
"--samples",
50 help=
"Number of samples per measurement",
56 help=
"Floating point accuracy to which the different kernel variants have to match (absolute). Pass in 0 to disable correctness check. Pass in values < 0 to use machine epsilon (default).",
61 help=
"Assess host kernels",
66 help=
"Assess device kernels",
71 help=
"Enable a floating-point exception handler.",
75 choices=[
"double",
"float",
"fp16",
"bf16"],
77 help=
"Precision in which the solver should be computed.",
81 choices=available_scenarios.keys(),
82 default=
"ElasticPlanarWaves",
83 help=
"Scenario which should be used as a base for the benchmarking",
86 args = parser.parse_args()
88 scenario = available_scenarios[args.scenario]
90 ader_solver = exahype2.solvers.aderdg.GlobalAdaptiveTimeStep(
93 unknowns=scenario._equation.num_unknowns,
94 auxiliary_variables=scenario._equation.num_auxiliary_variables,
97 time_step_relaxation=0.5
100 ader_solver.add_kernel_optimisations(
101 polynomials=exahype2.solvers.aderdg.Polynomials.Gauss_Legendre,
102 is_linear=scenario._equation.is_linear,
103 precision = args.precision
106 ader_solver.set_implementation(
107 initial_conditions=scenario.initial_conditions(),
108 boundary_conditions=scenario.boundary_conditions(),
109 max_eigenvalue=scenario._equation.eigenvalues(),
110 flux=scenario._equation.flux(),
111 ncp=scenario._equation.ncp(),
112 riemann_solver=scenario._equation.riemann_solver(),
115 project = exahype2.Project(
116 namespace=[
"benchmarks",
"exahype2",
"kernelbenchmarks"],
117 project_name=
"KernelBenchmarks",
119 executable=
"KernelBenchmarks",
121 project.add_solver(ader_solver)
123 project.set_global_simulation_parameters(
129 first_plot_time_stamp=0.0,
130 time_in_between_plots=0.0,
131 periodic_BC=[
False,
False]
134 project.set_Peano4_installation(
"../../../../", mode=peano4.output.string_to_mode(args.build_mode))
135 project = project.generate_Peano4_project(verbose=
False)
137 accuracy = args.accuracy
140 accuracy = default = numpy.finfo(float).eps
141 project.constants.export_constexpr_with_type(
"Accuracy",
str(accuracy),
"double")
143 project.constants.export_constexpr_with_type(
"NumberOfSamples",
str(args.samples),
"int")
145 formatted_num_cells =
"{{{}}}".format(
", ".join(
str(val)
for val
in args.num_cells))
146 project.constants.export_const_with_type(
"NumberOfCellsToStudy",
str(formatted_num_cells),
"tarch::la::Vector<%s, int>" % len(args.num_cells))
148 project.constants.export_constexpr_with_type(
"NumberOfLaunchingThreads",
str(args.num_threads),
"int")
151 project.constants.export_boolean(
"EnableFPE",
True)
153 project.constants.export_boolean(
"EnableFPE",
False)
155 if args.cpu ==
False and args.gpu ==
False:
156 project.constants.export_boolean(
"AssessHostKernels",
True)
157 project.constants.export_boolean(
"AssessDeviceKernels",
True)
159 project.constants.export_boolean(
"AssessHostKernels",
True if args.cpu
else False)
160 project.constants.export_boolean(
"AssessDeviceKernels",
True if args.gpu
else False)
162 project.output.makefile.add_cpp_file(
"KernelBenchmarks-main.cpp")
163 project.build(make=
True, make_clean_first=
True, throw_away_data_after_build=
True)
Scenario reproduced from Dumbser & Käser, https://doi.org/10.1111/j.1365-246X.2006....
Very simple scenario in which the initial value of x is shifted in each spatial dimension.
Scenario reproduced from Dumbser & Käser, https://doi.org/10.1111/j.1365-246X.2006....
Scenario reproduced from Ioratti, Dumbser & Loubère, https://doi.org/10.1007/s10915-020-01209-w (p.
Scenario reproduced from Ioratti, Dumbser & Loubère, https://doi.org/10.1007/s10915-020-01209-w (p.
Classic radial dam break SWE equations, with constant initial water height but a bump in the bathymet...
Resting lake scenario for the shallow water equations.