Skip to content

Commit c88253e

Browse files
committed
IGR Perf test and --case-optimization fix
1 parent 49a9abd commit c88253e

File tree

7 files changed

+327
-13
lines changed

7 files changed

+327
-13
lines changed

asdf.out

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
cases:
2+
5eq_rk3_weno3_hllc:
3+
description:
4+
args: []
5+
path: /Users/benwilfong/Documents/software/MFC-Wilfong/benchmarks/5eq_rk3_weno3_hllc/case.py
6+
slug: 5eq_rk3_weno3_hllc
7+
output_summary:
8+
invocation:
9+
- run
10+
- /Users/benwilfong/Documents/software/MFC-Wilfong/benchmarks/5eq_rk3_weno3_hllc/case.py
11+
- --case-optimization
12+
- --targets
13+
- pre_process
14+
- simulation
15+
- post_process
16+
- --output-summary
17+
- /Users/benwilfong/Documents/software/MFC-Wilfong/build/benchmarks/c8a2/5eq_rk3_weno3_hllc.yaml
18+
- --
19+
- --gbpp
20+
- '1'
21+
lock:
22+
debug: false
23+
gcov: false
24+
gpu: false
25+
mpi: true
26+
single: false
27+
unified: false
28+
post_process:
29+
exec: 0.592117
30+
pre_process:
31+
exec: 0.402921
32+
simulation:
33+
exec: 215.207934
34+
grind: 118.67668406
35+
syscheck:
36+
exec: 0.1151349
37+
hypo_hll:
38+
description:
39+
args: []
40+
path: /Users/benwilfong/Documents/software/MFC-Wilfong/benchmarks/hypo_hll/case.py
41+
slug: hypo_hll
42+
output_summary:
43+
invocation:
44+
- run
45+
- /Users/benwilfong/Documents/software/MFC-Wilfong/benchmarks/hypo_hll/case.py
46+
- --case-optimization
47+
- --targets
48+
- pre_process
49+
- simulation
50+
- post_process
51+
- --output-summary
52+
- /Users/benwilfong/Documents/software/MFC-Wilfong/build/benchmarks/c8a2/hypo_hll.yaml
53+
- --
54+
- --gbpp
55+
- '1'
56+
lock:
57+
debug: false
58+
gcov: false
59+
gpu: false
60+
mpi: true
61+
single: false
62+
unified: false
63+
post_process:
64+
exec: 1.091427
65+
pre_process:
66+
exec: 7.7353782
67+
simulation:
68+
exec: 356.7857739
69+
grind: 106.48048228
70+
syscheck:
71+
exec: 0.097403
72+
ibm:
73+
description:
74+
args: []
75+
path: /Users/benwilfong/Documents/software/MFC-Wilfong/benchmarks/ibm/case.py
76+
slug: ibm
77+
output_summary:
78+
invocation:
79+
- run
80+
- /Users/benwilfong/Documents/software/MFC-Wilfong/benchmarks/ibm/case.py
81+
- --case-optimization
82+
- --targets
83+
- pre_process
84+
- simulation
85+
- post_process
86+
- --output-summary
87+
- /Users/benwilfong/Documents/software/MFC-Wilfong/build/benchmarks/c8a2/ibm.yaml
88+
- --
89+
- --gbpp
90+
- '1'
91+
lock:
92+
debug: false
93+
gcov: false
94+
gpu: false
95+
mpi: true
96+
single: false
97+
unified: false
98+
post_process:
99+
exec: 0.9278543
100+
pre_process:
101+
exec: 0.365302
102+
simulation:
103+
exec: 233.177713
104+
grind: 128.26678356
105+
syscheck:
106+
exec: 0.109005
107+
igr:
108+
description:
109+
args: []
110+
path: /Users/benwilfong/Documents/software/MFC-Wilfong/benchmarks/igr/case.py
111+
slug: igr
112+
output_summary:
113+
invocation:
114+
- run
115+
- /Users/benwilfong/Documents/software/MFC-Wilfong/benchmarks/igr/case.py
116+
- --case-optimization
117+
- --targets
118+
- pre_process
119+
- simulation
120+
- post_process
121+
- --output-summary
122+
- /Users/benwilfong/Documents/software/MFC-Wilfong/build/benchmarks/c8a2/igr.yaml
123+
- --
124+
- --gbpp
125+
- '1'
126+
lock:
127+
debug: false
128+
gcov: false
129+
gpu: false
130+
mpi: true
131+
single: false
132+
unified: false
133+
post_process:
134+
exec: 1.4053141
135+
pre_process:
136+
exec: 0.328671
137+
simulation:
138+
exec: 139.296655
139+
grind: 146.50175509
140+
syscheck:
141+
exec: 0.108108
142+
viscous_weno5_sgb_acoustic:
143+
description:
144+
args: []
145+
path: /Users/benwilfong/Documents/software/MFC-Wilfong/benchmarks/viscous_weno5_sgb_acoustic/case.py
146+
slug: viscous_weno5_sgb_acoustic
147+
output_summary:
148+
invocation:
149+
- run
150+
- /Users/benwilfong/Documents/software/MFC-Wilfong/benchmarks/viscous_weno5_sgb_acoustic/case.py
151+
- --case-optimization
152+
- --targets
153+
- pre_process
154+
- simulation
155+
- post_process
156+
- --output-summary
157+
- /Users/benwilfong/Documents/software/MFC-Wilfong/build/benchmarks/c8a2/viscous_weno5_sgb_acoustic.yaml
158+
- --
159+
- --gbpp
160+
- '1'
161+
lock:
162+
debug: false
163+
gcov: false
164+
gpu: false
165+
mpi: true
166+
single: false
167+
unified: false
168+
post_process:
169+
exec: 0.5647798
170+
pre_process:
171+
exec: 0.350469
172+
simulation:
173+
exec: 325.867103
174+
grind: 373.63301096
175+
syscheck:
176+
exec: 0.1103339
177+
metadata:
178+
invocation:
179+
- bench
180+
- -j
181+
- '8'
182+
- -o
183+
- asdf.out
184+
lock:
185+
debug: false
186+
gcov: false
187+
gpu: false
188+
mpi: true
189+
single: false
190+
unified: false

