参考链接: http://tleyden.github.io/blog/2014/10/25/docker-on-aws-gpu-ubuntu-14-dot-04-slash-cuda-6-dot-5/
- 环境:docker已安装完毕,docker内的images也有了(ubuntu14.04),在宿主机上,显卡(gtx titan x)和cuda也安装好了, cuda安装文件也是主目录下: cuda_7.0.28_linux.run
- 开始:开启一个container,同时挂载上宿主机的gpu设备以及cuda驱动 cuda_7.0.28_linux.run:
- 注: 红色 部分视具体情况而定
DOCKER_NVIDIA_DEVICES="--device /dev/nvidia0:/dev/nvidia0 --device /dev/nvidiactl:/dev/nvidiactl --device /dev/nvidia-uvm:/dev/nvidia-uvm"
sudo docker run -ti $DOCKER_NVIDIA_DEVICES -v ~/cuda_7.0.28_linux.run:/cuda_7.0.run imagename /bin/bash
- 安装 build essentail:
apt-get install build-essential
- 将 cuda 安装文件解压出来,一个一个安装:
mkdir nvidia_installers ./cuda_7.0.run -extract=/nvidia_installers cd nvidia_installers ./NVIDIA-Linux-x86_64-xxxx.run -s -N --no-kernel-module ./cuda-linux64-rel-xxxx.run -noprompt ./cuda-samples-linux-xxxx.run -noprompt -cudaprefix=/usr/local/cuda-7.0/
- 设置环境变量:/etc/enviroment
LIBRARY_PATH="/usr/local/cuda-7.0/lib64" PATH="xxxxxxxxxx:/usr/local/cuda-7.0/bin"
- 检测安装是否成功:
cd /usr/local/cuda/samples/1_Utilities/deviceQuery make ./deviceQuery
- 最后,将这个container保存成image即可
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:[Tips]docker+ubuntu14.04+cuda7.0 - Python技术站