fix(cuda): make CUDARC_CUDA_VERSION a true version variable (drop hardcoded cuda-12080) - #55
Merged
Merged
Conversation
The workspace pinned cudarc's `cuda-12080` feature, defeating the point of exposing the CUDA version via CUDARC_CUDA_VERSION. cudarc's build.rs does NOT let the env *override* a hardcoded feature — it emits an EXTRA `cargo:rustc-cfg=feature="cuda-<env>"`, so a hardcoded `cuda-12080` + a mismatched `CUDARC_CUDA_VERSION=12060` activates BOTH cfgs and cudarc compiles two binding sets -> ~171 dup-definition errors. In practice we were pinned to 12.8. Drop the hardcoded `cuda-12080`; use `cuda-version-from-build-system` + `fallback-latest`. Now the env is the sole selector: on HPC set CUDARC_CUDA_VERSION to match `module load cuda/X.Y` (or leave unset and nvcc auto-detects); on macOS (no nvcc) fallback-latest picks the newest supported version purely for `cargo check` (dynamic-loading never runs CUDA). Verified build + runtime across cuda 12.0/12.2/12.4/12.6/12.8 on HKUST-GZ A40, 56/56 tests each (job 9800420) — incl. 12.6, which previously failed to even compile. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #55 +/- ##
=======================================
Coverage 96.29% 96.29%
=======================================
Files 19 19
Lines 918 918
=======================================
Hits 884 884
Misses 34 34 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The workspace pinned cudarc's
cuda-12080feature, which defeated the whole point of exposing the CUDA version viaCUDARC_CUDA_VERSION. cudarc'sbuild.rsdoes not let the env override a hardcoded feature — it emits an extracargo:rustc-cfg=feature="cuda-<env>". So a hardcodedcuda-12080plus a mismatchedCUDARC_CUDA_VERSION=12060activates both cfgs → cudarc compiles two binding sets → ~171 dup-definition errors (E0428,nvrtcResultvariant-not-found). In practice we were pinned to 12.8.Fix
Drop the hardcoded
cuda-12080; usecuda-version-from-build-system+fallback-latestinstead (no hardcoded version). Now the env is the sole selector:CUDARC_CUDA_VERSION=<NNNNN>to matchmodule load cuda/X.Y(env wins) — or leave it unset andnvccauto-detects the loaded toolkit.fallback-latestpicks cudarc's newest supported version purely forcargo check(dynamic-loading→ never actually runs CUDA).One-line change to
[workspace.dependencies] cudarcfeatures;Cargo.lockunaffected.Verification
Build + runtime across cuda 12.0 / 12.2 / 12.4 / 12.6 / 12.8 on HKUST-GZ A40 — 56/56 tests each (Slurm job 9800420). Notably 12.6, which previously failed to even compile, now passes. macOS
cargo checkconfirmed green via fallback-latest.🤖 Generated with Claude Code