added Cudnn roles

This commit is contained in:
2021-05-25 23:10:22 +04:00
parent c62e0ca288
commit 7742377304
25 changed files with 168 additions and 66 deletions

1
.gitignore vendored
View File

@@ -5,3 +5,4 @@ main
server/docker/__pycache__
p2p-rendering-computation
config.json
*.tgz

2
.idea/vcs.xml generated
View File

@@ -2,5 +2,7 @@
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/sample-run/tensorflow/roles/ansible-role-cudnn" vcs="Git" />
<mapping directory="$PROJECT_DIR$/sample-run/tensorflow/roles/cudnn" vcs="Git" />
</component>
</project>

BIN
p2prc Executable file

Binary file not shown.

View File

@@ -6,7 +6,7 @@ test:
hosts:
test1:
ansible_host: 0.0.0.0 # Replace with your remote IP
ansible_port: 44003 # Replace with your remote SSH port
ansible_port: 38775 # Replace with your remote SSH port
ansible_user: master # Replace wtih your username
ansible_ssh_pass: password
ansible_sudo_pass: password

View File

@@ -26,8 +26,11 @@
# vars:
# users: "{{ secrets.users }}"
- role: cuda # CUDA Driver Setup
tags: [cuda]
# - role: cuda # CUDA Driver Setup
# tags: [cuda]
- role: cudnn
tags: [cudnn]
# - role: nvidia # NVIDIA-Docker Runtime Setup
# tags: [nvidia]

View File

@@ -1,23 +0,0 @@
# The `cuda` Role
The `cuda` role installs the Nvidia CUDA GPU repository and drivers.
This role may be executed independently by running:
```bash
$ ansible-playbook packages.yml --tags "cuda"
```
On execution, this role installs the following directly to the remote machine's operating system:
### Apt Repositories (Debian/Ubuntu)
- Nvidia CUDA
### Apt GPG Signing Keys (Debian/Ubuntu)
- cudatools <cudatools@nvidia.com>
### Operating System Packages (Debian/Ubuntu)
- cuda v10.x

View File

@@ -1,5 +0,0 @@
---
# CUDA Driver Setup
- name: reboot the machine
reboot:
listen: "reboot the machine"

View File

@@ -1,22 +0,0 @@
---
# Cuda Driver Package Installation
- name: copy the CUDA repo onto the machine
copy:
src: "{{ cuda.apt.repo }}"
dest: "{{ general.working_dir }}/{{ cuda.apt.repo }}"
- name: get the CUDA signing key
apt_key:
state: present
url: "{{ cuda.apt.signing_key_url }}"
- name: add the CUDA repo
apt:
deb: "{{ general.working_dir }}/{{ cuda.apt.repo }}"
state: present
- name: install the CUDA drivers
apt:
name: "{{ cuda.apt.package }}"
update_cache: yes
notify: "reboot the machine"

View File

@@ -1,3 +0,0 @@
---
- import_tasks: debian.yml
when: ansible_facts['os_family']|lower == 'debian' # debian, ubuntu

View File

@@ -1,10 +0,0 @@
---
cuda:
apt:
package: cuda=11.* # known good with 10.0.130-1
repo: cuda-11-3_11.3.1-1_amd64.deb # Network install
dependency: cuda-runtime-11-3_11.3.1-1_amd64.deb
signing_key_url: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub
general:
working_dir: /tmp

View File

@@ -0,0 +1 @@
files/

View File

@@ -0,0 +1,29 @@
---
language: python
python: "2.7"
# Use the new container infrastructure
sudo: false
# Install ansible
addons:
apt:
packages:
- python-pip
install:
# Install ansible
- pip install ansible
# Check ansible version
- ansible --version
# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg
script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View File

