使用TensorFlow Docker for GPU

时间:2019-10-01 17:19:59

标签: python docker tensorflow ubuntu

我刚刚按照建议here使用Docker安装了具有GPU支持的Tensorflow。

据我所知,成功安装Tensorflow是因为执行了以下代码:

sudo docker run --gpus all -it --rm tensorflow/tensorflow:latest-gpu \
python -c "import tensorflow as tf; tf.enable_eager_execution();\
print(tf.reduce_sum(tf.random_normal([1000, 1000])))"

现在我想运行一个模型并使用

sudo docker run -u $(id -u):$(id -g) --gpus all -it tensorflow/tensorflow:latest-gpu-py3

激活容器中的bash shell会话。控制台现在显示以下内容

___  __/__________________________________  ____/__  /________      __
__  /  _  _ \_  __ \_  ___/  __ \_  ___/_  /_   __  /_  __ \_ | /| / /
_  /   /  __/  / / /(__  )/ /_/ /  /   _  __/   _  / / /_/ /_ |/ |/ / 
/_/    \___//_/ /_//____/ \____//_/    /_/      /_/  \____/____/|__/


You are running this container as user with ID 1000 and group 1000,
which should map to the ID and group for your user on the Docker host. Great!

tf-docker / >
tf-docker / > ls
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

但是,如果我更改为home,则找不到我的文件夹和脚本。我如何到达那里?安装期间我出了什么问题吗?

0 个答案:

没有答案