1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Debian 10.2 buster に nvidia-dockerを入れたときのメモ

Last updated at Posted at 2020-02-02

初期状態

  • 使ってるGPU: Geforce GTX 1060

  • busterで提供されているnvidia-driverをすでに入れた状態

    • 418.74が入っていた
  • nvidia-dockerもすでに入れた状態

    • でもエラーでうまくgpuがdocker経由で呼べないので実質意味なし
  • エラー:

docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]].
ERRO[0000] error waiting for container: context canceled 

1. nvidia提供のもっと新しいドライバーを手に入れる

2. リカバリーモードでdebianを起動し、440.44をインストール

  • リカバリーモードは起動時にgrubのメニューのAdvanced Optionsから選択できる
  • ターミナルに入ったら管理者パスワードを入力する
  • とりえあずnvidia系のものを全部一旦消す
# apt purge nvidia-*
  • 440.44を入れる
    • 選択肢は全部YESにした
# bash NVIDIA-Linux-x86_64-440.44.run
  • インストールできたら通常モードで立ち上げ直す

3. NVIDIA Container Runtimeをインストール

  • container.shというスクリプトを作成:
curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | \
  sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.list | \
  sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list
sudo apt-get update
  • インストール
$ sudo bash container.sh
  • dockerも再起動
$ sudo systemctl restart docker

4. docker上でgpuが呼べるかチェック

$ docker run --gpus all nvidia/cuda:10.2-base nvidia-smi
Sun Feb  2 04:52:15 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.44       Driver Version: 440.44       CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 106...  Off  | 00000000:1F:00.0  On |                  N/A |
|  0%   51C    P8     7W / 200W |    322MiB /  6077MiB |      1%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
+-----------------------------------------------------------------------------+

Appendix: Tensorflow 2.1のjupyterを起動する

  • latestは2.1.0 (2020/02/08現在)
  • py3指定も必須なので注意
$ docker run --gpus all -it -p 8888:8888 tensorflow/tensorflow:latest-gpu-py3-jupyter

おわりに

  • インストール作業の実行は自己責任でお願いします
1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?