@@ -0,0 +1,43 @@
Ansible Role: cuDNN
=========
Install [cuDNN](https://developer.nvidia.com/cudnn) on Linux System.
Requirements
------------
- [CUDA Toolkit](https://developer.nvidia.com/cuda-toolkit) installed.
- Download [cuDNN](https://developer.nvidia.com/cudnn) to [`files`](files) folder with your NVIDIA Developer account.
Role Variables
--------------
`cuda_version`: The version of CUDA Toolkit installed. (default: 8.0)
`cudnn_version`: The version cuDNN. (default: v5.1)
Dependencies
------------
None.
Example Playbook
----------------
```yaml
- hosts: gpu
become: yes
roles:
- { role: cudnn, cuda_version: 8.0, cudnn_version: v5.1}
```
License
-------
BSD
Author Information
------------------
This role was created by [Daniel D](https://github.com/djx339).

View File

@@ -0,0 +1,6 @@
---
# defaults file for cudnn
cuda_version: 8.0
cuda_version_str: "v{{ cuda_version }}"
cudnn_version: v5.1

View File

@@ -0,0 +1,2 @@
---
# handlers file for cudnn

View File

@@ -0,0 +1,26 @@
galaxy_info:
author: Daniel D
description: An engineer
company:
license: BSD
min_ansible_version: 1.2
platforms:
- name: Ubuntu
versions:
- all
- trusty
- xenial
- name: CentOS
versions:
- all
galaxy_tags:
- cudnn
- nvidia
- cuda
dependencies: []

View File

@@ -0,0 +1,15 @@
---
# tasks file for cudnn
- name: Create installer dir
file: "path={{ cudnn_installer_dir }} state=directory mode=0755"
- name: Uncompressing cudnn lib
unarchive: "src={{ cudnn_installer.local_file }} dest={{ cudnn_installer_dir }}"
register: __cudnn_result
- name: Install cudnn
shell: cp -rf {{ item.src }} {{ item.dest }}
with_items:
- { src: "{{ cudnn_installer_dir }}/cuda/lib64/*", dest: "/usr/local/cuda/lib64/" }
- { src: "{{ cudnn_installer_dir }}/cuda/include/cudnn.h", dest: "/usr/local/cuda/include/" }
when: __cudnn_result|changed

View File

@@ -0,0 +1 @@
localhost

View File

@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- cudnn

View File

@@ -0,0 +1,31 @@
---
# vars file for cudnn
cudnn_installer_map:
v11.5:
v8.2.0.53:
url: https://developer.nvidia.com/rdp/assets/cudnn-11.3-linux-x64-v8.2.53.tgz
local_file: cudnn-8.0-linux-x64-v5.1.tgz
v8.0:
v6.0:
url: https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v6/prod/8.0_20170427/cudnn-8.0-linux-x64-v6.0-tgz
local_file: cudnn-8.0-linux-x64-v6.0.tgz
v5.1:
url: https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v5.1/prod_20161129/8.0/cudnn-8.0-linux-x64-v5.1-tgz
local_file: cudnn-8.0-linux-x64-v5.1.tgz
v5.0:
url: https://developer.nvidia.com/rdp/assets/cudnn-8.0-linux-x64-v5.0-ga-tgz
local_file: cudnn-8.0-linux-x64-v5.0-ga.tgz
v7.5:
v6.0:
url: https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v6/prod/7.5_20170427/cudnn-7.5-linux-x64-v6.0-tgz
local_file: cudnn-7.5-linux-x64-v6.0.tgz
v5.1:
url: https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v5.1/prod_20161129/7.5/cudnn-7.5-linux-x64-v5.1-tgz
local_file: cudnn-7.5-linux-x64-v5.1.tgz
v5.0:
url: https://developer.nvidia.com/rdp/assets/cudnn-7.5-linux-x64-v5.0-ga.tgz
local_file: cudnn-7.5-linux-x64-v5.0-ga.tgz
cudnn_installer: "{{ cudnn_installer_map[cuda_version_str][cudnn_version] }}"
cudnn_installer_dir: "/tmp/cudnn_installer"