- Install all required software:
docker
,nvidia-docker
,gitlab-ci-multi-runner
- Execute: curl -s http://localhost:3476/docker/cli
- Use that data to fill devices/volumes/volume_driver fields in /etc/gitlab-runner/config.toml
Last active
September 16, 2020 21:47
-
-
Save Hopobcn/e38726fac4da272341b0e36ef464c744 to your computer and use it in GitHub Desktop.
gitlab-runner configuration file with docker runner for using NVIDIA GPUs (nvidia-docker)
This file contains 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
concurrent = 1 | |
check_interval = 0 | |
[[runners]] | |
name = "Docker runner <---complete-me--->" | |
url = "https://<---complete-me---->" | |
token = "28ce17edc8ea7437f3e49969c86341" | |
executor = "docker" | |
[runners.docker] | |
tls_verify = false | |
image = "nvidia/cuda" | |
privileged = false | |
disable_cache = false | |
devices = ["/dev/nvidiactl", "/dev/nvidia-uvm", "/dev/nvidia-uvm-tools", "/dev/nvidia3", "/dev/nvidia2", "/dev/nvidia1", "/dev/nvidia0"] | |
volumes = ["/cache", "nvidia_driver_384.81:/usr/local/nvidia:ro"] | |
volume_driver = "nvidia-docker" | |
shm_size = 0 | |
[runners.cache] |
Do you guys know how to make it work with docker v19.03.2 which integrates native support for nvidia gpus?
The runtime = "nvidia"
does not work anymore, containers should be executed with --gpus
flag now.
docker run -it --rm --gpus all ubuntu nvidia-smi
it is an open issue and, looking at the comments, it does not seem to be fixed soon.
I am using Docker 19.03 together with nvidia-docker2. This provides the new --gpu
switch, while keeping the compatibility with the old --runtime
switch (refer to https://github.com/NVIDIA/nvidia-docker/tree/master#upgrading-with-nvidia-docker2-deprecated).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems that
environment
in[[runners]]
section is exactly what we were looking for.Actually, whatever environment variable setting that happens before running the
script
section of the.gitlab-ci.yml
configuration file is ok. See the following two examples: both of them worked for me.Example 1: using gitlab-runner configuration only
In
/etc/gitlab-runner/config.toml
:The
.gitlab-ci.yml
file.The two runners have been tagged with
docker, gpu0
anddocker, gpu1
respectively.Example2: using Gitlab CI custom environment variables
Gitlab CI custom environment variables
/etc/gitlab-runner/config.toml
same as Example 1.The
.gitlab-ci.yml
file.