Install HARTMAX¶
This page installs HARTMAX, picks the device JAX runs on, and explains the two
settings HARTMAX changes for speed. You need Python 3.11–3.13 and JAX 0.7.2 or
later. A plain install runs on the CPU and needs nothing else. The package is
hartmax on PyPI; lmhdx is its 1.x name and stops at 1.12.
python -m venv .venv
source .venv/bin/activate
python -m pip install hartmax
hartmax --help
hartmax --help lists the commands run, benchmark and validate. HARTMAX does
not support JAX 0.6.2, the last release for Python 3.10, because its CUDA build
crashes when a thermal step’s compiled loop runs a second time at production
sizes. SOLVAX’s dependency equinox excludes JAX 0.7.0 and 0.7.1.
Plotting and accelerators¶
Add plotting support with:
python -m pip install "hartmax[visualization]"
The standard JAX package uses the CPU. For NVIDIA, AMD or Apple accelerators, follow the JAX installation guide, then check which devices JAX sees:
python -c "import jax; print(jax.devices())"
A run uses JAX’s default device. That is one GPU when a CUDA jaxlib is
installed, and otherwise the CPU with XLA’s own threads. HARTMAX does not support
multi-device execution yet.
Setting |
Default |
Change it when |
|---|---|---|
|
GPU when a CUDA |
Small sections, where the CPU can beat a GPU; time your case |
|
JAX preallocates most GPU memory |
Several processes share one GPU |
From source¶
For development, install the repository in editable mode and run the tests:
git clone https://github.com/uwplasma/HARTMAX.git
cd HARTMAX
python -m pip install -e ".[dev,docs]"
python scripts/run_full_test_suite.py
What HARTMAX sets for you¶
import hartmax is lazy and does not start JAX. The first case you build turns
on JAX’s persistent compilation cache in ~/.cache/hartmax/jax_compilation. A
new process, or a new Hartmann number on the same mesh, then reuses compiled
solves instead of compiling them again.
The cache keeps compiles that take over one second, up to 2 GiB in total.
The cache shares programs across field values, which makes a repeated warm solve 35–60 % slower. For long loops over one compiled function, call
hartmax.enable_compilation_cache(share_across_values=False)first.Set
HARTMAX_COMPILATION_CACHE=0to turn the cache off, or set it to a directory to move it.The cache stays off on macOS with jaxlib older than 0.10, which can crash reading back a large cached program.
HARTMAX sets no XLA flag on its own. hartmax.configure(gpu_gemm=True) adds
--xla_gpu_enable_triton_gemm=false to XLA_FLAGS. This halves the GPU compile time of a steady solve and
makes a warm solve about 10 % slower. Call it before the first array is made. A value you set yourself takes
precedence.