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 release
docker pull tensorflow/tensorflow:devel-gpu # nightly dev release w/ GPU support
docker 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 exec
to 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 ...
随机推荐
- nginx.conf 下日志host.access.log 说明
位置usr/local/nginx/conf/nginx.conf $server_port 请求端口 $remote_addr 局域网代理IP:如果没同意任何代理的话$remote_addr 就是真 ...
- Open Physics
1.开放物理计划. 开放物理计划,英文Open Physics.是AMD公司为自己的3A平台打造的物理模拟计算平台,以OpenCL为基础,由CPU+GPU联合计算完成.所谓“开放”,是指参与这个计划的 ...
- wordpress后台添加左侧边栏菜单如何操作
我们有时为了方便操作会把一些特定的链接添加到wordpress后台左侧菜单栏中,这个要如何实现呢?其实不会很难,使用两个WordPress内置函数就可以解决问题,分别是add_menu_page()和 ...
- Java 静态、类加载
1.静态是什么?有什么用? static的主要作用在于创建独立于具体对象的域变量或者方法. 每创建一个对象,都会在堆里开辟内存,存成员(属性),但是不存方法,方法是共用的,没必要每一个对象都浪费内存去 ...
- JSPDF支持中文(思源黑体)采坑之旅,JSPDF中文字体乱码解决方案
我拍个砖,通常标称自己文章完美解决何种问题的,往往就是解决不了任何问题! 众所周知,JSPDF是一个开源的,易用的,但是对中文支持非常差的PDF库. 下面,我教大家,如何在pdf中使用思源黑体.思源黑 ...
- yii2 Query Builder 查询打印sql语句
$query = new Query(); $query->select('gs.*, g.goods_images, sa.attr_name, sa.is_default, sa.alias ...
- IntelliJ IDEA 2019.2已经可以利用补丁永久破解激活了(持续更新)
前面的文章中,一直在强调2019系列的idea无法使用补丁进行永久激活,但是最近发现,已经有大佬可以利用补丁将idea 2019.2及以下版本激活到2089年了,而且还不用改hosts,实在是佩服,不 ...
- 2018-2019-2 网络对抗技术 20165318 Exp7 网络欺诈防范
2018-2019-2 网络对抗技术 20165318 Exp7 网络欺诈防范 原理与实践说明 实践目标 实践内容概述 基础问题回答 实践过程记录 简单应用SET工具建立冒名网站 ettercap D ...
- java对象转变为map
直接上代码 package com.**.**.**.common; import com.**.**.**.util.JsonUtils; import org.springframework.be ...
- Python3.7 - Argparse模块的用法
argparse 是一个命令行参数解析模块. argparse 是python自带的命令行参数解析包,可以用来方便地读取命令行参数,当你的代码需要频繁地修改参数的时候,使用这个工具可以将参数和代码分离 ...