Skip to content

Commit

Permalink
More and Longer Benchmarks (#379)
Browse files Browse the repository at this point in the history
Co-authored-by: Spencer Bryngelson <[email protected]>
Co-authored-by: Ben Wilfong <[email protected]>
Co-authored-by: Henry LE BERRE <[email protected]>
  • Loading branch information
4 people authored Mar 25, 2024
1 parent 36d989f commit ddb3edd
Show file tree
Hide file tree
Showing 9 changed files with 644 additions and 53 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/phoenix/bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ if [ "$job_device" == "gpu" ]; then
device_opts="--gpu -g $gpu_ids"
fi

./mfc.sh bench -j $(nproc) -o "$job_slug.yaml" -- -c phoenix $device_opts -n $n_ranks
if ["$job_device" == "gpu"]; then
./mfc.sh bench --mem 8 -j $(nproc) -o "$job_slug.yaml" -- -c phoenix $device_opts -n $n_ranks
else
./mfc.sh bench --mem 1 -j $(nproc) -o "$job_slug.yaml" -- -c phoenix $device_opts -n $n_ranks
fi
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,26 @@ examples/*/*.err
examples/*/viz/
examples/*.jpg
examples/*.png

benchmarks/*batch/*/
benchmarks/*/D/*
benchmarks/*/p*
benchmarks/*/D_*
benchmarks/*/*.inf
benchmarks/*/*.inp
benchmarks/*/*.dat
benchmarks/*/*.o*
benchmarks/*/silo*
benchmarks/*/restart_data*
benchmarks/*/*.out
benchmarks/*/binary
benchmarks/*/fort.1
benchmarks/*/*.sh
benchmarks/*/*.err
benchmarks/*/viz/
benchmarks/*.jpg
benchmarks/*.png

*.mod

# Video Files
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
#!/usr/bin/env python3

import math
import json
# Benchmark model_equations_2_time_stepper_3_weno_order_3_riemann_solver_2
# Additional Benchmarked Features
# - model_equations : 2
# - time_stepper : 3
# - weno_order : 3
# - riemann_solver : 2

import json, math, argparse

parser = argparse.ArgumentParser(
prog="Benchmarking Case 1",
description="This MFC case was created for the purposes of benchmarking MFC.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)

parser.add_argument("dict", type=str, metavar="DICT", help=argparse.SUPPRESS)
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.")

ARGS = vars(parser.parse_args())
DICT = json.loads(ARGS["dict"])

size = 1 if DICT["gpu"] else 0

ppg = 8000000 / 16.0
procs = DICT["nodes"] * DICT["tasks_per_node"]
ncells = math.floor(ppg * procs * ARGS["gbpp"])
s = math.floor((ncells / 2.0) ** (1/3))
Nx, Ny, Nz = 2*s, s, s

# athmospheric pressure - Pa (used as reference value)
patm = 101325
Expand All @@ -13,10 +38,9 @@
CtD = 0.06

# cavity relative eccentricity (distance between radii)
ecc = 0.564
ecc = 0.564

# initial shock distance from the y axis. Note that the droplet center is located at y = 0.
# Thus, the distance from the shock to
# initial shock distance from the y axis. Note that the droplet center is located at y = 0. Thus, the distance from the shock to
# the droplet is about D0/8
ISD = 5.0/8 * D0

Expand All @@ -26,10 +50,10 @@
p0a = patm

# density - kg/m3
rho0a = 1.204
rho0a = 1.204

# gamma
gama = 1.40
gama = 1.40

# pi infinity - Pa
pia = 0
Expand All @@ -52,15 +76,15 @@
rho0w = 1000

# gama
gamw = 6.12
gamw = 6.12

# pi infty - Pa
piw = 3.43E+08

# speed of sound - m/s
c_w = math.sqrt( gamw * ( p0w + piw ) / rho0w )

# Shock Mach number of interest. Note that the post-shock properties can be defined in terms of either
# Shock Mach number of interest. Note that the post-shock properties can be defined in terms of either
# Min or psOp0a. Just comment/uncomment appropriatelly
Min = 2.4

Expand All @@ -71,7 +95,7 @@
# psOp0a = 4.5

# density
rhosOrho0a = ( 1 + ( gama + 1 ) / ( gama - 1) * psOp0a ) / ( ( gama + 1 ) / ( gama - 1) + psOp0a )
rhosOrho0a = ( 1 + ( gama + 1 ) / ( gama - 1) * psOp0a ) / ( ( gama + 1 ) / ( gama - 1) + psOp0a )

# Mach number of the shocked region - just a checker, as it must return "Min"
Ms = math.sqrt( ( gama + 1. ) / ( 2. * gama ) * ( psOp0a - 1. ) * ( p0a / ( p0a + pia ) ) + 1. )
Expand All @@ -88,7 +112,7 @@
rhos = rhosOrho0a * rho0a

# post shock speed of sound - m/s
c_s = math.sqrt( gama * (ps + pia) / rhos )
c_s = math.sqrt( gama * (ps + pia) / rhos )

# velocity at the post shock - m/s
vel = c_a/gama * (psOp0a - 1.) * p0a / ( p0a + pia ) / Ms
Expand All @@ -111,21 +135,12 @@
ze = 10 * D0

# Stretching factor, to make sure the domaing is sufficiently large after the mesh stretch
StF = 4.0

# number of elements into y direction
Ny = 100

# number of elements into z direction
Nz = 100

# number of elements into x direction
Nx = Ny * 2
StF = 4.0

# grid delta x if mesh were uniform in x direction - m. Note that I do not need a measure for dy
dx = ( xe - xb ) / Nx

# I calculating tend twice; first is an estimate, second is
# I calculate tend twice; first is an estimate, second is
# the actual value used. This is because I am getting errors in the
# post process part every time I approximate the actual Nt by an integer
# number (think of a smarter way).
Expand All @@ -137,12 +152,10 @@
# mismatches in simulation and post_process parts. Note that I wrote it this way so I have better control over the # of autosaves
tendA = ttilde * D0 / vel

# "CFL" number that I use to control both temporal and spatial discretizations, such that the ratio dx/dt remains constant for a given
# simulation
cfl = 0.05
cfl = 0.1

# time-step - s
dt = cfl * dx/ ss
dt = dx * cfl/ ss

# Save Frequency. Note that the number of autosaves will be SF + 1, as th IC (0.dat) is also saved
SF = 400
Expand Down Expand Up @@ -173,26 +186,14 @@
'y_domain%end' : ye,
'z_domain%beg' : zb,
'z_domain%end' : ze,
'stretch_x' : 'T',
'a_x' : 20,
'x_a' : -1.2 * D0,
'x_b' : 1.2 * D0,
'stretch_y' : 'T',
'a_y' : 20,
'y_a' : -0.0 * D0,
'y_b' : 1.2 * D0,
'stretch_z' : 'T',
'a_z' : 20,
'z_a' : -0.0 * D0,
'z_b' : 1.2 * D0,
'm' : Nx,
'n' : Ny,
'p' : Nz,
'cyl_coord' : 'F',
'dt' : dt,
't_step_start' : 0,
't_step_stop' : 100,
't_step_save' : 100,
't_step_stop' : int(60*(95*size + 5)),
't_step_save' : int(12*(95*size + 5)),
# ==========================================================

# Simulation Algorithm Parameters ==========================
Expand All @@ -211,7 +212,7 @@
'mapped_weno' : 'T',
'riemann_solver' : 2,
'wave_speeds' : 1,
'avg_state' : 2,
'avg_state' : 2,
'bc_x%beg' : -6,
'bc_x%end' : -6,
'bc_y%beg' : -2,
Expand All @@ -226,7 +227,7 @@
'prim_vars_wrt' :'T',
'parallel_io' :'T',
# ==========================================================
# I will use 1 for WATER properties, and 2 for AIR properties
# I will use 1 for WATER properties, and 2 for AIR properties
# Patch 1: Background (AIR - 2) =============================
'patch_icpp(1)%geometry' : 9,
'patch_icpp(1)%x_centroid' : (xb+xe) / 2 * StF,
Expand Down Expand Up @@ -280,7 +281,6 @@
'patch_icpp(3)%alpha(1)' : 1.0E+00,
'patch_icpp(3)%alpha(2)' : 0.0E+00,
# ==========================================================


# Fluids Physical Parameters ===============================
'fluid_pp(1)%gamma' : 1.0E+00/(gamw-1),
Expand All @@ -291,3 +291,4 @@
}))

# ==============================================================================

144 changes: 144 additions & 0 deletions benchmarks/hypo_hll/case.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
#!/usr/bin/env python3

# Benchmark hypoelasticity_T_riemann_solver_1
# Additional Benchmarked Features
# - hypoelasticity : T
# - riemann_solver : 1

import json, math, argparse

parser = argparse.ArgumentParser(
prog="Benchmarkin Case 3",
description="This MFC case was created for the purposes of benchmarking MFC.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)

parser.add_argument("dict", type=str, metavar="DICT", help=argparse.SUPPRESS)
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.")

ARGS = vars(parser.parse_args())
DICT = json.loads(ARGS["dict"])

size = 1 if DICT["gpu"] else 0

ppg = 8000000 / 16.0
procs = DICT["nodes"] * DICT["tasks_per_node"]
ncells = math.floor(ppg * procs * ARGS["gbpp"])
s = math.floor((ncells / 2.0) ** (1/3))
Nx, Ny, Nz = 2*s, s, s

Mu = 1.84E-05
gam_a = 1.4

D = 0.1

# Configuring case dictionary
print(json.dumps({
# Logistics ================================================================
'run_time_info' : 'T',
# ==========================================================================

# Computational Domain Parameters ==========================================
# x direction
'x_domain%beg' : -5*D,
'x_domain%end' : 5.0*D,
# y direction
'y_domain%beg' : -2.5*D,
'y_domain%end' : 2.5*D,
# z direction
'z_domain%beg' : -2.5*D,
'z_domain%end' : 2.5*D,

'cyl_coord' : 'F',
'm' : Nx,
'n' : Ny,
'p' : Nz,
'dt' : 1.0E-7,
't_step_start' : 0,
't_step_stop' : int(20*(45*size + 5)),
't_step_save' : int(4*(45*size + 5)),
# ==========================================================================

# Simulation Algorithm Parameters ==========================================
# Only one patches are necessary, the air tube
'num_patches' : 1,
# Use the 5 equation model
'model_eqns' : 2,
# 6 equations model does not need the K \div(u) term
'alt_soundspeed' : 'F',
# One fluids: air
'num_fluids' : 1,
# Advect both volume fractions
'adv_alphan' : 'T',
# No need to ensure the volume fractions sum to unity at the end of each
# time step
'mpp_lim' : 'F',
# Correct errors when computing speed of sound
'mixture_err' : 'T',
# Use TVD RK3 for time marching
'time_stepper' : 3,
# Reconstruct the primitive variables to minimize spurious
# Use WENO5
'weno_order' : 5,
'weno_eps' : 1.E-16,
'weno_Re_flux' : 'T',
'weno_avg' : 'T',
'avg_state' : 2,
'mapped_weno' : 'T',
'null_weights' : 'F',
'mp_weno' : 'T',
'riemann_solver' : 2,
'wave_speeds' : 1,
# We use ghost-cell extrapolation
'bc_x%beg' : -3,
'bc_x%end' : -3,
'bc_y%beg' : -3,
'bc_y%end' : -3,
'bc_z%beg' : -3,
'bc_z%end' : -3,
# Set IB to True and add 1 patch
'ib' : 'T',
'num_ibs' : 1,
# ==========================================================================

# Formatted Database Files Structure Parameters ============================
'format' : 1,
'precision' : 2,
'prim_vars_wrt' :'T',
'E_wrt' :'T',
'parallel_io' :'T',
# ==========================================================================

# Patch: Constant Tube filled with air =====================================
# Specify the cylindrical air tube grid geometry
'patch_icpp(1)%geometry' : 9,
'patch_icpp(1)%x_centroid' : 0.0,
# Uniform medium density, centroid is at the center of the domain
'patch_icpp(1)%y_centroid' : 0.0,
'patch_icpp(1)%z_centroid' : 0.0,
'patch_icpp(1)%length_x' : 10*D,
'patch_icpp(1)%length_y' : 5*D,
'patch_icpp(1)%length_z' : 5*D,
# Specify the patch primitive variables
'patch_icpp(1)%vel(1)' : 527.2E+00,
'patch_icpp(1)%vel(2)' : 0.0E+00,
'patch_icpp(1)%vel(3)' : 0.0E+00,
'patch_icpp(1)%pres' : 10918.2549,
'patch_icpp(1)%alpha_rho(1)' : 0.2199,
'patch_icpp(1)%alpha(1)' : 1.E+00,
# # ========================================================================

# Patch: Sphere Immersed Boundary ========================================
'patch_ib(1)%geometry' : 8,
'patch_ib(1)%x_centroid' : -3.0E-3,
'patch_ib(1)%y_centroid' : 0.0,
'patch_ib(1)%z_centroid' : 0.0,
'patch_ib(1)%radius' : D/2,
'patch_ib(1)%slip' : 'T',
# ==========================================================================

# Fluids Physical Parameters ===============================================
'fluid_pp(1)%gamma' : 1.E+00/(gam_a-1.E+00), # 2.50(Not 1.40)
'fluid_pp(1)%pi_inf' : 0,
'fluid_pp(1)%Re(1)' : 7535533.2,
# ==========================================================================
}))
Loading

0 comments on commit ddb3edd

Please sign in to comment.