Skip to content

Fix compilation error on CUDA 13.0 and higher - #409

Open
JonathanMaes wants to merge 6 commits into
devfrom
bugfix/CUDA13.0
Open

Fix compilation error on CUDA 13.0 and higher#409
JonathanMaes wants to merge 6 commits into
devfrom
bugfix/CUDA13.0

Conversation

@JonathanMaes

@JonathanMaes JonathanMaes commented Jul 17, 2026

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).


In CUDA 13.0, the number of arguments of cuCtxCreate(...) was changed, leading to a compilation error. Behind the scenes, 13.0 uses cuCtxCreate_v4 instead of the previously used cuCtxCreate_v2. Hence, this PR explicitly uses cuCtxCreate_v2 in context.go. However, this function is not normally exposed by cuda.h, so it is exposed manually in context.go via

//#include <cuda.h>
//CUresult cuCtxCreate_v2(CUcontext *pctx, unsigned int flags, CUdevice dev);
import "C"

Alternative

An alternative solution is

//#define __CUDA_API_VERSION_INTERNAL
//#include <cuda.h>
import "C"

since cuda.h (≥13.0) declares cuCtxCreate_v2 in a large if-block that only runs if __CUDA_API_VERSION_INTERNAL is defined.

I am not sure which would be the more robust option.

TODO

  • Test both options on Linux

JonathanMaes and others added 6 commits June 3, 2026 14:45
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>
@JonathanMaes
JonathanMaes changed the base branch from master to dev July 17, 2026 11:32
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