Add GitHub Actions workflows to test GPU runner access #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: GPU Test | |
| on: | |
| push: | |
| branches: [ proton ] | |
| pull_request: | |
| branches: [ main, proton ] | |
| workflow_dispatch: | |
| jobs: | |
| gpu-hello-world: | |
| # Try GitHub's GPU-enabled runners | |
| # For open source projects: https://docs.github.com/en/actions/using-github-hosted-runners/about-larger-runners | |
| runs-on: ubuntu-latest-4-cores-gpu | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Check CUDA availability | |
| run: | | |
| echo "=== Checking for NVIDIA GPU ===" | |
| nvidia-smi || echo "nvidia-smi not available" | |
| echo "" | |
| echo "=== Checking for CUDA ===" | |
| nvcc --version || echo "nvcc not available" | |
| echo "" | |
| echo "=== GPU Device Info ===" | |
| if command -v nvidia-smi &> /dev/null; then | |
| nvidia-smi --query-gpu=name,driver_version,memory.total --format=csv | |
| fi | |
| - name: Simple CUDA test | |
| run: | | |
| if command -v nvcc &> /dev/null; then | |
| echo "=== Compiling simple CUDA program ===" | |
| cat > test.cu << 'EOF' | |
| #include <stdio.h> | |
| __global__ void hello() { | |
| printf("Hello from GPU thread %d!\n", threadIdx.x); | |
| } | |
| int main() { | |
| printf("Hello from CPU!\n"); | |
| hello<<<1, 4>>>(); | |
| cudaDeviceSynchronize(); | |
| printf("CUDA test completed successfully!\n"); | |
| return 0; | |
| } | |
| EOF | |
| nvcc test.cu -o test_cuda | |
| ./test_cuda | |
| else | |
| echo "CUDA not available, skipping CUDA test" | |
| fi | |
| gpu-fallback-test: | |
| # Fallback to standard runner if GPU runner not available | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Check environment | |
| run: | | |
| echo "=== Standard runner environment ===" | |
| echo "This runner does not have GPU access" | |
| echo "GPU detection:" | |
| lspci | grep -i nvidia || echo "No NVIDIA GPU found" | |
| echo "" | |
| echo "This job exists to ensure CI doesn't fail if GPU runner unavailable" |