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

Functions

 halvings (d)
 child (args)
 mode_spec (tok, levels)
 predict (args)
 main ()

Variables

 HERE = os.path.abspath(__file__)
dict MODES

Detailed Description

Inspect how a grid + rank count decomposes, and how deep the pressure multigrid gets on it.

Answers, without spending any GPU time, the questions that decide distributed multigrid performance:

  * how balanced is the ORB partition (max block / min block)?
  * is a direction split that must not be (e.g. the wall-normal one in a channel)?
  * how many multigrid levels does the hierarchy ACTUALLY reach, and where does each axis stop?
  * does the coarse-first decomposition help here, and at what depth?

Run it before committing a grid or a rank count to a large job. It needs only an MPI build of
`flow` (the OpenMP one is fine, no GPU), and `mpirun --oversubscribe` happily runs more ranks than
there are cores because nothing here is timed.

    # one grid, several rank counts, auto vs the legacy aligned ORB vs coarse-first:
    python check_decomposition.py --grid 480,80,160 --levels 6 --np 1,2,4,8,12,16,24 --mode 0,1,coarse

    # a whole weak-scaling ladder, ORB only (no solver allocation -> any size, instantly):
    python check_decomposition.py --grid 960,160,320 --np 1 --orb-only
    python check_decomposition.py --grid 3072,512,1024 --np 32 --orb-only

    # what the hierarchy looks like level by level:
    python check_decomposition.py --grid 1508,240,503 --levels 5 --np 4 --verbose

    # the ladder after diagnostics.rebalance_by_weights(w), and the alignment it picks:
    python check_decomposition.py --grid 96,96,96 --levels 8 --np 4,8 --predict --weights w.npy

`--orb-only` skips constructing a Solver, so it reports the partition (balance, splits) for grids far
too large to allocate on a host — but it cannot report the achieved level count, which needs the real
MG init. Without it, the grid must fit in host memory (a few hundred M cells at most).

Requires PYTHONPATH to point at an MPI-enabled flow build, e.g.
    PYTHONPATH=$PWD/build_mpi_omp python scripts/check_decomposition.py ...

Function Documentation

◆ halvings()

check_decomposition.halvings ( d)
How many times an axis can be halved: the multigrid's per-axis depth budget.

Definition at line 44 of file check_decomposition.py.

◆ child()

check_decomposition.child ( args)

Definition at line 54 of file check_decomposition.py.

Referenced by main().

◆ mode_spec()

check_decomposition.mode_spec ( tok,
levels )
'0'/'auto' -> the default auto policy; '1'/'aligned'/'legacy' -> the legacy aligned ORB;
'coarse'/'coarse-first'/<int >= 2> -> coarse-first at that depth.

Definition at line 102 of file check_decomposition.py.

Referenced by main().

◆ predict()

check_decomposition.predict ( args)
Pure-function pre-flight: the hierarchy init_mpi would build, per rank count, with and
without telescoping. No mpirun -- this is what makes np=1536 answerable on a laptop.

Definition at line 112 of file check_decomposition.py.

Referenced by main().

◆ main()

check_decomposition.main ( )

Definition at line 144 of file check_decomposition.py.

References child(), main(), mode_spec(), and predict().

Referenced by main().

Variable Documentation

◆ HERE

check_decomposition.HERE = os.path.abspath(__file__)

Definition at line 41 of file check_decomposition.py.

◆ MODES

dict check_decomposition.MODES
Initial value:
1= {"0": ("auto", "0"), "auto": ("auto", "0"),
2 "1": ("aligned", "1"), "aligned": ("aligned", "1"), "legacy": ("aligned", "1")}

Definition at line 98 of file check_decomposition.py.