Skip to content

CUDA Graph optimization for massive speedup in small systems#410

Open
JonathanMaes wants to merge 10 commits into
devfrom
optimize/CUDA-graph
Open

CUDA Graph optimization for massive speedup in small systems#410
JonathanMaes wants to merge 10 commits into
devfrom
optimize/CUDA-graph

Conversation

@JonathanMaes

Copy link
Copy Markdown
Contributor

This PR captures part of the changes introduced in mumax³-CO, as presented in C.-Y. You, J. Magn. 31, 204-213 (2026).


As extensively described in C.-Y. You, J. Magn. 31, 204-213 (2026) and on the accompanying website, using CUDA Graph to capture and replay the torque-evaluation kernels in each solver stage can result in a speedup of up to 3-5x for small systems, depending on the solver used. This integrates seamlessly into Run() and Steps() (no changes to input scripts required) and is enabled by default in simulations with <800k cells when >20 steps are requested. Importantly, this optimization is not used/usable with

  • Nonzero temperatures
  • Time-dependent B_ext or material parameters
  • Custom fields (AddFieldTerm)
  • NoDemagSpins

and is only implemented for the Heun, RK23, RK45DP, RK56 and Backward Euler solvers.

TODO

  • Add C.-Y. You, J. Magn. 31, 204-213 (2026) to the list of suggested references if the optimization is used.
  • Add a command-line flag to disable the usage of CUDA Graph, in case this causes issues on someone's system.
  • Test whether everything works as intended on more complex scripts.

mirryou-maker and others added 10 commits June 14, 2026 12:42
Squashed snapshot of the CUDA-Graph-accelerated mumax3 fork (based on
mumax/3 commit 3fe3d41, "Update gpus.txt"). Adds a transparent
split-graph CUDA Graph capture/replay path for Run()/Steps() across
Heun, RK23, RK45DP, RK56 and BackwardEuler, with safety guards for
Temp, time-dependent B_ext/material parameters, NoDemagSpins and
custom field terms, plus the conv_kernmul launch-range and lazy
MaxTorque/MemCpyDtoH micro-optimizations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces the upstream mumax3 README with a fork-focused README covering:
- Performance table (4K–1M cell speedup measurements on RTX 5060 Ti)
- How the CUDA Graph capture/replay path works
- Safety guard list
- Pre-built Windows binary download link (GitHub Releases)
- Build-from-source instructions (Windows CUDA 13.2 + Linux)
- Summary table of all source changes vs upstream 3fe3d41
- Upstream citation and license notice

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

2 participants