Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions gpu-validation/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ gpu_validation_dns_server: 192.168.122.1
gpu_validation_pci_devices:
10de:27b8: 1

# [bool] Install nvidia-container-toolkit and generate CDI specs for container GPU access.
# Required when the guest VM does not have the toolkit pre-installed.
gpu_validation_nvidia_container_toolkit_install: false
# [string] URL of the nvidia-container-toolkit .repo file to add.
# When empty, the repo is not added (toolkit must already be available from an existing repo).
gpu_validation_nvidia_container_toolkit_repo_url: "https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo"
# [string] PyTorch pip index URL (e.g. https://download.pytorch.org/whl/cu128 for Blackwell)
gpu_validation_pytorch_url: https://download.pytorch.org/whl/cu126

Expand Down
8 changes: 8 additions & 0 deletions gpu-validation/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
- ansible_distribution == "RedHat"
- gpu_validation_mode == "mig"

- name: Install NVIDIA container toolkit and configure runtime
ansible.builtin.import_tasks: nvidia-container-toolkit.yaml
when: gpu_validation_nvidia_container_toolkit_install | bool

- name: Check GPUs
ansible.builtin.import_tasks: gpus.yaml
- name: GPUs Assertions # noqa: ignore-errors
Expand All @@ -34,6 +38,10 @@
ansible.builtin.import_tasks: cuda_assertions.yaml
ignore_errors: true

- name: Generate NVIDIA CDI configuration
ansible.builtin.import_tasks: nvidia-cdi.yaml
when: gpu_validation_nvidia_container_toolkit_install | bool

- name: Check vllm
ansible.builtin.import_tasks: vllm.yaml
when: gpu_validation_model_tests_enabled | bool
Expand Down
2 changes: 1 addition & 1 deletion gpu-validation/tasks/model_download_and_serve.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
validate_certs: false
register: api_result
until: ("status" in api_result) and (api_result.status == 200)
retries: 180 # 180 * 10 = 30 mins - this includes the time to download the model
retries: "{{ [1, (((gpu_validation_server_timeout | int) + 9) // 10)] | max }}"
delay: 10
changed_when: false

Expand Down
15 changes: 15 additions & 0 deletions gpu-validation/tasks/nvidia-cdi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: Ensure CDI directory exists
become: true
ansible.builtin.file:
path: /etc/cdi
state: directory
mode: "0755"
owner: root

# Generate CDI after the driver/CUDA installation flow has completed.
# If it is generated too early, libcuda.so.1 can be missing from the spec.
- name: Generate NVIDIA CDI configuration
become: true
ansible.builtin.command: nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml
changed_when: true
34 changes: 34 additions & 0 deletions gpu-validation/tasks/nvidia-container-toolkit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
- name: Add NVIDIA container toolkit repository
when: gpu_validation_nvidia_container_toolkit_repo_url | default('') | length > 0
become: true
ansible.builtin.get_url:
url: "{{ gpu_validation_nvidia_container_toolkit_repo_url }}"
dest: /etc/yum.repos.d/nvidia-container-toolkit.repo
mode: "0644"

- name: Install nvidia-container-toolkit
become: true
ansible.builtin.dnf:
name: nvidia-container-toolkit
state: present

- name: Reboot the VM to find the installed drivers
Comment thread
bogdando marked this conversation as resolved.
block:
- name: Reboot
become: true
ansible.builtin.reboot:
reboot_timeout: "{{ gpu_validation_reboot_timeout }}"
post_reboot_delay: "{{ gpu_validation_reboot_post_delay }}"
rescue:
- name: Debug message (local runner mode) # noqa: ignore-errors
ansible.builtin.fail:
msg: >-
In local runner mode, the VM is the control node and cannot be rebooted!
Make sure to reboot it manually (just once) and restart the validation suite after.
ignore_errors: true
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- name: Configure NVIDIA container runtime for CDI
become: true
ansible.builtin.command: nvidia-ctk runtime configure --runtime=containerd
changed_when: true
38 changes: 0 additions & 38 deletions gpu-validation/tasks/nvidia-cuda-repos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,9 @@
gpgcheck: true
gpgkey: "{{ edpm_accel_drivers_nvidia_repo_gpgkey }}"

- name: Install nvidia-container-toolkit
become: true
ansible.builtin.dnf:
use_backend: dnf4
name: nvidia-container-toolkit
state: present

- name: Reboot the VM to find the installed drivers
become: true
ansible.builtin.reboot:
reboot_timeout: 600

- name: Check if CDI configfile exists
become: true
ansible.builtin.stat:
path: /etc/cdi/nvidia.yaml
register: nvidia_driver_cdi_config_file

- name: Configure NVIDIA container runtime
when: not nvidia_driver_cdi_config_file.stat.exists
become: true
block:
- name: Ensure CDI directory exists
ansible.builtin.file:
path: /etc/cdi
state: directory
mode: "0755"
owner: root

- name: Configure NVIDIA container runtime
ansible.builtin.command: nvidia-ctk runtime configure --runtime=containerd
changed_when: true

- name: Generate NVIDIA CDI configuration
ansible.builtin.command: nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml
changed_when: true

- name: Install NVIDIA Management Library
become: true
ansible.builtin.dnf:
use_backend: dnf4
name: "{{ gpu_validation_libnvidia_ml_version }}"
state: present

Expand Down
19 changes: 14 additions & 5 deletions gpu-validation/tasks/reboot_if_needed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,18 @@
var: _gpu_validation_needs_restarting.stdout

- name: Reboot to apply system updates
become: true
ansible.builtin.reboot:
msg: "Rebooting to apply kernel and driver updates"
reboot_timeout: "{{ gpu_validation_reboot_timeout }}"
post_reboot_delay: "{{ gpu_validation_reboot_post_delay }}"
when: gpu_validation_reboot_force | bool or _gpu_validation_needs_restarting.rc == 1
become: true
block:
- name: Reboot to apply system updates
ansible.builtin.reboot:
msg: "Rebooting to apply kernel and driver updates"
reboot_timeout: "{{ gpu_validation_reboot_timeout }}"
post_reboot_delay: "{{ gpu_validation_reboot_post_delay }}"
rescue:
- name: Debug message (local runner mode) # noqa: ignore-errors
ansible.builtin.fail:
msg: >-
In local runner mode, the VM is the control node and cannot be rebooted!
Make sure to reboot it manually (just once) and restart the validation suite after.
ignore_errors: true
4 changes: 0 additions & 4 deletions gpu-validation/tasks/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

- name: Install DKMS (UNSUPPORTED)
ansible.builtin.dnf:
use_backend: dnf4
name:
- dkms
- kernel-devel
Expand All @@ -40,19 +39,16 @@

- name: Install pciutils package
ansible.builtin.dnf:
use_backend: dnf4
name: pciutils
state: present

- name: Install pip package
ansible.builtin.dnf:
use_backend: dnf4
name: python-pip
state: present

- name: Install podman package
ansible.builtin.dnf:
use_backend: dnf4
name: podman
state: present

Expand Down
Loading