Skip to content

Commit 5957109

Browse files
committed
WIP: Add CUDA test
1 parent f0317ef commit 5957109

1 file changed

Lines changed: 76 additions & 7 deletions

File tree

.github/workflows/_build_windows.yml

Lines changed: 76 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ name: " - Wheel (Windows)"
33
on:
44
workflow_call:
55
inputs:
6+
machine:
7+
type: string
8+
default: "windows-latest"
9+
machine_gpu:
10+
type: string
11+
default: "4-core-windows-gpu-t4"
612
python-version:
713
required: true
814
type: string
@@ -18,9 +24,6 @@ on:
1824
required: false
1925
default: 'false'
2026
type: string
21-
os:
22-
default: "windows-latest"
23-
type: string
2427

2528
env:
2629
ARTIFACT: wheel-win-py${{ inputs.python-version }}${{ inputs.free-threaded }}
@@ -30,7 +33,7 @@ env:
3033

3134
jobs:
3235
build:
33-
runs-on: "${{ inputs.os }}"
36+
runs-on: "${{ inputs.machine }}"
3437
steps:
3538
- uses: actions/checkout@v4
3639
with:
@@ -69,15 +72,80 @@ jobs:
6972
bash `
7073
.github/scripts/windows/check_package.sh
7174
72-
unit-test:
75+
test-gpu:
76+
if: "${{ inputs.run-test == 'true' }}"
77+
name: "test-gpu ffmpeg"
78+
needs: ["build"]
79+
strategy:
80+
fail-fast: false
81+
matrix:
82+
ffmpeg-version: ["8.0"]
83+
runs-on: "${{ inputs.machine_gpu }}"
84+
defaults:
85+
run:
86+
shell: bash -el {0}
87+
steps:
88+
- uses: actions/checkout@v4
89+
with:
90+
persist-credentials: false
91+
92+
- uses: actions/download-artifact@v4
93+
with:
94+
name: "${{ env.ARTIFACT }}"
95+
path: package
96+
97+
- uses: conda-incubator/setup-miniconda@v3
98+
with:
99+
python-version: ${{ inputs.python-version }}
100+
conda-remove-defaults: "true"
101+
102+
- name: Install Cuda Toolkit 12.4 on Windows
103+
shell: bash
104+
run: |
105+
choco install unzip -y --no-progress
106+
107+
.github/scripts/windows/install_cuda_toolkit_12.4.sh
108+
109+
echo "C:\\\\Program Files\\\\NVIDIA GPU Computing Toolkit\\\\CUDA\\\\v12.4\\\\bin" >> $GITHUB_PATH
110+
echo "CUDA_PATH=C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.4" >> $GITHUB_ENV
111+
112+
- name: Unit test
113+
run: |
114+
if [[ "${{ inputs.free-threaded }}" == 'ft' ]]; then
115+
conda install -q -c conda-forge python-freethreading
116+
fi
117+
118+
# Install SPDL
119+
pip install $(find package -name '*.whl' -depth -maxdepth 1)
120+
121+
# Install PyTorch and others
122+
if [[ "${{ inputs.free-threaded }}" == 'ft' ]]; then
123+
pip install torch numpy pytest
124+
else
125+
pip install torch numpy numba pytest
126+
fi
127+
128+
# Install FFmpeg
129+
conda install -q -c conda-forge "ffmpeg==${{ matrix.ffmpeg-version }}"
130+
131+
# Run test
132+
python -c 'import spdl.io.utils;assert spdl.io.utils.built_with_cuda()'
133+
if "${{ inputs.use-nvdec == 'nvdec' }}" ; then
134+
python -c 'import spdl.io.utils;assert spdl.io.utils.built_with_nvcodec()'
135+
fi
136+
pytest -v \
137+
tests/spdl_unittest/cuda/ \
138+
tests/spdl_unittest/io/
139+
140+
test-cpu:
73141
if: "${{ inputs.run-test == 'true' }}"
74-
name: "test ffmpeg"
142+
name: "test-cpu ffmpeg"
75143
needs: ["build"]
76144
strategy:
77145
fail-fast: false
78146
matrix:
79147
ffmpeg-version: ["8.0"]
80-
runs-on: "${{ inputs.os }}"
148+
runs-on: "${{ inputs.machine }}"
81149
defaults:
82150
run:
83151
shell: bash -el {0}
@@ -115,6 +183,7 @@ jobs:
115183
# Install FFmpeg
116184
conda install -q -c conda-forge "ffmpeg==${{ matrix.ffmpeg-version }}"
117185
186+
# Run test
118187
pytest -v \
119188
tests/spdl_unittest/io/ \
120189
tests/spdl_unittest/dataloader/

0 commit comments

Comments
 (0)