From 2262fee263d21214db911c8ee7c6b218ba18f3bd Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Thu, 5 Jul 2018 17:45:37 +0200 Subject: Re-configure CUDA role --- roles/cuda/defaults/main.yml | 6 +++--- roles/cuda/tasks/cuda_init.yml | 5 +---- roles/cuda/tasks/main.yml | 10 +++++++++- roles/cuda/vars/fedora-28.yml | 4 ++++ 4 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 roles/cuda/vars/fedora-28.yml diff --git a/roles/cuda/defaults/main.yml b/roles/cuda/defaults/main.yml index 57efd6b..45ceb29 100644 --- a/roles/cuda/defaults/main.yml +++ b/roles/cuda/defaults/main.yml @@ -2,14 +2,14 @@ # defaults file for ansible-role-cuda # By default gpu is False, set it to True on the gpu nodes in the hosts file -gpu: False +gpu: True cuda_repo_url: "http://developer.download.nvidia.com/compute/cuda/repos/" cuda_rpm_key_path: /etc/rpm/nvidia_packaging_key.asc cuda_packages: - cuda -cuda_restart_node_on_install: True +cuda_restart_node_on_install: False cuda_init: True -cuda_init_restart_service: True +cuda_init_restart_service: False cuda_init_compute_mode: 3 cuda_init_persistence_mode: 1 cuda_gpu_name0: "/dev/nvidia0" diff --git a/roles/cuda/tasks/cuda_init.yml b/roles/cuda/tasks/cuda_init.yml index 9a10284..ff54994 100644 --- a/roles/cuda/tasks/cuda_init.yml +++ b/roles/cuda/tasks/cuda_init.yml @@ -36,10 +36,7 @@ path: "{{ cuda_gpu_name0 }}" register: reg_cuda_gpu_name0 check_mode: no - -- debug: - var: reg_cuda_gpu_name0 - verbosity: 1 + failed_when: false - name: Initialize the GPUs - run cuda_init.sh if there is no /dev/nvidia0 command: /bin/bash /usr/local/bin/cuda_init.sh diff --git a/roles/cuda/tasks/main.yml b/roles/cuda/tasks/main.yml index 6d846f8..f292f67 100644 --- a/roles/cuda/tasks/main.yml +++ b/roles/cuda/tasks/main.yml @@ -10,11 +10,19 @@ - block: - include_tasks: configure_yum.yml - when: ansible_pkg_mgr == 'yum' + when: ansible_pkg_mgr == 'yum' or ansible_pkg_mgr == 'dnf' - include_tasks: configure_apt.yml when: ansible_pkg_mgr == 'apt' + - name: Install kernel development files + package: name=kernel-devel state=present + register: result + + - name: Synchronize kernel and kernel-devel packages + package: name=kernel state=latest + when: (result | changed) + - name: Install CUDA and related packages (1.5-2GB download, also restarts if cuda_restart_node_on_install is set to True) package: name: "{{ item }}" diff --git a/roles/cuda/vars/fedora-28.yml b/roles/cuda/vars/fedora-28.yml new file mode 100644 index 0000000..e8af2d0 --- /dev/null +++ b/roles/cuda/vars/fedora-28.yml @@ -0,0 +1,4 @@ +--- +cuda_repo_subfolder: fedora27 + +# vim:ft=ansible: \ No newline at end of file -- cgit v1.2.3