benchmarks/igr/case.py

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#!/usr/bin/env python3
2+
# Benchmark igr_T_viscous_T
3+
# Additional Benchmarked Features
4+
# - igr : T
5+
# - viscous : T
6+
# - igr_order : 5
7+
8+
import json, math, argparse
9+
10+
parser = argparse.ArgumentParser(prog="Benchmarking Case 5", description="This MFC case was created for the purposes of benchmarking MFC.", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
11+
12+
parser.add_argument("--mfc", type=json.loads, default="{}", metavar="DICT", help="MFC's toolchain's internal state.")
13+
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.")
14+
15+
ARGS = vars(parser.parse_args())
16+
DICT = ARGS["mfc"]
17+
18+
size = 1 if DICT["gpu"] else 0
19+
20+
ppg = 8000000 / 16.0
21+
procs = DICT["nodes"] * DICT["tasks_per_node"]
22+
ncells = math.floor(ppg * procs * ARGS["gbpp"])
23+
s = math.floor((ncells) ** (1 / 3))
24+
Nx, Ny, Nz = s, s, s
25+
26+
Re = 1600
27+
L = 1
28+
P0 = 101325
29+
rho0 = 1
30+
C0 = math.sqrt(1.4 * P0)
31+
V0 = 0.1 * C0
32+
mu = V0 * L / Re
33+
34+
cfl = 0.5
35+
dx = 2 * math.pi * L / (Nx + 1)
36+
37+
dt = cfl * dx / (C0)
38+
39+
tC = L / V0
40+
tEnd = 20 * tC
41+
42+
Nt = int(tEnd / dt)
43+
44+
# Configuring case dictionary
45+
print(
46+
json.dumps(
47+
{
48+
# Logistics
49+
"run_time_info": "T",
50+
# Computational Domain Parameters
51+
"x_domain%beg": -math.pi * L,
52+
"x_domain%end": math.pi * L,
53+
"y_domain%beg": -math.pi * L,
54+
"y_domain%end": math.pi * L,
55+
"z_domain%beg": -math.pi * L,
56+
"z_domain%end": math.pi * L,
57+
"m": Nx,
58+
"n": Ny,
59+
"p": Nz,
60+
"cyl_coord": "F",
61+
"dt": dt,
62+
"t_step_start": 0,
63+
"t_step_stop": int(20 * (95 * size + 5)),
64+
"t_step_save": int(20 * (95 * size + 5)),
65+
# Simulation Algorithm Parameters
66+
"num_patches": 1,
67+
"model_eqns": 2,
68+
"num_fluids": 1,
69+
"time_stepper": 3,
70+
"bc_x%beg": -1,
71+
"bc_x%end": -1,
72+
"bc_y%beg": -1,
73+
"bc_y%end": -1,
74+
"bc_z%beg": -1,
75+
"bc_z%end": -1,
76+
"igr": "T",
77+
"igr_order": 5,
78+
"igr_iter_solver": 1,
79+
"num_igr_iters": 3,
80+
"num_igr_warm_start_iters": 3,
81+
"alf_factor": 10,
82+
"viscous": "T",
83+
# Formatted Database Files Structure Parameters
84+
"format": 1,
85+
"precision": 2,
86+
"prim_vars_wrt": "T",
87+
"omega_wrt(1)": "T",
88+
"omega_wrt(2)": "T",
89+
"omega_wrt(3)": "T",
90+
"qm_wrt": "T",
91+
"fd_order": 4,
92+
"parallel_io": "T",
93+
# Patch 1: Background (AIR - 2)
94+
"patch_icpp(1)%geometry": 9,
95+
"patch_icpp(1)%x_centroid": 0,
96+
"patch_icpp(1)%y_centroid": 0,
97+
"patch_icpp(1)%z_centroid": 0,
98+
"patch_icpp(1)%length_x": 2 * math.pi * L,
99+
"patch_icpp(1)%length_y": 2 * math.pi * L,
100+
"patch_icpp(1)%length_z": 2 * math.pi * L,
101+
"patch_icpp(1)%vel(1)": f"{V0}*sin(x/{L})*cos(y/{L})*sin(z/{L})",
102+
"patch_icpp(1)%vel(2)": f"-{V0}*cos(x/{L})*sin(y/{L})*sin(z/{L})",
103+
"patch_icpp(1)%vel(3)": 0,
104+
"patch_icpp(1)%pres": f"{P0} + ({rho0}*{V0}**2/16)*(cos(2*x/{L}) + cos(2*y/{L}))*(cos(2*z/{L}) + 2)",
105+
"patch_icpp(1)%alpha_rho(1)": 1,
106+
"patch_icpp(1)%alpha(1)": 1,
107+
# Fluids Physical Parameters
108+
"fluid_pp(1)%gamma": 1.0e00 / (1.4 - 1),
109+
"fluid_pp(1)%pi_inf": 0,
110+
"fluid_pp(1)%Re(1)": 1 / mu,
111+
}
112+
)
113+
)

src/simulation/m_global_parameters.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ module m_global_parameters
123123
logical, parameter :: relativity = (${relativity}$ /= 0) !< Relativity (only for MHD)
124124
integer, parameter :: igr_iter_solver = ${igr_iter_solver}$ !< IGR elliptic solver
125125
integer, parameter :: igr_order = ${igr_order}$ !< Reconstruction order for IGR
126-
logical, parameter :: igr = (${igr}$ /= 0) !< use information geometric regularization
126+
logical, parameter :: igr = (${igr}$ /= 0) !< use information geometric regularization
127127
logical, parameter :: igr_pres_lim = (${igr_pres_lim}$ /= 0)!< Limit to positive pressures for IGR
128128
logical, parameter :: viscous = (${viscous}$ /= 0) !< Viscous effects
129129
#:else

src/simulation/m_sim_helpers.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pure subroutine s_compute_enthalpy(q_prim_vf, pres, rho, gamma, pi_inf, Re, H, a
7979
if (igr) then
8080
!$acc loop seq
8181
do i = 1, num_vels
82-
vel(i) = q_prim_vf(contxe + i)%sf(j, k, l)/rho
82+
vel(i) = q_prim_vf(contxe + i)%sf(j, k, l) / rho
8383
end do
8484
else
8585
!$acc loop seq

src/simulation/m_start_up.fpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,12 +1263,10 @@ contains
12631263
call acc_present_dump()
12641264
#endif
12651265

1266-
12671266
call s_initialize_mpi_common_module()
12681267
call s_initialize_mpi_proxy_module()
12691268
call s_initialize_variables_conversion_module()
12701269
if (grid_geometry == 3) call s_initialize_fftw_module()
1271-
if (.not. igr) call s_initialize_riemann_solvers_module()
12721270

12731271
if(bubbles_euler) call s_initialize_bubbles_EE_module()
12741272
if (ib) call s_initialize_ibm_module()
@@ -1322,15 +1320,19 @@ contains
13221320
! Computation of parameters, allocation of memory, association of pointers,
13231321
! and/or execution of any other tasks that are needed to properly configure
13241322
! the modules. The preparations below DO DEPEND on the grid being complete.
1325-
if (.not. igr) call s_initialize_weno_module()
1326-
if (igr) call s_initialize_igr_module()
1323+
if (igr) then
1324+
call s_initialize_igr_module()
1325+
else
1326+
call s_initialize_weno_module()
1327+
call s_initialize_cbc_module()
1328+
call s_initialize_riemann_solvers_module()
1329+
end if
13271330

13281331
#if defined(MFC_OpenACC) && defined(MFC_MEMORY_DUMP)
13291332
print *, "[MEM-INST] After: s_initialize_weno_module"
13301333
call acc_present_dump()
13311334
#endif
13321335

1333-
if (.not. igr) call s_initialize_cbc_module()
13341336
call s_initialize_derived_variables()
13351337
if (bubbles_lagrange) call s_initialize_bubbles_EL_module(q_cons_ts(1)%vf)
13361338

@@ -1463,12 +1465,13 @@ contains
14631465
call s_finalize_derived_variables_module()
14641466
call s_finalize_data_output_module()
14651467
call s_finalize_rhs_module()
1466-
if (.not. igr) then
1468+
if (igr) then
1469+
call s_finalize_igr_module()
1470+
else
14671471
call s_finalize_cbc_module()
14681472
call s_finalize_riemann_solvers_module()
14691473
call s_finalize_weno_module()
14701474
end if
1471-
if (igr) call s_finalize_igr_module()
14721475
call s_finalize_variables_conversion_module()
14731476
if (grid_geometry == 3) call s_finalize_fftw_module
14741477
call s_finalize_mpi_common_module()

toolchain/bench.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,11 @@
3535
path: benchmarks/hypo_hll/case.py
3636
args: []
3737

38+
# Benchmark igr_T_viscous_T
39+
# Additional Benchmarked Features
40+
# - igr : T
41+
# - viscous : T
42+
# - igr_order : 5
43+
- slug: igr
44+
path: benchmarks/igr/case.py
45+
args: []

0 commit comments

Comments
 (0)