Skip to content

Commit 7daa33d

Browse files
committed
Fix CUDA CI: detect pre-installed toolkit, fallback to cuda-toolkit-12-6
The Jimver/cuda-toolkit action failed because cuda-curand-dev-12-6 package doesn't exist. The GPU runner image (NVIDIA GPU-Optimized Image for AI and HPC) likely has CUDA pre-installed. Now we: 1. Check if nvcc is already on PATH 2. Check /usr/local/cuda and add to PATH 3. Fallback to installing cuda-toolkit-12-6 meta-package
1 parent b8d3ec6 commit 7daa33d

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

.github/workflows/ci_cuda.yaml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,21 @@ jobs:
2323
steps:
2424
- name: Checkout repository
2525
uses: actions/checkout@v6
26-
- name: Install CUDA toolkit
27-
uses: Jimver/cuda-toolkit@v0.2.21
28-
with:
29-
cuda: '12.6.3'
30-
method: 'network'
31-
sub-packages: '["nvcc", "cudart-dev", "cublas-dev", "curand-dev"]'
26+
- name: Setup CUDA toolkit
27+
run: |
28+
# The GPU runner image has CUDA pre-installed, just ensure PATH is set
29+
if command -v nvcc &>/dev/null; then
30+
echo "CUDA already available: $(nvcc --version | grep release)"
31+
elif [ -d /usr/local/cuda ]; then
32+
echo "/usr/local/cuda/bin" >> $GITHUB_PATH
33+
echo "CUDA found at /usr/local/cuda"
34+
else
35+
echo "Installing CUDA toolkit..."
36+
sudo apt-get update
37+
sudo apt-get install -y cuda-toolkit-12-6
38+
echo "/usr/local/cuda-12.6/bin" >> $GITHUB_PATH
39+
echo "LD_LIBRARY_PATH=/usr/local/cuda-12.6/lib64:$LD_LIBRARY_PATH" >> $GITHUB_ENV
40+
fi
3241
- name: Install dependencies
3342
run: sudo apt-get update && sudo apt-get install -y curl build-essential libssl-dev protobuf-compiler pkg-config
3443
- name: Install Rust Stable

0 commit comments

Comments
 (0)