nvidia-docker 和 docker 的安装
经历了无数次失败,楼主终于装上了nvidia-docker,值得庆祝。写个博客造福社会,不谢!楼主环境:Ubuntu16.04 新装的纯净系统第一步,先装CUDA和CUDNN1。下载CUDA9.0和CUDNN7.5,绝对不可以弄错2。如果之前装得有其他版本,请卸载sudo /usr/local/cuda-8.0/bin/uninstall_cuda_8.0.plsudo ...
经历了无数次失败,楼主终于装上了nvidia-docker,值得庆祝。写个博客造福社会,不谢!
楼主环境:Ubuntu16.04 新装的纯净系统
第一步,先装CUDA和CUDNN
1。下载CUDA9.0和CUDNN7.5,绝对不可以弄错
2。如果之前装得有其他版本,请卸载
sudo /usr/local/cuda-8.0/bin/uninstall_cuda_8.0.pl
sudo rm -rf /usr/local/cuda-8.0/
3。安装
./cuda_10.0.130_410.48_linux.run
accept
n
y
y
n
vim ~/.bashrc
#添加以下三行:
export CUDA_HOME=/usr/local/cuda-10.0
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64
export PATH=${CUDA_HOME}/bin:${PATH}
source ~/.bashrc
nvcc -
#如果出现以下信息,表明安装成功
test@test:~$ nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2018 NVIDIA Corporation Built on Sat_Aug_25_21:08:01_CDT_2018 Cuda compilation tools, release 10.0, V10.0.130
解压CUDNN,出现cuda文件夹
cp cuda/lib64/* /usr/local/cuda-10.0/lib64/
cp cuda/include/* /usr/local/cuda-10.0/include/
第二步,安装docker
# step 0:移除先前版本
sudo apt-get remove docker docker-engine docker.io
# step 1: 安装必要的一些系统工具
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# step 2: 安装GPG证书
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# Step 3: 写入软件源信息
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
# Step 4: 更新并安装 Docker-CE
sudo apt-get -y update
sudo apt-get -y install docker-ce
# Step 5:测试
docker version
第三步,安装nvidia-docker
参见 https://github.com/NVIDIA/nvidia-docker
# If you have nvidia-docker 1.0 installed: we need to remove it and all existing GPU containers
docker volume ls -q -f driver=nvidia-docker | xargs -r -I{} -n1 docker ps -q -a -f volume={} | xargs -r docker rm -f
sudo apt-get purge -y nvidia-docker
# Add the package repositories
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | \
sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
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
# Install nvidia-docker2 and reload the Docker daemon configuration
sudo apt-get install -y nvidia-docker2
sudo pkill -SIGHUP dockerd
# Test nvidia-smi with the latest official CUDA image
docker run --runtime=nvidia --rm nvidia/cuda:9.0-base nvidia-smi
此时,如果报错,说明安装失败。楼主就报错了。则执行第四步。
第四步,配置驱动
# Test nvidia-smi with the latest official CUDA image
docker run --runtime=nvidia --rm nvidia/cuda:9.0-base nvidia-smi
大功告成!成功请留言,哈哈!
更多推荐
所有评论(0)