Skip to content

[backends] GPUMD support #379

Open
JaafarMehrez wants to merge 1 commit into
SSAGESLabs:mainfrom
JaafarMehrez:gpumd-backend
Open

[backends] GPUMD support #379
JaafarMehrez wants to merge 1 commit into
SSAGESLabs:mainfrom
JaafarMehrez:gpumd-backend

Conversation

@JaafarMehrez
Copy link
Copy Markdown

@JaafarMehrez JaafarMehrez commented May 13, 2026

Summary

Add a GPUMD backend that enables PySAGES-enhanced sampling on GPUMD-accelerated simulations.

What changed

New backend (pysages/backends/gpumd.py)

  • Sampler class that registers a per-step callback with GPUMD's C++ engine.
  • Snapshot arrays are reconstructed from DLPack capsules every step so JAX sees updated GPU positions/forces.
  • Constant data (ids, masses, box, dt) is cached during __init__ to avoid redundant Python to C++ calls.
  • For NVT/NVE, sim.is_box_constant() returns True and the box is never refreshed.
  • For NPT, the box is refreshed every 100 steps.
  • Custom add_aos_bias_to_forces() kernel adds JAX-computed bias directly to GPUMD's SOA force buffer in a single CUDA operation.

Backend detection (pysages/backends/core.py)

  • Auto-detects gpumd.Simulation contexts and routes to the GPUMD backend.

Examples (examples/gpumd/metad, new directory)

  • ethane-metad.py — well-tempered metadynamics, H-C-C-H dihedral.

Dependency

This backend requires GPUMD with the Python wrapper support. refer to this PR

Author

Jaafar Mehrez

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant