|
1 | 1 | #!/usr/bin/env python3 |
2 | 2 |
|
3 | | -# Case file contributed by Anand Radhakrishnan and modified by Henry Le Berre |
4 | | -# for integration as a weak scaling benchmark for MFC. |
5 | | - |
6 | | -import json, math, argparse |
| 3 | +import sys, json, math, typing, argparse |
7 | 4 |
|
8 | 5 | parser = argparse.ArgumentParser( |
9 | | - prog="3D_weak_scaling", |
10 | | - description="This MFC case was created for the purposes of weak scaling.", |
| 6 | + prog="scaling", |
| 7 | + description="Weak- and strong-scaling benchmark case.", |
11 | 8 | formatter_class=argparse.ArgumentDefaultsHelpFormatter) |
12 | 9 |
|
13 | | -parser.add_argument("dict", type=str, metavar="DICT", help=argparse.SUPPRESS) |
14 | | -parser.add_argument("gbpp", type=int, metavar="MEM", default=16, help="Adjusts the problem size per rank to fit into [MEM] GB of GPU memory per GPU.") |
| 10 | +parser.add_argument("dict", type=str, metavar="DICT") |
| 11 | +parser.add_argument("-s", "--scaling", type=str, metavar="SCALING", choices=["weak", "strong"], help="Whether weak- or strong-scaling is being exercised.") |
| 12 | +parser.add_argument("-m", "--memory", type=int, metavar="MEMORY", help="Weak scaling: memory per rank in GB. Strong scaling: global memory in GB. Used to determine cell count.") |
| 13 | +parser.add_argument("-f", "--fidelity", type=str, metavar="FIDELITY", choices=["ideal", "exact"], default="ideal") |
| 14 | +parser.add_argument("--rdma_mpi", type=str, metavar="FIDELITY", choices=["T", "F"], default="F") |
| 15 | +parser.add_argument("--n-steps", type=int, metavar="N", default=None) |
| 16 | + |
| 17 | +args = parser.parse_args() |
| 18 | + |
| 19 | +if args.scaling is None: |
| 20 | + parser.print_help() |
| 21 | + sys.exit(1) |
| 22 | + |
| 23 | +DICT = json.loads(args.dict) |
15 | 24 |
|
16 | | -ARGS = vars(parser.parse_args()) |
17 | | -DICT = json.loads(ARGS["dict"]) |
| 25 | +# \approx The number of cells per GB of memory. The exact value is not important. |
| 26 | +cpg = 8000000 / 16.0 |
| 27 | +# Number of ranks. |
| 28 | +nranks = DICT["nodes"] * DICT["tasks_per_node"] |
18 | 29 |
|
19 | | -ppg = 8000000 / 16.0 |
20 | | -procs = DICT["nodes"] * DICT["tasks_per_node"] |
21 | | -ncells = math.floor(ppg * procs * ARGS["gbpp"]) |
22 | | -s = math.floor((ncells / 2.0) ** (1/3)) |
23 | | -Nx, Ny, Nz = 2*s, s, s |
| 30 | +def nxyz_from_ncells(ncells: float) -> typing.Tuple[int, int, int]: |
| 31 | + s = math.floor((ncells / 2.0) ** (1/3)) |
| 32 | + return 2*s, s, s |
24 | 33 |
|
25 | | -# athmospheric pressure - Pa (used as reference value) |
| 34 | +if args.scaling == "weak": |
| 35 | + if args.fidelity == "ideal": |
| 36 | + raise RuntimeError("ask ben") |
| 37 | + else: |
| 38 | + Nx, Ny, Nz = nxyz_from_ncells(cpg * nranks * args.memory) |
| 39 | +else: |
| 40 | + Nx, Ny, Nz = nxyz_from_ncells(cpg * args.memory) |
| 41 | + |
| 42 | +# Atmospheric pressure - Pa (used as reference value) |
26 | 43 | patm = 101325 |
27 | 44 |
|
28 | 45 | # Initial Droplet Diameter / Reference length - m |
|
162 | 179 | AS = int( NtA // SF + 1 ) |
163 | 180 |
|
164 | 181 | # Nt = total number of steps. Note that Nt >= NtA (so at least tendA is completely simulated) |
165 | | -Nt = AS * SF |
| 182 | +Nt = args.n_steps or (AS * SF) |
| 183 | +SF = min( SF, Nt ) |
166 | 184 |
|
167 | 185 | # total simulation time - s. Note that tend >= tendA |
168 | 186 | tend = Nt * dt |
|
171 | 189 | print(json.dumps({ |
172 | 190 | # Logistics ================================================ |
173 | 191 | 'run_time_info' : 'T', |
| 192 | + 'rdma_mpi' : args.rdma_mpi, |
174 | 193 | # ========================================================== |
175 | 194 |
|
176 | 195 | # Computational Domain Parameters ========================== |
|
186 | 205 | 'cyl_coord' : 'F', |
187 | 206 | 'dt' : dt, |
188 | 207 | 't_step_start' : 0, |
189 | | - 't_step_stop' : int(5000*16.0/ARGS["gbpp"]), |
190 | | - 't_step_save' : int(1000*16.0/ARGS["gbpp"]), |
| 208 | + 't_step_stop' : Nt, |
| 209 | + 't_step_save' : SF, |
191 | 210 | # ========================================================== |
192 | 211 |
|
193 | 212 | # Simulation Algorithm Parameters ========================== |
|
201 | 220 | 'time_stepper' : 3, |
202 | 221 | 'weno_order' : 3, |
203 | 222 | 'weno_eps' : 1.0E-16, |
204 | | - 'weno_Re_flux' : 'F', |
| 223 | + 'weno_Re_flux' : 'F', |
205 | 224 | 'weno_avg' : 'F', |
206 | 225 | 'mapped_weno' : 'T', |
207 | 226 | 'riemann_solver' : 2, |
|
283 | 302 | 'fluid_pp(2)%pi_inf' : gama*pia/(gama-1), |
284 | 303 | # ========================================================== |
285 | 304 | })) |
286 | | - |
287 | | -# ============================================================================== |
288 | | - |
|
0 commit comments