NVIDIA-docker Cheatsheet
TensorFlow Docker requirements
- Install Docker on your local host machine.
- For GPU support on Linux, install nvidia-docker.
Note: To run the docker command without sudo, create the docker group and add your user. For details, see the post-installation steps for Linux.
Download a TensorFlow Docker image
The official TensorFlow Docker images are located in the tensorflow/tensorflow Docker Hub repository. Image releases are tagged using the following format:
| Tag | Description |
|---|---|
latest |
The latest release of TensorFlow CPU binary image. Default. |
nightly |
Nightly builds of the TensorFlow image. (unstable) |
version |
Specify the version of the TensorFlow binary image, for example: 1.14.0 |
devel |
Nightly builds of a TensorFlow master development environment. Includes TensorFlow source code. |
Each base tag has variants that add or change functionality:
| Tag Variants | Description |
|---|---|
tag-gpu |
The specified tag release with GPU support. (See below) |
tag-py3 |
The specified tag release with Python 3 support. |
tag-jupyter |
The specified tag release with Jupyter (includes TensorFlow tutorial notebooks) |
You can use multiple variants at once. For example, the following downloads TensorFlow release images to your machine:
docker pull tensorflow/tensorflow # latest stable releasedocker pull tensorflow/tensorflow:devel-gpu # nightly dev release w/ GPU supportdocker pull tensorflow/tensorflow:latest-gpu-jupyter # latest release w/ GPU support and Jupyter
Start a TensorFlow Docker container
To start a TensorFlow-configured container, use the following command form:
docker run [-it] [--rm] [-p hostPort:containerPort] tensorflow/tensorflow[:tag] [command]
For details, see the docker run reference.
Examples using CPU-only images
Let's verify the TensorFlow installation using the latest tagged image. Docker downloads a new TensorFlow image the first time it is run:
docker run -it --rm tensorflow/tensorflow \
python -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"
Success: TensorFlow is now installed. Read the tutorials to get started.
Let's demonstrate some more TensorFlow Docker recipes. Start a bash shell session within a TensorFlow-configured container:
docker run -it tensorflow/tensorflow bash
Within the container, you can start a python session and import TensorFlow.
To run a TensorFlow program developed on the host machine within a container, mount the host directory and change the container's working directory (-v hostDir:containerDir -w workDir):
docker run -it --rm -v $PWD:/tmp -w /tmp tensorflow/tensorflow python ./script.py
Permission issues can arise when files created within a container are exposed to the host. It's usually best to edit files on the host system.
Start a Jupyter Notebook server using TensorFlow's nightly build with Python 3 support:
docker run -it -p 8888:8888 tensorflow/tensorflow:nightly-py3-jupyter
Follow the instructions and open the URL in your host web browser: http://127.0.0.1:8888/?token=...
GPU support
Docker is the easiest way to run TensorFlow on a GPU since the host machine only requires the NVIDIA® driver (the NVIDIA® CUDA® Toolkit is not required).
Install nvidia-docker to launch a Docker container with NVIDIA® GPU support. nvidia-docker is only available for Linux, see their platform support FAQ for details.
Check if a GPU is available:
lspci | grep -i nvidia
Verify your nvidia-docker installation:
docker run --runtime=nvidia --rm nvidia/cuda nvidia-smi
Note: nvidia-docker v1 uses the nvidia-docker alias, where v2 uses docker --runtime=nvidia.
Examples using GPU-enabled images
Download and run a GPU-enabled TensorFlow image (may take a few minutes):
docker run --runtime=nvidia -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])))"
It can take a while to set up the GPU-enabled image. If repeatably running GPU-based scripts, you can use docker execto reuse a container.
Use the latest TensorFlow GPU image to start a bash shell session in the container:
docker run --runtime=nvidia -it tensorflow/tensorflow:latest-gpu bash
NVIDIA-docker Cheatsheet的更多相关文章
- CentOS7 Nvidia Docker环境
最近在搞tensorflow的一些东西,话说这东西是真的皮,搞不懂.但是环境还是磕磕碰碰的搭起来了 其实本来是没想到用docker的,但是就一台配置较好电的服务器,还要运行公司的其他环境,vmware ...
- ubuntu18.04配置nvidia docker和远程连接ssh+远程桌面连接(一)
ubuntu18.04配置nvidia docker和远程连接ssh+远程桌面连接(一) 本教程适用于想要在远程服务器上配置docker图形界面用于深度学习的用户. (一)ubuntu18.04配置n ...
- ubuntu18.04配置nvidia docker和远程连接ssh+远程桌面连接(三)
ubuntu18.04配置nvidia docker和远程连接ssh+远程桌面连接(三) 本教程适用于想要在远程服务器上配置docker图形界面用于深度学习的用户. (三)配置远程桌面连接访问dock ...
- ubuntu18.04配置nvidia docker和远程连接ssh+远程桌面连接(二)
ubuntu18.04配置nvidia docker和远程连接ssh+远程桌面连接(二) 本教程适用于想要在远程服务器上配置docker图形界面用于深度学习的用户. (二)nvidia docker配 ...
- centos7 安装 NVIDIA Docker
安装环境: 1.centos7.3 2.NVIDIA Corporation GP106 [GeForce GTX 1060 6GB] 安装nvidia-docker a.安装docker 可参考ce ...
- Docker Cheatsheet
一.创建 docker create:创建容器,处于停止状态. centos:latest:centos容器:最新版本(也可以指定具体的版本号).本地有就使用本地镜像,没有则从远程镜像库拉取.创建成功 ...
- docker 系列 - Docker CheatSheet | Docker 配置与实践清单 (转载)
本文转载自 (https://segmentfault.com/a/1190000016447161), 感谢作者.
- Ubuntu16.04下nvidia驱动+nvidia-docker+cuda9+cudnn7安装
一.宿主机安装nvidia驱动 打开终端,先删除旧的驱动: sudo apt-get purge nvidia* 禁用自带的 nouveau nvidia驱动 sudo gedit /etc/modp ...
- 基于Docker容器使用NVIDIA-GPU训练神经网络
一,nvidia K80驱动安装 1, 查看服务器上的Nvidia(英伟达)显卡信息,命令lspci |grep NVIDIA 05:00.0 3D controller: NVIDIA Corpo ...
- kubectl kubernetes cheatsheet
from : https://cheatsheet.dennyzhang.com/cheatsheet-kubernetes-a4 PDF Link: cheatsheet-kubernetes-A4 ...
随机推荐
- 201871010102-《面向对象程序设计(java)》第6-7周学习总结
博文正文开头:(2分) 项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ 这个作业的要求在哪里 https://www.cnblogs.com/ ...
- CSP 201812-2 小明放学
问题描述: 解题思路: 由于数据的量较大,需要使用long long来存储结果,否则会爆掉结果只能得到一部分的分 可以类比时钟,将红绿灯的变换当成时钟的运转,这样用模运算来断定红绿灯在到达时处于什么颜 ...
- nginx 静态资源服务
1.文件压缩 location ~ .*\.(jpg|gif|png)$ { gzip on(开启); gzip_http_version 1.1(版本); gzip_comp_level 2(压缩比 ...
- c语言定义的几种易错的说明
int p; //一个整数 int p [5]; //一个包含5个整数的数组 int * p; //指向整数的指针 int * p [10]; //一个包含10个整数指针的数组 int ** p; / ...
- 异常CLRDBG_NOTIFICATION_EXCEPTION_CODE( 0x04242420)的抛出过程
新建一个c#控制工程,就用自动生成的代码,不用补任何代码,如下: using System; using System.Collections.Generic; using System.Linq; ...
- A 题解————2019.10.16
[题目描述] 对于给定的一个正整数n, 判断n是否能分成若干个正整数之和 (可以重复) ,其中每个正整数都能表示成两个质数乘积. [输入描述]第一行一个正整数 q,表示询问组数.接下来 q 行,每行一 ...
- PATA1082Read Number in Chinese
有几点需要注意的地方一是将right转化为与left在在同一节 while (left + 4 <= right) { right -= 4;//每次将right移动4位,直到left与righ ...
- 【图解】给面试官解释TCP的三次握手与四次挥手-Web运用原理及网络基础
作者 | Jeskson 来源 | 达达前端小酒馆 轻松了解HTTP协议 为什么要学习网络协议呢?为什么要学习计算机完了呢?显然这很重要,至少能够帮助你找到工作的原因之一,学习网络知识点太多太多,没有 ...
- 使用jackson转换xml格式数据进行响应
最近在做微信扫码支付的功能,按照微信开发文档与支付平台进行数据交互只能使用XML格式的数据,调用别人定义的接口就需要按规则来嘛,没办法.自己之前使用jackson,主要是因为SpringMVC默认将j ...
- Linux搭建简单的http文件服务器
为了让自动化脚本可以通过wget来下载安装包,需要在集群中的某个节点部署一个http文件服务器 在Ubuntu中通过apt-get install apache2 安装apache2CentOS7中通 ...