flow 1.3.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
Loading...
Searching...
No Matches
prof Namespace Reference

Classes

class  _Shim
 

Functions

 arg (name, default, cast=str)
 
 one (timed)
 

Variables

 A = list(sys.argv)
 
 CASE_DIR
 
 CKPT
 
 N = int(A[1])
 
str TIMING = "--timing" in A
 
 FLUX = arg("--flux", "python")
 
 DUMP = arg("--dump", None)
 
 WARM = arg("--warm", 5, int)
 
 FIXDT = arg("--fixdt", None, float)
 
 RTOL = arg("--rtol", 1e-10, float)
 
 step
 
 t
 
 blocks
 
 vel
 
 pres
 
 series
 
 t_b = time.time()
 
 _dummy = _pf.Solver(arg("--dummy", 17, int), 13, 11)
 
 _L = arg("--levels", 4, int)
 
 _orig = rp.pf.Solver
 
 Solver
 
 set_superficial_velocity
 
 s = rp.build(blocks)
 
str DIV = "--div" in A
 
list divs = []
 
str STATS = "--stats" in A
 
dict stats = {k: [] for k in ("volume", "area", "centroid", "velocity", "moments")}
 
 flush
 
 S = rp.S
 
float dtsafe = 0.25
 
list iters = []
 
dict T = {"limits": 0.0, "step": 0.0, "flux": 0.0}
 
 w0 = time.perf_counter()
 
list dts = [one(True) for _ in range(N)]
 
 wall = time.perf_counter() - w0
 
 v = s.diagnostics.vof_timing()
 
 n = v["steps"]
 
dict cols
 
 u
 
 w
 
 p
 
 C
 

Detailed Description

Profile the bubble-column step from a checkpoint (the VoF step-performance harness, WO-0).

The case is the bubble column of peclet-examples (128 x 96 x 64, 16 VoF block markers, rho/mu
ratio 0.02, set_superficial_velocity), built by that repo's run_peclet.build() and restarted from
ckpt_t43.npz. It runs W warm-up steps (not timed), then N timed steps with the driver's per-step
protocol (dt = 0.25 min(cfl_dt, capillary_dt) from vof_step_limits()). See
doc/vof_step_performance_design.md (sec. 7 WO-0, sec. 8 G-BIT / G-NUM / G-PERF).

Usage:
    PYTHONPATH=<flow build> OMP_NUM_THREADS=8 OMP_PROC_BIND=false \\
        python tests/study/vof_perf/prof.py N [--pcg [--rtol R]] [--timing] [--dump out.npz]
            [--warm W] [--flux device|python|none] [--levels L] [--bottom MODE] [--fixdt DT]
            [--ckpt PATH] [--case-dir DIR] [--dummy N]

    --ckpt      checkpoint (default ~/Codes/bubble_column_perf/ckpt_t43.npz)
    --case-dir  directory holding run_peclet.py + case.py (default:
                ~/Codes/peclet-examples/benchmarks/bubble-column/scripts)
    --pcg       MG-PCG pressure with cap 800 and relative tolerance --rtol (default 1e-10)
    --cheb      Chebyshev pressure (cap --cheb-maxit, default 120) at --rtol; prints the
                solver's num_pressure_chebyshev_restarts when the build has it (D3, §5.13)
    --dump      save u, v, w, p, C, the timed steps' dt and pressure iterations (iters) and every
                VoF block's colour array (col<id>) -- compare two dumps with cmp.py (G-BIT item 2)
    --timing    per-stage breakdown from diagnostics.vof_timing()
    --levels L  pressure multigrid depth; --bottom MODE = set_pressure_bottom(MODE) (E1)
    --bottom-solver ENGINE  diagnostics.set_pressure_bottom_solver(ENGINE): auto | direct |
                algebraic (§13: the A/B of the two bottom engines on one build)
    --div       with --dump: also store each timed step's max_open_divergence_projected() (div),
                read after the step (G-NUM item 3)
    --stats     with --dump: also store every timed step's measured block statistics (st_volume,
                st_area, st_centroid, st_velocity, st_moments; WO-9's gate, C2 §5.10)

Function Documentation

◆ arg()

prof.arg (   name,
  default,
  cast = str 
)

Definition at line 42 of file prof.py.

References Solver.

◆ one()

prof.one (   timed)

Definition at line 109 of file prof.py.

References one(), and Solver.

Referenced by one().

Variable Documentation

◆ A

