Skip to content
UniversalBasicIncPublic

About

MACE-MP-0 on Intel Arc via PyTorch XPU, validated vs CPU and NVIDIA; GROMACS NNPot coupling

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

21 Commits

Folders and files

Repository files navigation

MACE on Intel Arc

Run MACE machine-learned interatomic potentials on Intel Arc GPUs, with the numbers to trust it: forces validated against the CPU reference and against an NVIDIA RTX A5000 in the same machine, molecular-dynamics stability checked, and GROMACS driving the model on the Arc through its NNPot interface.

MACE itself needs no change. PyTorch's xpu backend is enough. What this repository adds is the recipe, the validation record, and the GROMACS side: three contributions merged upstream, and a one-command container that runs GROMACS main with MACE on an Intel GPU.

64 water molecules simulated with MACE-MP-0 on an Intel Arc Pro B70

Liquid water, 64 molecules, MACE-MP-0 small on an Arc Pro B70: 4 ps of Langevin dynamics at 300 K, rendered from scripts/md_visual.py. Silicon at 600 K is in docs/img/si512_600K.gif.

Use it now

uv venv --python 3.12 venv && source venv/bin/activate
uv pip install torch==2.14.1 --index-url https://download.pytorch.org/whl/xpu
uv pip install mace-torch==0.3.16 ase
export TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD=1   # mace-torch 0.3.16 checkpoints are full pickles; torch 2.14 needs this
from mace.calculators import mace_mp
calc = mace_mp(model="small", device="xpu")          # that is the whole port

Host requirements: an Intel GPU on the xe kernel driver and the Intel compute runtime (Level Zero). The Arc Pro B70 (8086:e223) needs kernel 6.17 or later; the torch XPU wheel brings its own SYCL runtime. The cuEquivariance fast path is NVIDIA-only, so Intel GPUs run the plain e3nn tensor-product path.

What was measured

Arc Pro B70 (Battlemage, 32 GB) against an RTX A5000 and a 128-thread EPYC 7742 in the same chassis, MACE-MP-0 small, diamond-Si supercells of 64, 512 and 1728 atoms. Full tables and caveats in docs/FINDINGS.md; raw logs and force arrays in results/.

result
Forces, fp32, B70 vs A5000 1.6–1.8e-06 relative RMS, below each card's own fp32-vs-fp64 floor
Forces, fp64, B70 vs A5000 and vs CPU 4e-15: machine epsilon, the device is not in the answer
Speed, e3nn path, fp32 B70 44 ms / A5000 43 ms per force call at Si512; 128 / 128 ms at Si1728; both ~10× the EPYC
Speed, fp64, Si512 B70 107 ms, A5000 230 ms: 2.1× faster on the Arc (Xe2 fp64 at 1/14 rate, GA102 at 1/32)
Energy per step, e3nn path B70 7.3 J vs A5000 9.1 J at Si512: 20 % less
NVE, 20 ps at 1 fs zero drift, no NaNs, statistically identical to the CPU lane
NVT, 10 ps Langevin identical temperature and energy statistics on B70, A5000 and A5000+cuEquivariance
GROMACS NNPot, Si512 NVT B70 2.93 ns/day, A5000 2.84 ns/day; forces match the ASE calculator to 1.2e-05

Forces on 512 Si atoms from the Arc, and their difference from the A5000

Force parity, Arc Pro B70 against RTX A5000, fp32 and fp64

Force-call time, fp64 and board energy per call

The honest caveat: this is the launch-bound e3nn path that Intel users get today. cuEquivariance, which exists for NVIDIA only, buys the A5000 1.8× at Si1728 and halves its energy per step. An equivalent fused tensor-product path for XPU is where the next 2× on Arc is.

GROMACS

GROMACS's NNPot interface runs a LibTorch model inside mdrun. Intel GPU support for it is now upstream in GROMACS main and will ship in the next major release; no patch is needed:

change issue merge request status
Run NNPot models on Intel GPUs through LibTorch XPU #5754 !6372 merged into main
Build with LibTorch 2.14+ (C++20 only for the sources that include LibTorch) #5754 !6417 merged into main
Fix: models requesting only pair-shifts never got a pair list #5753 !6370 merged into release-2026

One command: GROMACS + MACE on an Intel GPU

pipeline/run.sh            # podman; ENGINE=docker pipeline/run.sh for docker

