主要来源:https://blog.csdn.net/chenfeidi1/article/details/80866944
依赖条件
如果使用的 Tensorflow 版本大于 1.4.0,要求 CUDA 9.0 以上版本。
安装 nvidia-docker
下载安装包:
$ wget https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.1/nvidia-docker-1.0.1-1.x86_64.rpm
安装:
$ rpm -ivh nvidia-docker-1.0.1-1.x86_64.rpm
启动 nvidia-docker 服务
$ sudo systemctl restart nvidia-docker
执行以下命令,若结果显示 active(running) 则说明启动成功:
$ systemctl status nvidia-docker.service
...
Active: active (running) since Thu 2018-05-10 14:12:25 CST; 5s ago
...
使用 nvidia-docker
查看 GPU 信息:
$ nvidia-docker run --rm nvidia/cuda nvidia-smi
启动 Tensorflow:
$ docker pull tensorflow/tensorflow:1.8.0-gpu-py3
$ docker tag tensorflow/tensorflow:1.8.0-gpu-py3 tensorflow:1.8.0-gpu
$ nvidia-docker run -it -p 8888:8888 tensorflow:1.8.0-gpu