diff --git a/.github/workflows/buildcupy.yaml b/.github/workflows/buildcupy.yaml index 56f917f8..5ebb952d 100644 --- a/.github/workflows/buildcupy.yaml +++ b/.github/workflows/buildcupy.yaml @@ -1,4 +1,4 @@ -name: PyLops Testing (CuPy) +name: PyLops Testing with CuPy on: pull_request: @@ -10,7 +10,9 @@ on: jobs: build: - runs-on: self-hosted + runs-on: + - self-hosted + - exouser steps: - name: Check out source repository uses: actions/checkout@v6 @@ -22,35 +24,54 @@ jobs: python-version: 3.11 - name: Install dependencies and pylops run: | - srun --account=yuxilab -n 1 -N 1 --gres=gpu:L40S:1 bash -c ' - uv sync --locked --extra advanced \ - --extra stat --extra gpu-cu12 \ - --extra deep-cu128 --all-groups - ' + uv sync --extra advanced \ + --extra stat --extra gpu-cu12 \ + --group dev + uv pip install \ + --default-index https://download.pytorch.org/whl/cu128 \ + torch==2.11.0+cu128 + uv pip install \ + nvidia-cuda-nvcc-cu12==12.2.128 \ + nvidia-cuda-nvrtc-cu12==12.8.93 \ + nvidia-cuda-runtime-cu12==12.8.90 echo "done!" - - name: Install CUDA 12.8 toolkit + + - name: Configure CUDA NVVM from uv wheels run: | - srun --account=yuxilab -n 1 -N 1 --gres=gpu:L40S:1 bash -c ' - # Currently, the NVIDIA GPU drivers on the self-hosted runner - # and the CUDA installation in CUDA_HOME require different PTX versions - # (8.7 and 8.8, respectively). CUDA and NVCC are temporarely - # installed in the uv environment, and the CUDA paths are set in - # the test command, to work around this issue. - uv add nvidia-cuda-nvcc-cu12==12.8.* - # Numba resolves libNVVM via CUDA_HOME and needs a versioned - # libnvvm.so.N (the pip wheel only ships a bare libnvvm.so), so - # add the symlink once here against the wheel-provided toolkit. - ln -sf libnvvm.so .venv/lib/python3.11/site-packages/nvidia/cuda_nvcc/nvvm/lib64/libnvvm.so.4 - ' + CUDA_HOME="$PWD/.venv/lib/python3.11/site-packages/nvidia/cuda_nvcc" + CUDA_RUNTIME_ROOT="$PWD/.venv/lib/python3.11/site-packages/nvidia/cuda_runtime" + CUDA_NVRTC_ROOT="$PWD/.venv/lib/python3.11/site-packages/nvidia/cuda_nvrtc" + + if [ ! -f "$CUDA_HOME/nvvm/lib64/libnvvm.so" ]; then + echo "libnvvm.so not found in $CUDA_HOME/nvvm/lib64" + exit 1 + fi + if [ ! -f "$CUDA_RUNTIME_ROOT/lib/libcudart.so.12" ]; then + echo "libcudart.so.12 not found in $CUDA_RUNTIME_ROOT/lib" + exit 1 + fi + if [ ! -f "$CUDA_NVRTC_ROOT/lib/libnvrtc.so.12" ]; then + echo "libnvrtc.so.12 not found in $CUDA_NVRTC_ROOT/lib" + exit 1 + fi + + mkdir -p "$CUDA_HOME/lib64" + ln -sf "$CUDA_HOME/nvvm/lib64/libnvvm.so" "$CUDA_HOME/nvvm/lib64/libnvvm.so.4" + ln -sf "$CUDA_HOME/nvvm/lib64/libnvvm.so" "$CUDA_HOME/lib64/libnvvm.so" + ln -sf "$CUDA_RUNTIME_ROOT/lib/libcudart.so.12" "$CUDA_HOME/lib64/libcudart.so.12" + ln -sf "$CUDA_RUNTIME_ROOT/lib/libcudart.so.12" "$CUDA_HOME/lib64/libcudart.so" + ln -sf "$CUDA_NVRTC_ROOT/lib/libnvrtc.so.12" "$CUDA_HOME/lib64/libnvrtc.so.12" + ln -sf "$CUDA_HOME/lib64/libnvrtc.so.12" "$CUDA_HOME/lib64/libnvrtc.so" + + echo "CUDA_HOME=$CUDA_HOME" >> "$GITHUB_ENV" + echo "CUDA_NVVM_LIB=$CUDA_HOME/nvvm/lib64" >> "$GITHUB_ENV" echo "done!" - name: Test with pytest run: | - srun --account=yuxilab -n 1 -N 1 --gres=gpu:L40S:1 bash -c ' - # Use the pip-installed CUDA 12.8 toolkit (matches the 12.8 driver), - # not any system CUDA on the runner, so numba emits PTX <= 8.7. - export CUDA_HOME="$PWD/.venv/lib/python3.11/site-packages/nvidia/cuda_nvcc" - export CUPY_PYLOPS=1 - export TEST_CUPY_PYLOPS=1 - uv run pytest --color=yes pytests/ - ' + export CUDA_HOME="${CUDA_HOME:-$PWD/.venv/lib/python3.11/site-packages/nvidia/cuda_nvcc}" + export CUPY_PYLOPS=1 + export TEST_CUPY_PYLOPS=1 + export LD_LIBRARY_PATH="$CUDA_HOME/lib64:$CUDA_NVVM_LIB:$LD_LIBRARY_PATH" + export NUMBA_CUDA_NVVM="$CUDA_NVVM_LIB/libnvvm.so" + uv run --no-sync pytest --color=yes pytests/ echo "done!" diff --git a/.github/workflows/buildcupy1.yaml b/.github/workflows/buildcupy1.yaml new file mode 100644 index 00000000..71c4fbff --- /dev/null +++ b/.github/workflows/buildcupy1.yaml @@ -0,0 +1,58 @@ +name: PyLops Testing (CuPy) + +on: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: + - main + - dev + +jobs: + build: + runs-on: + - self-hosted + - uni + steps: + - name: Check out source repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 + - name: Install uv with Python 3.11 + uses: astral-sh/setup-uv@v6 + with: + python-version: 3.11 + - name: Install dependencies and pylops + run: | + srun --account=yuxilab -n 1 -N 1 --gres=gpu:L40S:1 bash -c ' + uv sync --locked --extra advanced \ + --extra stat --extra gpu-cu12 \ + --extra deep-cu128 --all-groups + ' + echo "done!" + - name: Install CUDA 12.8 toolkit + run: | + srun --account=yuxilab -n 1 -N 1 --gres=gpu:L40S:1 bash -c ' + # Currently, the NVIDIA GPU drivers on the self-hosted runner + # and the CUDA installation in CUDA_HOME require different PTX versions + # (8.7 and 8.8, respectively). CUDA and NVCC are temporarely + # installed in the uv environment, and the CUDA paths are set in + # the test command, to work around this issue. + uv add nvidia-cuda-nvcc-cu12==12.8.* + # Numba resolves libNVVM via CUDA_HOME and needs a versioned + # libnvvm.so.N (the pip wheel only ships a bare libnvvm.so), so + # add the symlink once here against the wheel-provided toolkit. + ln -sf libnvvm.so .venv/lib/python3.11/site-packages/nvidia/cuda_nvcc/nvvm/lib64/libnvvm.so.4 + ' + echo "done!" + - name: Test with pytest + run: | + srun --account=yuxilab -n 1 -N 1 --gres=gpu:L40S:1 bash -c ' + # Use the pip-installed CUDA 12.8 toolkit (matches the 12.8 driver), + # not any system CUDA on the runner, so numba emits PTX <= 8.7. + export CUDA_HOME="$PWD/.venv/lib/python3.11/site-packages/nvidia/cuda_nvcc" + export CUPY_PYLOPS=1 + export TEST_CUPY_PYLOPS=1 + uv run pytest --color=yes pytests/ + ' + echo "done!"