Skip to content

Commit f80f004

Browse files
committed
Hardcode cuda_version_short and remove lookup
We already hardcode the version of cuda which we install. This ensures that we will also use the requested version when multiple cuda versions are installed. Moves ``cuda_version_short`` to be next to ``cuda_package_version`` so it's harder to miss updating one when the other is changed.
1 parent 4b0b813 commit f80f004

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

ansible/roles/cuda/defaults/main.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
cuda_repo_url: "https://developer.download.nvidia.com/compute/cuda/repos/rhel{{ ansible_distribution_major_version }}/{{ ansible_architecture }}/cuda-rhel{{ ansible_distribution_major_version }}.repo"
22
cuda_nvidia_driver_stream: '570-open'
33
cuda_package_version: '12.8.1-1'
4+
cuda_version_short: '12.8'
45
cuda_packages:
56
- "cuda{{ ('-' + cuda_package_version) if cuda_package_version != 'latest' else '' }}"
67
- nvidia-gds
7-
# _cuda_version_tuple: # discovered from installed package e.g. ('12', '1', '0')
8-
cuda_version_short: "{{ _cuda_version_tuple[0] }}.{{ _cuda_version_tuple[1] }}"
98
cuda_samples_release_url: "https://github.com/NVIDIA/cuda-samples/archive/refs/tags/v{{ cuda_version_short }}.tar.gz"
109
cuda_samples_path: "/var/lib/{{ ansible_user }}/cuda_samples"
1110
cuda_samples_programs:

ansible/roles/cuda/tasks/samples.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
- name: Read CUDA version file
2-
slurp:
3-
src: /usr/local/cuda/version.json
4-
register: _cuda_samples_version
5-
6-
- name: Set fact for discovered CUDA version
7-
set_fact:
8-
_cuda_version_tuple: "{{ (_cuda_samples_version.content | b64decode | from_json).cuda.version | split('.') }}" # e.g. '12.1.0'
9-
101
- name: Ensure cuda_samples_path exists
112
file:
123
state: directory

0 commit comments

Comments
 (0)