9from CCZ4Solver
import CCZ4Solver_FV_MUSCL_GlobalAdaptiveTimeStepWithEnclaveTasking
11parser = argparse.ArgumentParser(
12 description=
"ExaHyPE 2 - CCZ4 Finite Volume MUSCL-Hancock Kernel Benchmarking Script"
17 choices=peano4.api.output.CompileModes,
18 default=peano4.api.output.CompileModes[0],
19 help=
"|".join(peano4.api.output.CompileModes),
26 help=
"Number of launching threads",
33 help=
"Number of finite volumes per axis (dimension) per patch.",
39 default=[32, 64, 128, 256, 512, 1024, 2048],
41 help=
"Number of patches to study",
48 help=
"Number of samples per measurement",
55 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=
"Evaluate max. eigenvalue",
67 help=
"Assess host kernels",
73 help=
"Assess device kernels",
79 help=
"Enable a floating-point exception handler.",
85 help=
"Number of parallel builds to use",
93 help=
"Number of dimensions to use: 2 or 3",
95args = parser.parse_args()
98 name=
"FVMUSCLHancock",
99 patch_size=args.patch_size,
102 pde_terms_without_state=
True,
105project = exahype2.Project(
106 namespace=[
"benchmarks",
"exahype2",
"kernelbenchmarks"],
107 project_name=
"KernelBenchmarksFVMUSCLHancockDSL",
109 executable=f
"KernelBenchmarksFVMUSCLHancockDSL.{args.build_mode}",
111fv_muscl_solver.add_all_solver_constants()
112project.add_solver(fv_muscl_solver)
114project.set_global_simulation_parameters(
115 dimensions=args.dimensions,
116 size=[1.0] * args.dimensions,
117 offset=[0.0] * args.dimensions,
120 first_plot_time_stamp=0.0,
121 time_in_between_plots=0.0,
122 periodic_BC=[
False] * args.dimensions
125project.set_Peano4_installation(
"../../../../", mode=peano4.api.output.string_to_mode(args.build_mode))
126project = project.generate_Peano4_project(verbose=
True)
128accuracy = args.accuracy
131 accuracy = default = numpy.finfo(float).eps
132project.constants.export_constexpr_with_type(
"Accuracy", str(accuracy),
"double")
134project.constants.export_constexpr_with_type(
"NumberOfSamples", str(args.samples),
"int")
136formatted_num_patches =
"{{{}}}".format(
", ".join(str(val)
for val
in args.num_patches))
137project.constants.export_const_with_type(
"NumberOfPatchesToStudy", str(formatted_num_patches),
"tarch::la::Vector<%s, int>" % len(args.num_patches))
139project.constants.export_constexpr_with_type(
"NumberOfLaunchingThreads", str(args.num_threads),
"int")
142 project.constants.export_boolean(
"EnableFPE",
True)
144 project.constants.export_boolean(
"EnableFPE",
False)
146if args.cpu ==
False and args.gpu ==
False:
147 project.constants.export_boolean(
"AssessHostKernels",
True)
148 project.constants.export_boolean(
"AssessDeviceKernels",
True)
150 project.constants.export_boolean(
"AssessHostKernels",
True if args.cpu
else False)
151 project.constants.export_boolean(
"AssessDeviceKernels",
True if args.gpu
else False)
153project.constants.export_boolean(
"EvaluateFlux",
False)
154project.constants.export_boolean(
"EvaluateNonconservativeProduct",
True)
155project.constants.export_boolean(
"EvaluateSource",
False)
156project.constants.export_boolean(
"EvaluateMaximumEigenvalueAfterTimeStep",
True if args.eval_eig
else False)
158project.constants.define_value(
"GAMMA", str(1.0))
160benchmark_main_file =
"../../kernel-benchmarks/KernelBenchmarksFVMUSCLHancockDSL-main.cpp"
161os.system(
"cp {} KernelBenchmarksFVMUSCLHancockDSL-main.cpp".format(benchmark_main_file))
163project.output.makefile.add_CXX_flag(
"-DGRAV=9.81")
165fv_muscl_solver.add_makefile_parameters(
166 project,
"../../../../applications/exahype2/ccz4"
168project.generate(throw_away_data_after_generation=
False)
169project.build(make=
True, make_clean_first=
True, throw_away_data_after_build=
True, number_of_parallel_builds=args.j)
172print(fv_muscl_solver)
CCZ4 solver using finite volumes and global adaptive time stepping incl enclave tasking.