Added sample-run for tensorflow
This commit is contained in:
31
sample-run/tensorflow/roles/nvidia/README.md
Normal file
31
sample-run/tensorflow/roles/nvidia/README.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# The `nvidia` Role
|
||||
|
||||
The `nvidia` role installs the Nvidia Docker runtime, enabling access to Nvidia CUDA GPU hardware from within Docker containers.
|
||||
|
||||
This role may be executed independently by running:
|
||||
|
||||
```bash
|
||||
$ ansible-playbook packages.yml --tags "nvidia"
|
||||
```
|
||||
|
||||
On execution, this role installs the following directly to the remote machine's operating system:
|
||||
|
||||
### Apt Repositories (Debian/Ubuntu)
|
||||
|
||||
- libnvidia_container
|
||||
- nvidia_container_runtime
|
||||
- nvidia_docker
|
||||
|
||||
### Apt GPG Signing Keys (Debian/Ubuntu)
|
||||
|
||||
- NVIDIA CORPORATION (Open Source Projects) <cudatools@nvidia.com>
|
||||
|
||||
### Operating System Packages (Debian/Ubuntu)
|
||||
|
||||
- nvidia-docker2 v2.x
|
||||
|
||||
Containers are launched with the Nvidia Docker runtime by passing the `--runtime=nvidia` flag, e.g.,
|
||||
|
||||
```bash
|
||||
$ docker run --rm --runtime=nvidia nvidia/cuda nvidia-smi
|
||||
```
|
||||
0
sample-run/tensorflow/roles/nvidia/files/.gitkeep
Normal file
0
sample-run/tensorflow/roles/nvidia/files/.gitkeep
Normal file
6
sample-run/tensorflow/roles/nvidia/handlers/main.yml
Normal file
6
sample-run/tensorflow/roles/nvidia/handlers/main.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: reload the docker service
|
||||
systemd:
|
||||
name: docker
|
||||
state: reloaded
|
||||
listen: "reload the docker service"
|
||||
0
sample-run/tensorflow/roles/nvidia/meta/.gitkeep
Normal file
0
sample-run/tensorflow/roles/nvidia/meta/.gitkeep
Normal file
31
sample-run/tensorflow/roles/nvidia/tasks/debian.yml
Normal file
31
sample-run/tensorflow/roles/nvidia/tasks/debian.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
# Nvidia Docker Runtime Installation
|
||||
- name: get the NVIDIA signing key
|
||||
apt_key:
|
||||
state: present
|
||||
url: "{{ nvidia.apt.signing_key_url }}"
|
||||
|
||||
- name: add the libnvidia-container repo
|
||||
apt_repository:
|
||||
filename: "{{ nvidia.apt.repo_filename }}"
|
||||
repo: "{{ nvidia.apt.repos.libnvidia_container }}"
|
||||
state: present
|
||||
|
||||
- name: add the nvidia-container-runtime repo
|
||||
apt_repository:
|
||||
filename: "{{ nvidia.apt.repo_filename }}"
|
||||
repo: "{{ nvidia.apt.repos.nvidia_container_runtime }}"
|
||||
state: present
|
||||
|
||||
- name: add the nvidia-docker repo
|
||||
apt_repository:
|
||||
filename: "{{ nvidia.apt.repo_filename }}"
|
||||
repo: "{{ nvidia.apt.repos.nvidia_docker }}"
|
||||
state: present
|
||||
|
||||
- name: install the nvidia-docker2 runtime
|
||||
apt:
|
||||
name: "{{ nvidia.apt.package }}"
|
||||
state: present
|
||||
update_cache: yes
|
||||
notify: "reload the docker service"
|
||||
4
sample-run/tensorflow/roles/nvidia/tasks/main.yml
Normal file
4
sample-run/tensorflow/roles/nvidia/tasks/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
# Nvidia Docker Runtime Setup
|
||||
- import_tasks: debian.yml
|
||||
when: ansible_facts['os_family']|lower == 'debian' # debian, ubuntu
|
||||
10
sample-run/tensorflow/roles/nvidia/vars/main.yml
Normal file
10
sample-run/tensorflow/roles/nvidia/vars/main.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
nvidia:
|
||||
apt:
|
||||
package: nvidia-docker2=2.* # known good with 2.0.3+docker18.09.1-1
|
||||
repo_filename: nvidia_github_io_nvidia_docker_ubuntu18_04_nvidia_docker.list
|
||||
repos:
|
||||
libnvidia_container: deb https://nvidia.github.io/libnvidia-container/ubuntu18.04/$(ARCH) /
|
||||
nvidia_container_runtime: deb https://nvidia.github.io/nvidia-container-runtime/ubuntu18.04/$(ARCH) /
|
||||
nvidia_docker: deb https://nvidia.github.io/nvidia-docker/ubuntu18.04/$(ARCH) /
|
||||
signing_key_url: https://nvidia.github.io/nvidia-docker/gpgkey
|
||||
Reference in New Issue
Block a user