Skip to content

Commit 1b9487f

Browse files
authored
Merge pull request #757 from hongyx11/dev
CI: update buildcupy action
2 parents ce78796 + e17548d commit 1b9487f

2 files changed

Lines changed: 107 additions & 28 deletions

File tree

.github/workflows/buildcupy.yaml

Lines changed: 49 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PyLops Testing (CuPy)
1+
name: PyLops Testing with CuPy
22

33
on:
44
pull_request:
@@ -10,7 +10,9 @@ on:
1010

1111
jobs:
1212
build:
13-
runs-on: self-hosted
13+
runs-on:
14+
- self-hosted
15+
- exouser
1416
steps:
1517
- name: Check out source repository
1618
uses: actions/checkout@v6
@@ -22,35 +24,54 @@ jobs:
2224
python-version: 3.11
2325
- name: Install dependencies and pylops
2426
run: |
25-
srun --account=yuxilab -n 1 -N 1 --gres=gpu:L40S:1 bash -c '
26-
uv sync --locked --extra advanced \
27-
--extra stat --extra gpu-cu12 \
28-
--extra deep-cu128 --all-groups
29-
'
27+
uv sync --extra advanced \
28+
--extra stat --extra gpu-cu12 \
29+
--group dev
30+
uv pip install \
31+
--default-index https://download.pytorch.org/whl/cu128 \
32+
torch==2.11.0+cu128
33+
uv pip install \
34+
nvidia-cuda-nvcc-cu12==12.2.128 \
35+
nvidia-cuda-nvrtc-cu12==12.8.93 \
36+
nvidia-cuda-runtime-cu12==12.8.90
3037
echo "done!"
31-
- name: Install CUDA 12.8 toolkit
38+
39+
- name: Configure CUDA NVVM from uv wheels
3240
run: |
33-
srun --account=yuxilab -n 1 -N 1 --gres=gpu:L40S:1 bash -c '
34-
# Currently, the NVIDIA GPU drivers on the self-hosted runner
35-
# and the CUDA installation in CUDA_HOME require different PTX versions
36-
# (8.7 and 8.8, respectively). CUDA and NVCC are temporarely
37-
# installed in the uv environment, and the CUDA paths are set in
38-
# the test command, to work around this issue.
39-
uv add nvidia-cuda-nvcc-cu12==12.8.*
40-
# Numba resolves libNVVM via CUDA_HOME and needs a versioned
41-
# libnvvm.so.N (the pip wheel only ships a bare libnvvm.so), so
42-
# add the symlink once here against the wheel-provided toolkit.
43-
ln -sf libnvvm.so .venv/lib/python3.11/site-packages/nvidia/cuda_nvcc/nvvm/lib64/libnvvm.so.4
44-
'
41+
CUDA_HOME="$PWD/.venv/lib/python3.11/site-packages/nvidia/cuda_nvcc"
42+
CUDA_RUNTIME_ROOT="$PWD/.venv/lib/python3.11/site-packages/nvidia/cuda_runtime"
43+
CUDA_NVRTC_ROOT="$PWD/.venv/lib/python3.11/site-packages/nvidia/cuda_nvrtc"
44+
45+
if [ ! -f "$CUDA_HOME/nvvm/lib64/libnvvm.so" ]; then
46+
echo "libnvvm.so not found in $CUDA_HOME/nvvm/lib64"
47+
exit 1
48+
fi
49+
if [ ! -f "$CUDA_RUNTIME_ROOT/lib/libcudart.so.12" ]; then
50+
echo "libcudart.so.12 not found in $CUDA_RUNTIME_ROOT/lib"
51+
exit 1
52+
fi
53+
if [ ! -f "$CUDA_NVRTC_ROOT/lib/libnvrtc.so.12" ]; then
54+
echo "libnvrtc.so.12 not found in $CUDA_NVRTC_ROOT/lib"
55+
exit 1
56+
fi
57+
58+
mkdir -p "$CUDA_HOME/lib64"
59+
ln -sf "$CUDA_HOME/nvvm/lib64/libnvvm.so" "$CUDA_HOME/nvvm/lib64/libnvvm.so.4"
60+
ln -sf "$CUDA_HOME/nvvm/lib64/libnvvm.so" "$CUDA_HOME/lib64/libnvvm.so"
61+
ln -sf "$CUDA_RUNTIME_ROOT/lib/libcudart.so.12" "$CUDA_HOME/lib64/libcudart.so.12"
62+
ln -sf "$CUDA_RUNTIME_ROOT/lib/libcudart.so.12" "$CUDA_HOME/lib64/libcudart.so"
63+
ln -sf "$CUDA_NVRTC_ROOT/lib/libnvrtc.so.12" "$CUDA_HOME/lib64/libnvrtc.so.12"
64+
ln -sf "$CUDA_HOME/lib64/libnvrtc.so.12" "$CUDA_HOME/lib64/libnvrtc.so"
65+
66+
echo "CUDA_HOME=$CUDA_HOME" >> "$GITHUB_ENV"
67+
echo "CUDA_NVVM_LIB=$CUDA_HOME/nvvm/lib64" >> "$GITHUB_ENV"
4568
echo "done!"
4669
- name: Test with pytest
4770
run: |
48-
srun --account=yuxilab -n 1 -N 1 --gres=gpu:L40S:1 bash -c '
49-
# Use the pip-installed CUDA 12.8 toolkit (matches the 12.8 driver),
50-
# not any system CUDA on the runner, so numba emits PTX <= 8.7.
51-
export CUDA_HOME="$PWD/.venv/lib/python3.11/site-packages/nvidia/cuda_nvcc"
52-
export CUPY_PYLOPS=1
53-
export TEST_CUPY_PYLOPS=1
54-
uv run pytest --color=yes pytests/
55-
'
71+
export CUDA_HOME="${CUDA_HOME:-$PWD/.venv/lib/python3.11/site-packages/nvidia/cuda_nvcc}"
72+
export CUPY_PYLOPS=1
73+
export TEST_CUPY_PYLOPS=1
74+
export LD_LIBRARY_PATH="$CUDA_HOME/lib64:$CUDA_NVVM_LIB:$LD_LIBRARY_PATH"
75+
export NUMBA_CUDA_NVVM="$CUDA_NVVM_LIB/libnvvm.so"
76+
uv run --no-sync pytest --color=yes pytests/
5677
echo "done!"

