-
Notifications
You must be signed in to change notification settings - Fork 8
/
gpu.yaml
48 lines (41 loc) · 1.27 KB
/
gpu.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
# This way of detecting GPUs is portable and doesn't require root
- name: check for Nvidia GPU
shell:
cmd: awk 'BEGIN{result="false"} $0 ~ /0x10de/ {gsub(/\/vendor/, "/class", FILENAME); getline pciclass < FILENAME; if(pciclass ~ /^0x03/) result="true"} END{print result}' /sys/bus/pci/devices/*/vendor
register: has_nvidia_gpu
- name: Disable Nouveau Driver
include_role:
name: nouveau-blacklist
when:
(gpu | bool) and
(has_nvidia_gpu.stdout == "true")
- name: Install Nvidia Drivers
include_role:
name: nvidia-driver-install
when:
(gpu | bool) and
(has_nvidia_gpu.stdout == "true")
# TODO: Do we need OCI hooks or something else to enable radeon containers like nvidia?
# TODO: What is needed if using docker instead of podman
- name: Install Nvidia OCI Hooks
include_role:
name: nvidia-container-runtime-hook
when:
(gpu | bool) and
(has_nvidia_gpu.stdout == "true") and
(gpu_driver == 'cuda') and
(podman | bool)
- name: Install OpenCL Drivers
include_role:
name: opencl-driver-install
when:
(gpu | bool) and
(gpu_type == 'nvidia') and
(gpu_driver == 'opencl')
- name: Install Radeon Drivers
include_role:
name: radeon-driver-install
when:
(gpu | bool) and
(gpu_type == 'radeon')