PyCharm + Docker + GPUs

夙愿已清 提交于 2020-01-16 22:33:30

1.docker运行命令:

docker run --runtime=nvidia -dit --name=my-develop --publish=39822:22 --volume=/home/my/remote_develop:/remote_develop --restart=always euleros-cuda-py373:0.1.0 /bin/bash
 
docker exec -it my-develop /bin/bash
#【ctrl】+【p】 【ctrl】+【q】 (皮球pi_qiu)退出

2.测试GPU:

# 进入镜像
nvidia-docker run -it mxnet/python:gpu bash

#执行python
python
import mxnet as mx
a = mx.nd.ones((2, 3), mx.gpu())
b = a * 2 + 1
b.asnumpy()

参考资料:

https://zhuanlan.zhihu.com/p/27114995

https://blog.51cto.com/5249302/2359420

深度学习环境配置docker+pycharm+GPU

ttps://blog.csdn.net/Ryanpinwei/article/details/78806052

https://cloud.tencent.com/developer/article/1422566

错误:

nvidia-docker run -it mxnet/python:gpu bash

描述:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \"process_linux.go:432: running prestart hook 1 caused \\\"error running hook: exit status 1, stdout: , stderr: nvidia-container-cli: initialization error: driver error: failed to process request\\\\n\\\"\"": unknown.
ERRO[0001] error waiting for container: context canceled 

处理:

sudo su
echo /var/IEF/nvidia/lib64/ > /etc/ld.so.conf.d/nvidia_driver.conf
ldconfig -v
exit
 

sudo chmod 777 /var
sudo chmod 777 /var/IEF
sudo ls /var/IEF/nvidia -d|xargs -I{} sudo chmod 777 {}
sudo ls /var/IEF/* -ld|grep -E "^d"|awk '{print "sudo chmod 777 "$9}'
sudo ls /var/IEF/* -ld|grep -E "^d"|awk '{print "sudo chmod 777 "$9}'|sh
sudo ls /var/IEF/*/* -ld|grep -E "^d"|awk '{print "sudo chmod 777 "$9}'|sh
sudo ls /var/IEF/*/*/* -ld|grep -E "^d"|awk '{print "sudo chmod 777 "$9}'|sh
sudo ls /var/IEF/*/*/*/* -ld|grep -E "^d"|awk '{print "sudo chmod 777 "$9}'|sh

sudo ls -ld /var/IEF/nvidia/* |grep "\-rwxr\-x"|awk '{print "sudo chmod 755 " $9}'|sh
sudo ls -ld /var/IEF/nvidia/drivers/* |grep "\-rwxr\-x"|awk '{print "sudo chmod 755 " $9}'|sh
sudo ls -ld /var/IEF/nvidia/bin/* |grep "\-rwxr\-x"|awk '{print "sudo chmod 755 " $9}'|sh
sudo ls -ld /var/IEF/nvidia/lib64/* |grep "\-rwxr\-x"|awk '{print "sudo chmod 755 " $9}'|sh
sudo ls -ld /var/IEF/nvidia/lib64/vdpau/* |grep "\-rwxr\-x"|awk '{print "sudo chmod 755 " $9}'|sh
nvidia-container-cli -k -d /dev/tty info

 来源:http://www.1994july.club/seojishu/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!