How to Use a Cloud GPU Runner in GitHub Actions
A cloud GPU runner is provisioned on demand for a single job and destroyed after, so you pay for GPU time only while the workflow runs.
Point runs-on at a runner group or label backed by a GPU instance type. Providers such as ephemeral runner controllers boot a GPU VM per job, run your steps, then terminate it.
Steps
- Configure a runner group or label mapped to a GPU instance type.
- Reference that label in
runs-on. - Keep the job short so the GPU VM lifetime, and the bill, stays small.
Workflow
.github/workflows/ci.yml
jobs:
gpu-test:
runs-on: gpu-a10g
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- run: nvidia-smi
- run: python -m pytest tests/gpu -qGotchas
- GPU instances cost several times a CPU runner; add a
timeout-minutesso a hang cannot run for hours. - Cold-boot time counts against the job; cache the container image on the instance where possible.
Related guides
How to Run a Job on a Self-Hosted NVIDIA GPU Runner in GitHub ActionsRoute a GitHub Actions job to a self-hosted runner that has an NVIDIA GPU by labeling the runner and selectin…
How to Keep Full Training Out of CI to Control Cost in GitHub ActionsDecide what training runs in GitHub Actions versus an external trainer, keeping smoke tests in CI and dispatc…