Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
5
Help us understand the problem. What is going on with this article?

More than 1 year has passed since last update.

@takeru@github

[2019-08-19] Ubuntu 18.04+Docker(19.03)+NVIDIA GPU環境セットアップ

やり方がまた変わっていたのでメモしておきます。

$ grep PRETTY_NAME /etc/os-release
PRETTY_NAME="Ubuntu 18.04.3 LTS"

(標準で入るドライバを無効化する作業がまず必要かもしれない)

Dockerのインストール

https://docs.docker.com/install/linux/docker-ce/ubuntu/
にしたがってやる。

$ sudo apt-get update
$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo apt-key fingerprint 0EBFCD88
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
$ docker -v
Docker version 19.03.1, build 74b1e89

https://docs.docker.com/install/linux/linux-postinstall/
にしたがってやる。

$ sudo usermod -aG docker $USER
(logout -> login)
$ docker run hello-world
Hello from Docker!
...

NVIDIAドライバ

$ lspci | grep NVIDIA
00:09.0 VGA compatible controller: NVIDIA Corporation GP102 [GeForce GTX 1080 Ti] (rev a1)

$ sudo apt install nvidia-headless-430 nvidia-utils-430

DockerのNVIDIA対応のためのパッケージ

https://github.com/NVIDIA/nvidia-docker
にしたがってやる。

$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
$ curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
$ curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

$ sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit

確認

$ sudo reboot

$ nvidia-smi
...
| NVIDIA-SMI 430.26       Driver Version: 430.26       CUDA Version: 10.2     |
...

$ docker run --gpus all --rm nvidia/cuda nvidia-smi
...
| NVIDIA-SMI 430.26       Driver Version: 430.26       CUDA Version: 10.2     |
...
5
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
5
Help us understand the problem. What is going on with this article?