docker_tf2.0_gpu
docker hub https://hub.docker.com/r/patientzero/tensorflow2.0-gpu-py3.6/tags
docker pull patientzero/tensorflow2.0-gpu-py3.6:latest
https://zhuanlan.zhihu.com/p/65557545 TF2.0教程
https://tensorflow.google.cn/tutorials/customization/basics
docker run --name=tf2.0_gpu -it \
--gpus=all \
--ipc=host \
--user="$(id -u):$(id -g)" \
--volume="/dataa/liwei/tf_2.0_build_model:/app" \
patientzero/tensorflow2.0-gpu-py3.6 /bin/bash
nvidia-docker run --name=tf2.0_gpu -it \
--gpus=all \
--ipc=host \
--user="$(id -u):$(id -g)" \
--volume="/dataa/liwei/tf_2.0_build_model:/app" \
patientzero/tensorflow2.0-gpu-py3.6 /bin/bash
nvidia-smi
docker exec -it 075617abd1f6 /bin/bash
apt-get install vim
CUDA_VISIBLE_DEVICES=3 python pytorch_hotbar_train.py # 指定GPU
总结: 前面的docker 镜像不行 是因为 CUDA 版本是 10.1 与 受主机 10.0 不匹配引起的
-------------------------------------------------------------------------------------------------
ps: 安装了cuda10.0(注意tf2.0只支持cuda10.0)
查看cuda版本: cat /usr/local/cuda/version.txt #CUDA Version 10.0.130
查看cudnn版本: cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2 # 7.6.3
ps: 上面的GPU有点问题
自己在 075617abd1f6 容器中封装一个
docker exec -it 075617abd1f6 /bin/bash
pip install tensorflow-gpu==2.0.0-beta0
--proxy=http://f3410453:Idsbg2017@10.191.131.14:3128 -i https://pypi.tuna.tsinghua.edu.cn/simple
import torch
print(torch.cuda.is_available()) # True
检测tensorflow是否使用gpu进行计算
import tensorflow as tf
print('GPU:', tf.test.is_gpu_available()) # False
-----------------------由于CUDA 版本是 10.1 与受主机 10.0 不匹配 还是不行-------------------------
# 下面测试全部OK ps: 安装了cuda10.0(注意tf2.0只支持cuda10.0)
https://blog.csdn.net/Taylent/article/details/99604468
docker pull sorinasmeureanu/cuda10.0-tf2-py3.7-gpu:latest # 因为239 cuda是10.0
docker run --name=tf2.0_gpu -it \
--gpus=all \
--ipc=host \
--user="$(id -u):$(id -g)" \
--volume="/dataa/liwei/tf_2.0_build_model:/app" \
sorinasmeureanu/cuda10.0-tf2-py3.7-gpu:latest /bin/bash
nvidia-smi
docker exec -it c81d2e3f4b0a /bin/bash # 进入tf2.0_gpu 容器
检测tensorflow是否使用gpu进行计算
import tensorflow as tf
print('GPU:', tf.test.is_gpu_available()) # True 则表示正常
a = [1.0,2.0,3.0,4.0]
sa = tf.nn.softmax(a) # 会看到调用GPU判断 Tesla P100-PCIE-16GB
print(sa)
print(tf.__version__) # '2.0.0'