.github/workflows/buildcupy1.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: PyLops Testing (CuPy)
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
push:
7+
branches:
8+
- main
9+
- dev
10+
11+
jobs:
12+
build:
13+
runs-on:
14+
- self-hosted
15+
- uni
16+
steps:
17+
- name: Check out source repository
18+
uses: actions/checkout@v6
19+
with:
20+
fetch-depth: 0
21+
- name: Install uv with Python 3.11
22+
uses: astral-sh/setup-uv@v6
23+
with:
24+
python-version: 3.11
25+
- name: Install dependencies and pylops
26+
run: |
27+
srun --account=yuxilab -n 1 -N 1 --gres=gpu:L40S:1 bash -c '
28+
uv sync --locked --extra advanced \
29+
--extra stat --extra gpu-cu12 \
30+
--extra deep-cu128 --all-groups
31+
'
32+
echo "done!"
33+
- name: Install CUDA 12.8 toolkit
34+
run: |
35+
srun --account=yuxilab -n 1 -N 1 --gres=gpu:L40S:1 bash -c '
36+
# Currently, the NVIDIA GPU drivers on the self-hosted runner
37+
# and the CUDA installation in CUDA_HOME require different PTX versions
38+
# (8.7 and 8.8, respectively). CUDA and NVCC are temporarely
39+
# installed in the uv environment, and the CUDA paths are set in
40+
# the test command, to work around this issue.
41+
uv add nvidia-cuda-nvcc-cu12==12.8.*
42+
# Numba resolves libNVVM via CUDA_HOME and needs a versioned
43+
# libnvvm.so.N (the pip wheel only ships a bare libnvvm.so), so
44+
# add the symlink once here against the wheel-provided toolkit.
45+
ln -sf libnvvm.so .venv/lib/python3.11/site-packages/nvidia/cuda_nvcc/nvvm/lib64/libnvvm.so.4
46+
'
47+
echo "done!"
48+
- name: Test with pytest
49+
run: |
50+
srun --account=yuxilab -n 1 -N 1 --gres=gpu:L40S:1 bash -c '
51+
# Use the pip-installed CUDA 12.8 toolkit (matches the 12.8 driver),
52+
# not any system CUDA on the runner, so numba emits PTX <= 8.7.
53+
export CUDA_HOME="$PWD/.venv/lib/python3.11/site-packages/nvidia/cuda_nvcc"
54+
export CUPY_PYLOPS=1
55+
export TEST_CUPY_PYLOPS=1
56+
uv run pytest --color=yes pytests/
57+
'
58+
echo "done!"

0 commit comments

Comments
 (0)