prof.A = list(sys.argv)

Definition at line 39 of file prof.py.

◆ CASE_DIR

prof.CASE_DIR
Initial value:
1= arg("--case-dir", os.path.expanduser(
2 "~/Codes/peclet-examples/benchmarks/bubble-column/scripts"))

Definition at line 46 of file prof.py.

◆ CKPT

prof.CKPT
Initial value:
1= arg("--ckpt", os.path.expanduser(
2 "~/Codes/bubble_column_perf/ckpt_t43.npz"))

Definition at line 48 of file prof.py.

◆ N

prof.N = int(A[1])

Definition at line 53 of file prof.py.

◆ TIMING

str prof.TIMING = "--timing" in A

Definition at line 54 of file prof.py.

◆ FLUX

prof.FLUX = arg("--flux", "python")

Definition at line 55 of file prof.py.

◆ DUMP

prof.DUMP = arg("--dump", None)

Definition at line 56 of file prof.py.

◆ WARM

prof.WARM = arg("--warm", 5, int)

Definition at line 57 of file prof.py.

◆ FIXDT

prof.FIXDT = arg("--fixdt", None, float)

Definition at line 58 of file prof.py.

◆ RTOL

prof.RTOL = arg("--rtol", 1e-10, float)

Definition at line 59 of file prof.py.

◆ step

prof.step

Definition at line 61 of file prof.py.

◆ t

prof.t

Definition at line 61 of file prof.py.

◆ blocks

prof.blocks

Definition at line 61 of file prof.py.

◆ vel

prof.vel

Definition at line 61 of file prof.py.

◆ pres

prof.pres

Definition at line 61 of file prof.py.

◆ series

prof.series

Definition at line 61 of file prof.py.

◆ t_b

prof.t_b = time.time()

Definition at line 62 of file prof.py.

◆ _dummy

prof._dummy = _pf.Solver(arg("--dummy", 17, int), 13, 11)
protected

Definition at line 65 of file prof.py.

◆ _L

prof._L = arg("--levels", 4, int)
protected

Definition at line 68 of file prof.py.

◆ _orig

prof._orig = rp.pf.Solver
protected

Definition at line 69 of file prof.py.

Referenced by prof._Shim.__new__().

◆ Solver

prof.Solver

Definition at line 76 of file prof.py.

Referenced by prof._Shim.__new__(), arg(), and one().

◆ set_superficial_velocity

prof.set_superficial_velocity

Definition at line 78 of file prof.py.

◆ s

prof.s = rp.build(blocks)

Definition at line 79 of file prof.py.

◆ DIV

str prof.DIV = "--div" in A

Definition at line 97 of file prof.py.

◆ divs

list prof.divs = []

Definition at line 98 of file prof.py.

◆ STATS

str prof.STATS = "--stats" in A

Definition at line 99 of file prof.py.

◆ stats

dict prof.stats = {k: [] for k in ("volume", "area", "centroid", "velocity", "moments")}

Definition at line 100 of file prof.py.

◆ flush

prof.flush

Definition at line 101 of file prof.py.

◆ S

prof.S = rp.S

Definition at line 103 of file prof.py.

◆ dtsafe

float prof.dtsafe = 0.25

Definition at line 104 of file prof.py.

◆ iters

prof.iters = []

Definition at line 105 of file prof.py.

◆ T

dict prof.T = {"limits": 0.0, "step": 0.0, "flux": 0.0}

Definition at line 106 of file prof.py.

◆ w0

prof.w0 = time.perf_counter()

Definition at line 144 of file prof.py.

◆ dts

prof.dts = [one(True) for _ in range(N)]

Definition at line 145 of file prof.py.

◆ wall

prof.wall = time.perf_counter() - w0

Definition at line 146 of file prof.py.

◆ v

prof.v = s.diagnostics.vof_timing()

Definition at line 153 of file prof.py.

◆ n

prof.n = v["steps"]

Definition at line 154 of file prof.py.

◆ cols

dict prof.cols
Initial value:
1= {f"col{b['id']}": np.asarray(s.vof_block_color(b["id"]))
2 for b in s.diagnostics.vof_block_stats()}

Definition at line 162 of file prof.py.

◆ u

prof.u

Definition at line 164 of file prof.py.

◆ w

prof.w

Definition at line 164 of file prof.py.

◆ p

prof.p

Definition at line 164 of file prof.py.

◆ C

prof.C

Definition at line 164 of file prof.py.