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 choices=[
"linear",
"matrix",
"secondOrder"],
149 help=
"Set method to interpolate between solvers",
152 args = parser.parse_args()
157 project = exahype2.Project(
158 [
"benchmarks",
"exahype2",
"ccz4"],
160 executable=args.output,
164 offset = [-9, -9, -9]
165 domain_size = [18, 18, 18]
168 max_cell_size = domain_size[0] / 3.0
170 max_cell_size = args.cell_size
175 if "limited" in args.solver:
176 if args.scheduler ==
"native-no-priorities":
177 project.set_multicore_orchestration(
178 "tarch::multicore::orchestration::Hardcoded::createNative()"
180 enable_higher_priority_for_FV_tasks =
False
181 parallelise_interpolation = KernelParallelisation.NONE
182 fv_kernel_parallelisation = KernelParallelisation.NONE
183 elif args.scheduler ==
"native":
184 project.set_multicore_orchestration(
185 "tarch::multicore::orchestration::Hardcoded::createNative()"
187 enable_higher_priority_for_FV_tasks =
True
188 parallelise_interpolation = KernelParallelisation.NONE
189 fv_kernel_parallelisation = KernelParallelisation.NONE
190 elif args.scheduler ==
"tailored":
191 project.set_multicore_orchestration(
192 "new benchmarks::exahype2::ccz4::MulticoreOrchestration()"
194 enable_higher_priority_for_FV_tasks =
True
195 parallelise_interpolation = KernelParallelisation.NONE
196 fv_kernel_parallelisation = KernelParallelisation.NONE
197 elif args.scheduler ==
"parallel-for":
198 project.set_multicore_orchestration(
199 "new benchmarks::exahype2::ccz4::MulticoreOrchestration()"
201 enable_higher_priority_for_FV_tasks =
True
202 parallelise_interpolation = KernelParallelisation.PARALLEL_FOR
203 fv_kernel_parallelisation = KernelParallelisation.NONE
204 elif args.scheduler ==
"subtasks":
205 project.set_multicore_orchestration(
206 "new benchmarks::exahype2::ccz4::MulticoreOrchestration()"
208 enable_higher_priority_for_FV_tasks =
True
209 parallelise_interpolation = KernelParallelisation.SUBTASKS
210 fv_kernel_parallelisation = KernelParallelisation.NONE
211 elif args.scheduler ==
"subtasks-and-kernel-parallelisation":
212 project.set_multicore_orchestration(
213 "new benchmarks::exahype2::ccz4::MulticoreOrchestration()"
215 enable_higher_priority_for_FV_tasks =
True
216 parallelise_interpolation = KernelParallelisation.SUBTASKS
217 fv_kernel_parallelisation = KernelParallelisation.SUBTASKS
219 assert False,
"not supported yet"
221 added_limiter =
False
222 if "fd4-rk1-ps-" in args.solver:
223 FD4PatchSize = int(args.solver[-1])
226 patch_size=FD4PatchSize,
227 min_cell_size=args.cell_size,
228 max_cell_size=max_cell_size,
230 project.add_solver(my_primary_solver)
231 added_limiter =
False
233 elif "fd4-rk1-limited-ps-" in args.solver:
234 FD4PatchSize = int(args.solver[-1])
237 patch_size=FD4PatchSize,
238 min_cell_size=args.cell_size,
239 max_cell_size=max_cell_size,
240 parallelisation_of_interpolation=parallelise_interpolation,
241 parallelisation_of_kernels=fv_kernel_parallelisation,
242 interpolation_method=args.interpolation_method,
247 patch_size=FD4PatchSize,
248 amend_priorities=enable_higher_priority_for_FV_tasks,
249 parallelisation_of_kernels=fv_kernel_parallelisation,
251 project.add_solver(my_primary_solver)
252 project.add_solver(my_secondary_solver)
254 elif "fv" in args.solver:
258 min_cell_size=args.cell_size,
259 max_cell_size=max_cell_size,
261 project.add_solver(my_primary_solver)
262 added_limiter =
False
265 raise "unknown solver type {}".format(args.solver)
272 plot_interval = args.end_time
276 project.set_global_simulation_parameters(
283 [
False,
False,
False],
287 project.set_output_path(
"./")
289 project.set_build_mode(peano4.output.string_to_mode(args.mode))
291 peano4_project = project.generate_Peano4_project(verbose=args.verbose)
293 my_primary_solver.add_makefile_parameters(
294 peano4_project,
"../../../../applications/ccz4"
297 peano4_project.output.makefile.add_linker_flag(
"-lm -lgsl -lgslcblas")
298 peano4_project.output.makefile.add_cpp_file(
299 "../../../../applications/ccz4/libtwopunctures/TP_Utilities.cpp"
301 peano4_project.output.makefile.add_cpp_file(
302 "../../../../applications/ccz4/libtwopunctures/TP_Parameters.cpp"
304 peano4_project.output.makefile.add_cpp_file(
305 "../../../../applications/ccz4/libtwopunctures/TP_Logging.cpp"
307 peano4_project.output.makefile.add_cpp_file(
308 "../../../../applications/ccz4/libtwopunctures/TwoPunctures.cpp"
310 peano4_project.output.makefile.add_cpp_file(
311 "../../../../applications/ccz4/libtwopunctures/CoordTransf.cpp"
313 peano4_project.output.makefile.add_cpp_file(
314 "../../../../applications/ccz4/libtwopunctures/Equations.cpp"
316 peano4_project.output.makefile.add_cpp_file(
317 "../../../../applications/ccz4/libtwopunctures/FuncAndJacobian.cpp"
319 peano4_project.output.makefile.add_cpp_file(
320 "../../../../applications/ccz4/libtwopunctures/Newton.cpp"
323 peano4_project.output.makefile.add_cpp_file(
"MulticoreOrchestration.cpp")
327 peano4_project.output.makefile.add_CXX_flag(
"-DIncludeTwoPunctures")
329 peano4_project.output.makefile.add_CXX_flag(
"-DCoupleWithFV")
330 peano4_project.output.makefile.add_cpp_file(
"CCZ4SBH_FV.cpp")
331 peano4_project.output.makefile.add_h_file(
"CCZ4SBH_FV.h")
332 peano4_project.output.makefile.add_cpp_file(
"CCZ4SBH_FD4.cpp")
333 peano4_project.output.makefile.add_h_file(
"CCZ4SBH_FD4.h")
334 elif "fv" in args.solver:
335 peano4_project.output.makefile.add_CXX_flag(
"-DPureFV")
336 peano4_project.output.makefile.add_cpp_file(
"CCZ4SBH_FV.cpp")
337 peano4_project.output.makefile.add_h_file(
"CCZ4SBH_FV.h")
339 peano4_project.output.makefile.add_CXX_flag(
"-DPureFD4")
340 peano4_project.output.makefile.add_cpp_file(
"CCZ4SBH_FD4.cpp")
341 peano4_project.output.makefile.add_h_file(
"CCZ4SBH_FD4.h")
343 peano4_project.generate(throw_away_data_after_generation=
False)
344 peano4_project.build(
345 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.