Skip to content

Commit c37d362

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

1 file changed

Lines changed: 68 additions & 7 deletions

File tree

.github/workflows/_build_windows.yml

Lines changed: 68 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,72 @@ 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: Unit test
103+
run: |
104+
nvidia-smi
105+
106+
if [[ "${{ inputs.free-threaded }}" == 'ft' ]]; then
107+
conda install -q -c conda-forge python-freethreading
108+
fi
109+
110+
# Install SPDL
111+
pip install $(find package -name '*.whl' -depth -maxdepth 1)
112+
113+
# Install PyTorch and others
114+
if [[ "${{ inputs.free-threaded }}" == 'ft' ]]; then
115+
pip install torch numpy pytest
116+
else
117+
pip install torch numpy numba pytest
118+
fi
119+
120+
# Install FFmpeg
121+
conda install -q -c conda-forge "ffmpeg==${{ matrix.ffmpeg-version }}"
122+
123+
# Run test
124+
python -c 'import spdl.io.utils;assert spdl.io.utils.built_with_cuda()'
125+
if "${{ inputs.use-nvdec == 'nvdec' }}" ; then
126+
python -c 'import spdl.io.utils;assert spdl.io.utils.built_with_nvcodec()'
127+
fi
128+
pytest -v \
129+
tests/spdl_unittest/cuda/ \
130+
tests/spdl_unittest/io/
131+
132+
test-cpu:
73133
if: "${{ inputs.run-test == 'true' }}"
74-
name: "test ffmpeg"
134+
name: "test-cpu ffmpeg"
75135
needs: ["build"]
76136
strategy:
77137
fail-fast: false
78138
matrix:
79139
ffmpeg-version: ["8.0"]
80-
runs-on: "${{ inputs.os }}"
140+
runs-on: "${{ inputs.machine }}"
81141
defaults:
82142
run:
83143
shell: bash -el {0}
@@ -115,6 +175,7 @@ jobs:
115175
# Install FFmpeg
116176
conda install -q -c conda-forge "ffmpeg==${{ matrix.ffmpeg-version }}"
117177
178+
# Run test
118179
pytest -v \
119180
tests/spdl_unittest/io/ \
120181
tests/spdl_unittest/dataloader/

0 commit comments

Comments
 (0)