10import peano4.toolbox.particles
15from SBH
import KernelParallelisation
16from SBH
import Limiter
17from SBH
import FD4SolverWithLimiter
18from SBH
import FD4SolverWithoutLimiter
19from SBH
import FVSolver
24from CCZ4Solver
import CCZ4Solver_FV_GlobalAdaptiveTimeStepWithEnclaveTasking
25from CCZ4Solver
import CCZ4Solver_FD4_GlobalAdaptiveTimeStepWithEnclaveTasking
26from CCZ4Solver
import (
27 CCZ4Solver_FD4_SecondOrderFormulation_GlobalAdaptiveTimeStepWithEnclaveTasking,
30from CCZ4Solver
import CCZ4Solver_FV_GlobalAdaptiveTimeStep
31from CCZ4Solver
import CCZ4Solver_FD4_GlobalAdaptiveTimeStep
35if __name__ ==
"__main__":
36 parser = argparse.ArgumentParser(
37 description=
"ExaHyPE 2 - CCZ4-Performance studies benchmarking script"
45 help=
"Parallel builds",
51 default=
"../../../../",
52 help=
"Peano4 directory",
59 help=
"Executable name (output)",
75 help=
"End of simulation",
82 help=
"Number of trees (subpartitions) per rank",
90 help=
"Minimal cell size (AMR) or regular mesh cell size (without AMR), default=1.8",
92 parser.add_argument(
"-m",
"--mode", dest=
"mode", choices=peano4.output.CompileModes, default=peano4.output.CompileModes[0], help=
"|".join(peano4.output.CompileModes) )
107 help=
"Plot initial and final solution",
114 "native-no-priorities",
119 "subtasks-and-kernel-parallelisation",
122 help=
"Task scheduler flavours",
132 "fd4-rk1-limited-ps-3",
133 "fd4-rk1-limited-ps-6",
136 help=
"Pick solver type",
142 help=
"Do not compile the code after generation",
145 "--interpolation-method",
146 dest=
"interpolation_method",
147 help=
"Set method to interpolate between solvers",
150 args = parser.parse_args()
155 project = exahype2.Project(
156 [
"benchmarks",
"exahype2",
"ccz4"],
158 executable=args.output,
162 offset = [-9, -9, -9]
163 domain_size = [18, 18, 18]
166 max_cell_size = domain_size[0] / 3.0
168 max_cell_size = args.cell_size
173 if "limited" in args.solver:
174 if args.scheduler ==
"native-no-priorities":
175 project.set_multicore_orchestration(
176 "tarch::multicore::orchestration::Hardcoded::createNative()"
178 enable_higher_priority_for_FV_tasks =
False
179 parallelise_interpolation = KernelParallelisation.NONE
180 fv_kernel_parallelisation = KernelParallelisation.NONE
181 elif args.scheduler ==
"native":
182 project.set_multicore_orchestration(
183 "tarch::multicore::orchestration::Hardcoded::createNative()"
185 enable_higher_priority_for_FV_tasks =
True
186 parallelise_interpolation = KernelParallelisation.NONE
187 fv_kernel_parallelisation = KernelParallelisation.NONE
188 elif args.scheduler ==
"tailored":
189 project.set_multicore_orchestration(
190 "new benchmarks::exahype2::ccz4::MulticoreOrchestration()"
192 enable_higher_priority_for_FV_tasks =
True
193 parallelise_interpolation = KernelParallelisation.NONE
194 fv_kernel_parallelisation = KernelParallelisation.NONE
195 elif args.scheduler ==
"parallel-for":
196 project.set_multicore_orchestration(
197 "new benchmarks::exahype2::ccz4::MulticoreOrchestration()"
199 enable_higher_priority_for_FV_tasks =
True
200 parallelise_interpolation = KernelParallelisation.PARALLEL_FOR
201 fv_kernel_parallelisation = KernelParallelisation.NONE
202 elif args.scheduler ==
"subtasks":
203 project.set_multicore_orchestration(
204 "new benchmarks::exahype2::ccz4::MulticoreOrchestration()"
206 enable_higher_priority_for_FV_tasks =
True
207 parallelise_interpolation = KernelParallelisation.SUBTASKS
208 fv_kernel_parallelisation = KernelParallelisation.NONE
209 elif args.scheduler ==
"subtasks-and-kernel-parallelisation":
210 project.set_multicore_orchestration(
211 "new benchmarks::exahype2::ccz4::MulticoreOrchestration()"
213 enable_higher_priority_for_FV_tasks =
True
214 parallelise_interpolation = KernelParallelisation.SUBTASKS
215 fv_kernel_parallelisation = KernelParallelisation.SUBTASKS
217 assert False,
"not supported yet"
219 added_limiter =
False
220 if "fd4-rk1-ps-" in args.solver:
221 FD4PatchSize = int(args.solver[-1])
224 patch_size=FD4PatchSize,
225 min_cell_size=args.cell_size,
226 max_cell_size=max_cell_size,
228 project.add_solver(my_primary_solver)
229 added_limiter =
False
231 elif "fd4-rk1-limited-ps-" in args.solver:
232 FD4PatchSize = int(args.solver[-1])
235 patch_size=FD4PatchSize,
236 min_cell_size=args.cell_size,
237 max_cell_size=max_cell_size,
238 parallelisation_of_interpolation=parallelise_interpolation,
239 parallelisation_of_kernels=fv_kernel_parallelisation,
240 interpolation_method=args.interpolation_method,
245 patch_size=FD4PatchSize,
246 amend_priorities=enable_higher_priority_for_FV_tasks,
247 parallelisation_of_kernels=fv_kernel_parallelisation,
249 project.add_solver(my_primary_solver)
250 project.add_solver(my_secondary_solver)
252 elif "fv" in args.solver:
256 min_cell_size=args.cell_size,
257 max_cell_size=max_cell_size,
259 project.add_solver(my_primary_solver)
260 added_limiter =
False
263 raise "unknown solver type {}".format(args.solver)
270 plot_interval = args.end_time
274 project.set_global_simulation_parameters(
281 [
False,
False,
False],
285 project.set_output_path(
"./")
290 project.set_Peano4_installation(args.peanodir, peano4.output.string_to_mode(args.mode))
292 peano4_project = project.generate_Peano4_project(verbose=args.verbose)
294 my_primary_solver.add_makefile_parameters(
295 peano4_project,
"../../../../applications/exahype2/ccz4"
298 peano4_project.output.makefile.add_linker_flag(
"-lm -lgsl -lgslcblas")
299 peano4_project.output.makefile.add_cpp_file(
300 "../../../../applications/exahype2/ccz4/libtwopunctures/TP_Utilities.cpp"
302 peano4_project.output.makefile.add_cpp_file(
303 "../../../../applications/exahype2/ccz4/libtwopunctures/TP_Parameters.cpp"
305 peano4_project.output.makefile.add_cpp_file(
306 "../../../../applications/exahype2/ccz4/libtwopunctures/TP_Logging.cpp"
308 peano4_project.output.makefile.add_cpp_file(
309 "../../../../applications/exahype2/ccz4/libtwopunctures/TwoPunctures.cpp"
311 peano4_project.output.makefile.add_cpp_file(
312 "../../../../applications/exahype2/ccz4/libtwopunctures/CoordTransf.cpp"
314 peano4_project.output.makefile.add_cpp_file(
315 "../../../../applications/exahype2/ccz4/libtwopunctures/Equations.cpp"
317 peano4_project.output.makefile.add_cpp_file(
318 "../../../../applications/exahype2/ccz4/libtwopunctures/FuncAndJacobian.cpp"
320 peano4_project.output.makefile.add_cpp_file(
321 "../../../../applications/exahype2/ccz4/libtwopunctures/Newton.cpp"
324 peano4_project.output.makefile.add_cpp_file(
"MulticoreOrchestration.cpp")
328 peano4_project.output.makefile.add_CXX_flag(
"-DIncludeTwoPunctures")
330 peano4_project.output.makefile.add_CXX_flag(
"-DCoupleWithFV")
331 peano4_project.output.makefile.add_cpp_file(
"CCZ4SBH_FV.cpp")
332 peano4_project.output.makefile.add_h_file(
"CCZ4SBH_FV.h")
333 peano4_project.output.makefile.add_cpp_file(
"CCZ4SBH_FD4.cpp")
334 peano4_project.output.makefile.add_h_file(
"CCZ4SBH_FD4.h")
335 elif "fv" in args.solver:
336 peano4_project.output.makefile.add_CXX_flag(
"-DPureFV")
337 peano4_project.output.makefile.add_cpp_file(
"CCZ4SBH_FV.cpp")
338 peano4_project.output.makefile.add_h_file(
"CCZ4SBH_FV.h")
340 peano4_project.output.makefile.add_CXX_flag(
"-DPureFD4")
341 peano4_project.output.makefile.add_cpp_file(
"CCZ4SBH_FD4.cpp")
342 peano4_project.output.makefile.add_h_file(
"CCZ4SBH_FD4.h")
344 peano4_project.generate(throw_away_data_after_generation=
False)
345 peano4_project.build(
346 make=
not args.no_make, make_clean_first=
True, number_of_parallel_builds=args.j
4th order Finite Differences solver with a limiter
Construct 4th order Finite Differences solver without a limiter.
Construct the Finite Volume (limiter) scheme.