Skip to content

fix(cuda): make CUDARC_CUDA_VERSION a true version variable (drop hardcoded cuda-12080) - #55

Merged
isPANN merged 2 commits into
mainfrom
fix/cudarc-version-variable
May 30, 2026
Merged

fix(cuda): make CUDARC_CUDA_VERSION a true version variable (drop hardcoded cuda-12080)#55
isPANN merged 2 commits into
mainfrom
fix/cudarc-version-variable

Conversation

@isPANN

@isPANN isPANN commented May 30, 2026

Copy link
Copy Markdown
Collaborator

Problem

The workspace pinned cudarc's cuda-12080 feature, which defeated the whole 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 plus a mismatched CUDARC_CUDA_VERSION=12060 activates both cfgs → cudarc compiles two binding sets → ~171 dup-definition errors (E0428, nvrtcResult variant-not-found). In practice we were pinned to 12.8.

Fix

Drop the hardcoded cuda-12080; use cuda-version-from-build-system + fallback-latest instead (no hardcoded version). Now the env is the sole selector:

  • HPC: set CUDARC_CUDA_VERSION=<NNNNN> to match module load cuda/X.Y (env wins) — or leave it unset and nvcc auto-detects the loaded toolkit.
  • macOS dev (no nvcc): fallback-latest picks cudarc's newest supported version purely for cargo check (dynamic-loading → never actually runs CUDA).

One-line change to [workspace.dependencies] cudarc features; Cargo.lock unaffected.

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 check confirmed green via fallback-latest.

🤖 Generated with Claude Code

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

codecov Bot commented May 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.29%. Comparing base (20e0aca) to head (2d5486c).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@isPANN
isPANN merged commit 35e589c into main May 30, 2026
9 checks passed
@isPANN
isPANN deleted the fix/cudarc-version-variable branch May 30, 2026 09:51
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