docker 使用GPU的過程詳解
以TensorFlow2.0為例
下載tf-gpu
在docker hub里選擇要下載的tf版本(注意選帶GPU和py3的)
https://hub.docker.com/r/tensorflow/tensorflow/
如:
docker pull tensorflow/tensorflow:2.0.3-gpu-py3
如果上述下載超時,可以配置清華源。
或者通過如下命令下載:
docker pull docker.mirrors.ustc.edu.cn/tensorflow/tensorflow:2.0.3-gpu-py3
基于拉的tf-gpu鏡像構(gòu)建自己的鏡像
如下dockerfile
FROM docker.mirrors.ustc.edu.cn/tensorflow/tensorflow:2.0.3-gpu-py3 RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone && \ pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy pandas sklearn scipy matplotlib seaborn pyyaml h5py hdfs RUN pip install deepctr[gpu] -i http://pypi.douban.com/simple --trusted-host pypi.douban.com RUN pip install keras==2.3.1 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com # cd /data/wangguisen/ad_ctr # docker build -t tf-deepctr:1.0 -f ./dk/Dockerfile_base .
啟動鏡像檢查GPU是否可用
docker run --gpus '"device=0"' \ --rm -it --name ad_ctr \ -v /data/wangguisen/ad_ctr:/data/ad_ctr \ tf-deepctr:1.0
輸入 nvidia-smi
如果出現(xiàn)0號顯卡的信息說明成功。
參考自:
https://blog.csdn.net/weixin_35725559/article/details/112268434
https://zhuanlan.zhihu.com/p/83691871
到此這篇關(guān)于docker 使用GPU的過程詳解的文章就介紹到這了,更多相關(guān)docker 使用GPU內(nèi)容請搜索本站以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持本站!
版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。