Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions ansible/roles/compute_init/files/compute-init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,22 @@
ansible.builtin.command:
cmd: "cvmfs_config setup"

# configure gpus
- name: Check for NVIDIA driver
ansible.builtin.stat:
path: /dev/nvidia0
register: nvidia_driver

- name: Set fact if NVIDIA driver is present
ansible.builtin.set_fact:
has_nvidia_driver: "{{ nvidia_driver.stat.exists | default(false) }}"

- name: Expose GPU drivers
ansible.builtin.shell: |
source /cvmfs/software.eessi.io/versions/2023.06/init/bash
/cvmfs/software.eessi.io/versions/2023.06/scripts/gpu_support/nvidia/link_nvidia_host_libraries.sh
when: has_nvidia_driver

- name: Configure VGPUs
ansible.builtin.include_role:
name: stackhpc.linux.vgpu
Expand Down
17 changes: 17 additions & 0 deletions ansible/roles/eessi/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,20 @@
- name: Ensure CVMFS config is setup # noqa: no-changed-when
ansible.builtin.command:
cmd: "cvmfs_config setup"

# configure gpus
- name: Check for NVIDIA driver
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether there is always a /dev/nvidia0? Could you check with @jovial please for e.g MIG and vGPU configs? Else we'd have to do something like https://github.com/stackhpc/ansible-role-openhpc/blob/be6196540ca8007a0e45f2c3b2596ed0ff77fc13/library/gpu_info.py#L42 but TBH this approach here is much simpler!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly, this is checking for the device, which is only present if the driver is loaded. So I suggest:

Suggested change
- name: Check for NVIDIA driver
- name: Check for NVIDIA GPU

ansible.builtin.stat:
path: /dev/nvidia0
register: nvidia_driver

- name: Set fact if NVIDIA driver is present
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Set fact if NVIDIA driver is present
- name: Set fact if NVIDIA GPU is present

ansible.builtin.set_fact:
has_nvidia_driver: "{{ nvidia_driver.stat.exists | default(false) }}"

- name: Expose GPU drivers
ansible.builtin.shell: |
source /cvmfs/software.eessi.io/versions/2023.06/init/bash
/cvmfs/software.eessi.io/versions/2023.06/scripts/gpu_support/nvidia/link_nvidia_host_libraries.sh
when: has_nvidia_driver
changed_when: true
Loading