summaryrefslogtreecommitdiffstats
path: root/roles/cuda/tasks/cuda_init.yml
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2018-07-05 16:22:58 +0200
committerSuren A. Chilingaryan <csa@suren.me>2018-07-05 16:22:58 +0200
commit0b3d99f96dabb1aa2fbf7f99559852916a97d610 (patch)
treeb56e453cf5182a24c6878c23f5985781928d1e57 /roles/cuda/tasks/cuda_init.yml
parent5416f8599ffa92b69bb87434dc1175d760760bbe (diff)
parent813756495d5ef33fa3cc95d69b6d88418ebe7bb1 (diff)
downloaditm-0b3d99f96dabb1aa2fbf7f99559852916a97d610.tar.gz
itm-0b3d99f96dabb1aa2fbf7f99559852916a97d610.tar.bz2
itm-0b3d99f96dabb1aa2fbf7f99559852916a97d610.tar.xz
itm-0b3d99f96dabb1aa2fbf7f99559852916a97d610.zip
Merge commit '813756495d5ef33fa3cc95d69b6d88418ebe7bb1' as 'roles/cuda'
Diffstat (limited to 'roles/cuda/tasks/cuda_init.yml')
-rw-r--r--roles/cuda/tasks/cuda_init.yml51
1 files changed, 51 insertions, 0 deletions
diff --git a/roles/cuda/tasks/cuda_init.yml b/roles/cuda/tasks/cuda_init.yml
new file mode 100644
index 0000000..9a10284
--- /dev/null
+++ b/roles/cuda/tasks/cuda_init.yml
@@ -0,0 +1,51 @@
+---
+- name: template in cuda_init.sh used during boot
+ template:
+ src: cuda_init.sh.j2
+ dest: /usr/local/bin/cuda_init.sh
+ mode: 0755
+ notify:
+ - Initialize the GPUs
+
+- name: lineinfile/make sure cuda_init.sh script is absent from rc.local
+ lineinfile:
+ dest: /etc/rc.local
+ insertafter: "^touch /var/lock/subsys/local"
+ regexp: "^/bin/bash /usr/local/bin/cuda_init.sh$"
+ line: "/bin/bash /usr/local/bin/cuda_init.sh"
+ state: absent
+
+- name: template in cuda_init.service systemd script
+ template:
+ src: cuda_init.service.j2
+ dest: /etc/systemd/system/cuda_init.service
+ mode: 0644
+ notify:
+ - reload systemd unit files
+ - Restart cuda_init service
+ when: ansible_service_mgr == "systemd"
+
+- name: enable the cuda_init systemd service
+ service:
+ name: cuda_init
+ enabled: yes
+ when: ansible_service_mgr == "systemd"
+
+- name: check if cuda_gpu_name0 ( /dev/nvidia0 ) exists
+ stat:
+ path: "{{ cuda_gpu_name0 }}"
+ register: reg_cuda_gpu_name0
+ check_mode: no
+
+- debug:
+ var: reg_cuda_gpu_name0
+ verbosity: 1
+
+- name: Initialize the GPUs - run cuda_init.sh if there is no /dev/nvidia0
+ command: /bin/bash /usr/local/bin/cuda_init.sh
+ when:
+ - reg_cuda_gpu_name0.stat.exists is defined
+ - reg_cuda_gpu_name0.stat.exists == False
+ - cuda_init_restart_service
+
+# vim:ft=ansible: