Skip to content

Commit c0cc661

Browse files
utilForeverCopilot
andcommitted
Conditionally run CUDA tests on GPU runners
Skip CUDA unit test execution when the runner has no CUDA-capable GPU, while still running tests when GPU is available. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a1709e2 commit c0cc661

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

.github/workflows/ubuntu-cuda.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,9 @@ jobs:
5858
- name: Build
5959
run: cd build && make
6060
- name: Run CUDA Unit Test
61-
run: /home/runner/work/CubbyFlow/CubbyFlow/build/bin/CUDATests
61+
run: |
62+
if command -v nvidia-smi >/dev/null 2>&1 && nvidia-smi -L >/dev/null 2>&1; then
63+
/home/runner/work/CubbyFlow/CubbyFlow/build/bin/CUDATests
64+
else
65+
echo "No CUDA-capable GPU detected on runner. Skipping CUDA unit tests."
66+
fi

.github/workflows/windows-cuda.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,14 @@ jobs:
8484
run: MSBuild.exe "build\\${{ matrix.solution }}" /p:Configuration=Release
8585
- name: Run CUDA Unit Test
8686
shell: powershell
87-
run: /a/CubbyFlow/CubbyFlow/build/bin/Release/CUDATests.exe
87+
run: |
88+
$nvidiaSmi = Get-Command "nvidia-smi.exe" -ErrorAction SilentlyContinue
89+
if ($null -ne $nvidiaSmi) {
90+
& nvidia-smi.exe -L | Out-Host
91+
if ($LASTEXITCODE -eq 0) {
92+
& /a/CubbyFlow/CubbyFlow/build/bin/Release/CUDATests.exe
93+
exit $LASTEXITCODE
94+
}
95+
}
96+
97+
Write-Host "No CUDA-capable GPU detected on runner. Skipping CUDA unit tests."

0 commit comments

Comments
 (0)