zoomy_jax.symsolver.hypre

zoomy_jax.symsolver.hypre#

hypre through ctypes: FlexGMRES with one BoomerAMG V-cycle on the cell-block-scaled owned rows of an operator; the JAX Chorin pressure solve on CPUs (pressure_linear_solver=LinearSolver.hypre, zoomy_jax.symsolver.runtime). The library is the shared build of containers/zoomy_amrex/build_hypre_cuda.sh cpu-env (or ZOOMY_HYPRE_LIB); it must link the MPI that mpi4py uses.

References

  • Falgout, Yang 2002, https://doi.org/10.1007/3-540-47789-6_66

  • Henson, Yang 2002, https://doi.org/10.1016/S0168-9274(01)00115-5

  • Saad 1993, https://doi.org/10.1137/0914028

Module Contents#

Classes#

BlockRows

The owned rows of an operator on k unknowns per cell (row c k + p of owned cell c), its columns by global unknown number, solved by hypre with matrix values given per call. Every k x k block of a (cell, stencil cell) pair must be present. Used by zoomy_jax.symsolver.runtime (pressure_linear_solver=LinearSolver.hypre).

Functions#

library_path

The hypre shared library: ZOOMY_HYPRE_LIB, else the cpu-env build under ZOOMY_HYPRE_CACHE (default ~/.cache/zoomy).

available

Whether the hypre shared library exists.

load

The hypre library, loaded and initialized once; ImportError when it is missing.

Data#

API#

zoomy_jax.symsolver.hypre.VERSION#

‘3.2.0’

zoomy_jax.symsolver.hypre.PARCSR#

5555

zoomy_jax.symsolver.hypre.STATS#

‘dict(…)’

zoomy_jax.symsolver.hypre.library_path()#

The hypre shared library: ZOOMY_HYPRE_LIB, else the cpu-env build under ZOOMY_HYPRE_CACHE (default ~/.cache/zoomy).

zoomy_jax.symsolver.hypre.available()#

Whether the hypre shared library exists.

zoomy_jax.symsolver.hypre.load()#

The hypre library, loaded and initialized once; ImportError when it is missing.

class zoomy_jax.symsolver.hypre.BlockRows(comm, k, n_own, lo, rows, gcols, tol, restart, maxiter, rebuild=1, growth=2.0)#

The owned rows of an operator on k unknowns per cell (row c k + p of owned cell c), its columns by global unknown number, solved by hypre with matrix values given per call. Every k x k block of a (cell, stencil cell) pair must be present. Used by zoomy_jax.symsolver.runtime (pressure_linear_solver=LinearSolver.hypre).

Args

  • comm: mpi4py communicator of the ranks (used as is; collective calls in solve)

  • k: unknowns per cell

  • n_own: owned cells; lo: the global number of the first

  • rows, gcols: local row (< k n_own) and global column of every entry

  • tol: target of the true relative residual |b - A x| / |b|

  • restart, maxiter: FlexGMRES Krylov space min(restart, 50), restart * maxiter iterations at most

  • rebuild: rebuild the BoomerAMG hierarchy at least every this many solves (1: every solve; in between the lagged hierarchy preconditions the new matrix)

  • growth: rebuild early once the iterations exceed this factor times those right after the last rebuild

Initialization

Index the k x k blocks and the cell blocks; no hypre object yet.

solve(vals, b, transpose=False, nb=None)#

Solve A x = b (transpose: A^T x = b) for the matrix values vals and the owned right-hand side b (global norm nb, if known); collective on comm. FlexGMRES on S = D^-1 A (D the k x k cell blocks; transposed: S^T z = b, x = D^-T z) to 0.1 tol, re-entered with a tighter tolerance until the true relative residual is below tol.