Home / Blog / Cost and billing
How do I run GPU tests in GitHub Actions?
Use a GitHub-hosted GPU larger runner (Tesla T4, Team or Enterprise Cloud, $0.052 a minute on Linux) or a self-hosted GPU machine. Setup, a first step and cost control.
Create a GPU-powered larger runner in your organization, point a job at it with runs-on, and make nvidia-smi its first step. GitHub’s GPU runner has 4 vCPUs, one Tesla T4 with 16 GB of VRAM and 28 GB of RAM, needs the Team or Enterprise Cloud plan, and costs $0.052 a minute on Linux and $0.102 on Windows. Or run your own GPU machine as a self-hosted runner, but never for a public repository. Our GitHub Actions runner size guide compares the sizes.
- GitHub's GPU larger runner has 4 vCPUs, one Tesla T4 with 16 GB of VRAM, 28 GB of RAM and a 176 GB SSD, on Ubuntu or Windows.
- GitHub's rate reference lists $0.052 a minute on Linux and $0.102 on Windows, read on the date this post was last checked.
- Larger runners need the Team or Enterprise Cloud plan and are not free in public repositories.
- Make nvidia-smi the first step, and run GPU jobs on a label, a nightly schedule or a path filter.
- A self-hosted GPU machine works for any GPU, but GitHub says self-hosted runners should almost never serve a public repository.
This post covers the hardware, the price, the setup, a first step that proves the GPU is there, three ways to keep the bill small and the self-hosted route. It states GitHub’s facts, read from GitHub’s pages on the date this post was last checked. We do not sell a GPU runner.
What GPU does GitHub give you?
| Spec | Value |
|---|---|
| vCPUs | 4 |
| GPU | 1, an NVIDIA Tesla T4 |
| GPU memory (VRAM) | 16 GB |
| RAM | 28 GB |
| SSD | 176 GB |
| Operating system | Ubuntu or Windows |
One configuration, with one GPU type. GitHub made GPU hosted runners generally available on 8 July 2024 for Windows and Linux, with T4 GPUs, and its larger-runners reference lists only this row. We found no page that lets you choose another GPU, such as an A100 or an H100, so if your tests need one, the GitHub-hosted route is not available and the self-hosted one is. The changelog adds that these runners support the static IP and private networking features.
How much does a GitHub Actions GPU runner cost?
| Runner | GitHub's name for it | Rate |
|---|---|---|
| Linux, 4-core GPU | linux_4_core_gpu | $0.052 a minute |
| Windows, 4-core GPU | windows_4_core_gpu | $0.102 a minute |
Billing is per minute, and GitHub rounds each job up to a whole minute. A larger runner is not free in a public repository. The rate reference says the cost of eligible usage can draw from the included value for billing accounts on Team and Enterprise Cloud, and the same page puts a standard 2-core Linux runner at $0.006 a minute, so a GPU minute on Linux costs a little under nine of those. A nightly ten-minute GPU job on Linux is 10 × $0.052 = $0.52 a night, and $15.60 over 30 nights. GitHub allows 100 concurrent GPU jobs on both plans, which support can raise. The runner size guide has GitHub’s rates for the CPU sizes, which is the comparison to make before you put a test on a GPU.
Some pages and blogs still quote other figures for these runners. The ones above are GitHub’s rate reference as it stood on the date this post was last checked. Rates change, so check the page before you budget.
How do I set up a GPU runner and run a job on it?
In your organization’s Settings → Actions → Runners choose New runner, then New GitHub-hosted runner. Pick an image on the Partner tab, where GitHub puts the GPU-optimized images, and a size on the GPU-powered tab, then Create runner. Repositories reach a larger runner through its runner group. In a workflow you target the runner by its name, which is also its label, or by its group. This job has not been run, because it needs a GPU runner we do not have; it was linted with actionlint 1.7.12.
name: gpu-tests
on:
workflow_dispatch:
permissions:
contents: read
jobs:
gpu:
runs-on:
group: gpu-runners
steps:
- uses: actions/checkout@v7
- name: Show the GPU
run: nvidia-smi
- name: Run the GPU tests
run: ./run-gpu-tests.sh
Keep nvidia-smi as the first step. It prints the driver and the device, so a job that landed on a runner without a working GPU fails at once and says why, instead of failing inside your tests with a library error. The step is the one NVIDIA’s RAPIDS deployment guide uses in its GitHub Actions example.
How do I keep GPU costs down?
Run GPU jobs on purpose. NVIDIA’s RAPIDS guide to GitHub Actions recommends setting a spending limit and running GPU CI intentionally, not on every pull request, and gives three ways: a label that a maintainer applies, a nightly schedule, and a path filter. Test your logic on a CPU runner and keep the GPU job to what needs the device. The job below runs when someone adds a run-gpu-tests label to a pull request, and on a nightly schedule.
name: gpu-tests
on:
pull_request:
types: [labeled]
schedule:
- cron: "43 2 * * *"
permissions:
contents: read
jobs:
gpu:
if: github.event_name == 'schedule' || github.event.label.name == 'run-gpu-tests'
runs-on:
group: gpu-runners
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- run: nvidia-smi
- run: ./run-gpu-tests.sh
The timeout-minutes line is the one that stops a hung test from billing for six hours, the default limit GitHub documents for a job. Our limits post lists it with the rest, and the pricing post has the other rows of GitHub’s rate card.
Can I use my own GPU machine?
Yes, and it is the only way to a GPU other than the T4. A self-hosted runner can be a physical machine, a virtual one, a container, on-premises or in a cloud, so any machine with a GPU qualifies. GitHub’s secure-use guidance is firm about the catch: self-hosted runners should almost never be used for public repositories, because anyone who can open a pull request can run code on them, and unlike GitHub’s hosted runners they are not guaranteed to be clean for each job. Use it for private repositories, and run the GPU job only on trusted events.
One more fact for a reader who has found this post while choosing where to run CI: our runners have no GPU, as the labels page says. A workflow that needs one stays on GitHub’s GPU runner or your own machine. Our per-minute rate for every size, beside GitHub’s, is on the GitHub Actions runner pricing page.
Sources
- Larger runners reference (docs.github.com)
- Actions runner pricing (docs.github.com)
- Actions limits (docs.github.com)
- Managing larger runners (docs.github.com)
- Running jobs on larger runners (docs.github.com)
- GitHub Actions: GPU hosted runners are now generally available (GitHub changelog, 8 July 2024) (github.blog)
- Self-hosted runners (docs.github.com)
- Secure use reference (docs.github.com)
- GitHub Actions (RAPIDS Deployment Documentation, NVIDIA) (docs.nvidia.com)
Frequently asked questions
How do I run GPU tests in GitHub Actions?
Create a GPU-powered larger runner in your organization's runner settings, add it to a runner group, and target it with runs-on. Make nvidia-smi the first step. Or use your own GPU machine as a self-hosted runner, never for a public repository.
What GPU does a GitHub-hosted GPU runner have?
One NVIDIA Tesla T4 with 16 GB of VRAM, with 4 vCPUs, 28 GB of RAM and a 176 GB SSD, on Ubuntu or Windows. GitHub's larger-runners reference lists no other GPU configuration.
How much does a GitHub Actions GPU runner cost?
GitHub's rate reference, read on the date this post was last checked, lists $0.052 a minute for the Linux 4-core GPU runner and $0.102 for Windows. Each job is rounded up to a whole minute, and larger runners are not free in public repositories.
Can I use a GPU runner on a free plan?
Not a GitHub-hosted one. GitHub says larger runners are available only to organizations and enterprises on the Team or Enterprise Cloud plans. A self-hosted runner on your own GPU machine has no such plan requirement.