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

Functions

 arg (name, default)
 
 one ()
 
 gather (a)
 

Variables

 CASE_DIR
 
 CKPT
 
 N = int(sys.argv[1])
 
str WARM = int(sys.argv[sys.argv.index("--warm") + 1]) if "--warm" in sys.argv else 5
 
 RTOL = float(arg("--rtol", 1e-8))
 
 DUMP = arg("--dump", None)
 
 comm = MPI.COMM_WORLD
 
 rank = comm.Get_rank()
 
int SINGLE = 1
 
 S = case.CELLS_PER_D
 
 NX
 
 NY
 
 NZ
 
 step
 
 t
 
 blocks
 
 vel
 
 pres
 
 series
 
 org
 
 siz
 
 sl = tuple(slice(o, o + n) for o, n in zip(org, siz))
 
 s = pf.Solver(*siz)
 
 vol = comm.allreduce(sum(b["volume"] for b in s.diagnostics.vof_block_stats()), op=MPI.SUM)
 
 alpha = vol / (NX * NY * NZ)
 
 rho_av = case.RHO_L + (case.RHO_G - case.RHO_L) * alpha
 
 _closure = getattr(s, "set_superficial_velocity", None) or getattr(s, "set_bulk_velocity", None)
 
 HOST_FLUX = _closure is None
 
 w0 = time.perf_counter()
 
 it
 
 dts
 
 wall = time.perf_counter() - w0
 
 flush
 
dict fields
 
tuple cols
 
 iters
 

Detailed Description

Distributed timing of the bubble column from ckpt_t43 (host MPI x OpenMP; the VoF
step-performance harness, WO-0 -- doc/vof_step_performance_design.md).

    export OMPI_MCA_hwloc_base_binding_policy=none
    PYTHONPATH=<PECLET_FLOW_MPI build> OMP_NUM_THREADS=3 OMP_PROC_BIND=false \
        mpirun -np 8 --bind-to none python tests/study/vof_perf/run_mpi.py N [--warm W] [--cheb]
            [--rtol R] [--dump out.npz] [--ckpt PATH] [--case-dir DIR]

Same case as run_peclet.build(), on this rank's ORB block; set_superficial_velocity closes the
column (a build older than it shifts u on the host: global mean via Allreduce). --ckpt and
--case-dir default as in prof.py. Prints one line on rank 0: ms/step and mean pressure iterations.

  --rtol R    MG-PCG relative tolerance (default 1e-8: the case's registered tolerance, register
              2026-10-03; the solver default stays 1e-10)
  --dump F    save u, v, w, p, C, the timed steps' dt (dts) and pressure iterations (iters) in
              prof.py's format (compare with cmp.py); the fields are gathered onto rank 0 at np > 1,
              the VoF block colours (col<id>) are stored at np = 1 only

np = 1 is SINGLE-RANK: at size 1 neither mpi_block nor init_mpi is called (sec. 14.3 H-0 of
doc/vof_step_performance_design.md). init_mpi at size 1 keeps the distributed path on purpose (the
register's np = 1 bit-exactness gate needs it), so a one-rank benchmark that called it timed the
distributed code -- GridHalo self-copies, the box smoother, no single-rank fusions.

Function Documentation

◆ arg()

run_mpi.arg (   name,
  default 
)

Definition at line 33 of file run_mpi.py.

◆ one()

run_mpi.one ( )

Definition at line 95 of file run_mpi.py.

References one().

Referenced by one().

◆ gather()

run_mpi.gather (   a)

Definition at line 122 of file run_mpi.py.

Variable Documentation

◆ CASE_DIR

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

Definition at line 37 of file run_mpi.py.

◆ CKPT

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

Definition at line 39 of file run_mpi.py.

◆ N

run_mpi.N = int(sys.argv[1])

Definition at line 46 of file run_mpi.py.

◆ WARM

str run_mpi.WARM = int(sys.argv[sys.argv.index("--warm") + 1]) if "--warm" in sys.argv else 5

Definition at line 47 of file run_mpi.py.

◆ RTOL

run_mpi.RTOL = float(arg("--rtol", 1e-8))

Definition at line 48 of file run_mpi.py.

◆ DUMP

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

Definition at line 49 of file run_mpi.py.

◆ comm

run_mpi.comm = MPI.COMM_WORLD

Definition at line 50 of file run_mpi.py.

◆ rank

run_mpi.rank = comm.Get_rank()

Definition at line 51 of file run_mpi.py.

◆ SINGLE

int run_mpi.SINGLE = 1

Definition at line 52 of file run_mpi.py.

◆ S

run_mpi.S = case.CELLS_PER_D

Definition at line 53 of file run_mpi.py.

◆ NX

run_mpi.NX

Definition at line 54 of file run_mpi.py.

◆ NY

run_mpi.NY

Definition at line 54 of file run_mpi.py.

◆ NZ

run_mpi.NZ

Definition at line 54 of file run_mpi.py.

◆ step

run_mpi.step

Definition at line 56 of file run_mpi.py.

◆ t

run_mpi.t

Definition at line 56 of file run_mpi.py.

◆ blocks

run_mpi.blocks

Definition at line 56 of file run_mpi.py.

◆ vel

run_mpi.vel

Definition at line 56 of file run_mpi.py.

◆ pres

run_mpi.pres

Definition at line 56 of file run_mpi.py.

◆ series

run_mpi.series

Definition at line 56 of file run_mpi.py.

◆ org

run_mpi.org

Definition at line 58 of file run_mpi.py.

◆ siz

run_mpi.siz

Definition at line 58 of file run_mpi.py.

◆ sl

run_mpi.sl = tuple(slice(o, o + n) for o, n in zip(org, siz))

Definition at line 61 of file run_mpi.py.

◆ s

run_mpi.s = pf.Solver(*siz)

Definition at line 62 of file run_mpi.py.

◆ vol

run_mpi.vol = comm.allreduce(sum(b["volume"] for b in s.diagnostics.vof_block_stats()), op=MPI.SUM)

Definition at line 78 of file run_mpi.py.

◆ alpha

run_mpi.alpha = vol / (NX * NY * NZ)

Definition at line 79 of file run_mpi.py.

◆ rho_av

run_mpi.rho_av = case.RHO_L + (case.RHO_G - case.RHO_L) * alpha

Definition at line 80 of file run_mpi.py.

◆ _closure

run_mpi._closure = getattr(s, "set_superficial_velocity", None) or getattr(s, "set_bulk_velocity", None)
protected

Definition at line 83 of file run_mpi.py.

◆ HOST_FLUX

run_mpi.HOST_FLUX = _closure is None

Definition at line 86 of file run_mpi.py.

◆ w0

run_mpi.w0 = time.perf_counter()

Definition at line 110 of file run_mpi.py.

◆ it

run_mpi.it

Definition at line 111 of file run_mpi.py.

◆ dts

run_mpi.dts

Definition at line 111 of file run_mpi.py.

◆ wall

run_mpi.wall = time.perf_counter() - w0

Definition at line 116 of file run_mpi.py.

◆ flush

run_mpi.flush

Definition at line 120 of file run_mpi.py.

◆ fields

run_mpi.fields
Initial value:
1= {k: gather(f()) for k, f in (("u", s.get_u), ("v", s.get_v), ("w", s.get_w),
2 ("p", lambda: s.get_field("p")),
3 ("C", lambda: s.get_field("C")))}

Definition at line 130 of file run_mpi.py.

◆ cols

tuple run_mpi.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()} if SINGLE else {})

Definition at line 133 of file run_mpi.py.

◆ iters

run_mpi.iters

Definition at line 136 of file run_mpi.py.