pipeline/Containerfile builds everything from public sources: Ubuntu 26.04, Intel's GPU compute runtime, the oneAPI DPC++ compiler, the PyTorch XPU wheel, mace-torch, and unpatched GROMACS main. pipeline/run.sh then exports MACE-MP-0 for GROMACS, builds a 512-atom silicon test system, runs a single-point force check and 10 ps of NVT in gmx mdrun with the model on the GPU, and checks GROMACS's forces against the ASE calculator. The host needs only the xe kernel driver (an Arc Pro B70 needs Linux 6.17 or later).

To build it yourself without the container: install the oneAPI DPC++ compiler (LibTorch's XPU CMake config needs it at configure time) and the PyTorch XPU wheel, then configure GROMACS main with -DGMX_NNPOT=TORCH and LibTorch on CMAKE_PREFIX_PATH. GROMACS itself can be built with or without SYCL; the model runs on the GPU through LibTorch either way. At run time, put the wheel's torch/lib and the venv's lib/ on the library path. GMX_NN_DEVICE=cpu|gpu overrides the device; by default the model runs on the first Intel GPU LibTorch sees.

Your own system: export the model with scripts/gmx/export_gmx_mace.py, then in the .mdp set nnpot-active = yes, nnpot-modelfile, nnpot-input-group (the atoms MACE handles) and the inputs and nnpot-pair-cutoff shown in scripts/gmx/make_si_system.py. MACE-MP-0 is trained on inorganic materials; for molecules use a model trained for them, and check its license.

Older builds: patches/gromacs-2026.3-nnpot-xpu.patch adds the same support to the 2026.3 release tarball (scripts/gmx/build-gmx-nnpot-{xpu,cuda}.sh); upstream/gromacs/ keeps the patches as submitted and their verification record.

GROMACS NVT on Si512 with NNPot on the Arc and on the A5000

scripts/gmx/export_gmx_mace.py exports MACE-MP-0 to TorchScript with the NNPot calling convention (positions nm→Å, GROMACS's half pair list mirrored with negated shifts, energy eV→kJ/mol); check_wrapper.py, make_si_system.py, run_case.sh and compare_gmx.py are the test case and the force cross-check against the ASE calculator.

Repository map

path what
scripts/mace_ab.py, mace_compare.py force A/B harness: same geometries on any device, forces saved as .npz, lane-vs-lane deltas
scripts/mace_power.py joules per force call from the GPU energy counter (xe hwmon) or nvidia-smi
scripts/mace_nve.py, mace_nvt.py 20 ps NVE drift; 10 ps Langevin NVT
scripts/mace_fp64.py, mace_scale.py, mace_forces.py fp64 lane, size scaling, first probe
scripts/md_visual.py, scripts/plots/ the MD runs behind the animations, and the figure and trajectory renderers (make_figures.py, render_traj.py)
scripts/run_b70_chain.sh, run_cuda_chain.sh the full lane on each card (paths via MACE_ARC_ROOT)
pipeline/ container and runner: GROMACS main + MACE on an Intel GPU, end to end
scripts/gmx/ GROMACS export, test case, cross-check, builds
upstream/gromacs/ the upstream patches as submitted, verification record, end-to-end reproduction of the fix
patches/ combined patch for the GROMACS 2026.3 release
docs/FINDINGS.md the engineering record, seven findings
results/ raw logs, force arrays, GROMACS cases; results/miner-on/ is a busy-host calibration, see Finding 4

Reproduce

export MACE_ARC_ROOT=$PWD                       # scripts default to /data/mace-arc
python scripts/mace_ab.py --device xpu --tag b70 --out results/ab      # Intel GPU
python scripts/mace_ab.py --device cuda --tag a5000 --out results/ab   # NVIDIA (add --cueq for cuEquivariance)
python scripts/mace_ab.py --device cpu --tag cpu --out results/ab
python scripts/mace_compare.py results/ab b70 a5000 cpu

Figures: python scripts/plots/make_figures.py rebuilds docs/img/*.png from results/; the animations come from scripts/md_visual.py on the GPU (writes results/visual/*.extxyz, not committed) and scripts/plots/render_traj.py.

GROMACS: pipeline/run.sh (the steps it runs: export_gmx_mace.py → make_si_system.py → run_case.sh → compare_gmx.py).

Related

boltz2-intel-arc: the same method applied to Boltz-2 protein structure prediction, merged into boltz-community.

License

MIT. Copyright (c) 2026 Universal Basic Inc. (Dylan Holdren). MACE, e3nn, ASE, PyTorch and GROMACS are their own projects under their own licenses; nothing of theirs is redistributed here except the GROMACS patches, which are offered to GROMACS under its LGPL-2.1 terms.

About

MACE-MP-0 on Intel Arc via PyTorch XPU, validated vs CPU and NVIDIA; GROMACS NNPot coupling

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages