Skip to content

Commit 58ea116

Browse files
author
Himani Anil Deshpande
committed
[NVIDIA-IMEX] Add Version and package name for debian installation
1 parent d2c5206 commit 58ea116

File tree

9 files changed

+72
-14
lines changed

9 files changed

+72
-14
lines changed

cookbooks/aws-parallelcluster-platform/resources/nvidia_imex/nvidia_imex_alinux2023.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
end
1818

1919
use 'partial/_nvidia_imex_common.rb'
20+
use 'partial/_nvidia_imex_rhel.rb'
2021

2122
def _nvidia_imex_version
2223
"#{nvidia_driver_major_version}-#{nvidia_imex_full_version}"

cookbooks/aws-parallelcluster-platform/resources/nvidia_imex/nvidia_imex_amazon2.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
provides :nvidia_imex, platform: 'amazon', platform_version: '2'
1616

1717
use 'partial/_nvidia_imex_common.rb'
18+
use 'partial/_nvidia_imex_rhel.rb'
1819

1920
def imex_installed
2021
# We do not install NVIDIA-Imex for Alinux2 due to restriction on NVIDIA driver

cookbooks/aws-parallelcluster-platform/resources/nvidia_imex/nvidia_imex_redhat8.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
end
1818

1919
use 'partial/_nvidia_imex_common.rb'
20+
use 'partial/_nvidia_imex_rhel.rb'
2021

2122
def _nvidia_imex_version
2223
"#{nvidia_driver_major_version}-#{nvidia_imex_full_version}"

cookbooks/aws-parallelcluster-platform/resources/nvidia_imex/nvidia_imex_rocky8.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
end
1818

1919
use 'partial/_nvidia_imex_common.rb'
20+
use 'partial/_nvidia_imex_rhel.rb'
2021

2122
def _nvidia_imex_version
2223
"#{nvidia_driver_major_version}-#{nvidia_imex_full_version}"

cookbooks/aws-parallelcluster-platform/resources/nvidia_imex/nvidia_imex_ubuntu22+.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@
1717
end
1818

1919
use 'partial/_nvidia_imex_common.rb'
20+
use 'partial/_nvidia_imex_debian.rb'
2021

2122
def _nvidia_imex_version
22-
"1:#{nvidia_driver_major_version}_#{nvidia_imex_full_version}"
23-
# The single digit "1" is epoch version. Without the "1", package install fails because version does not exist.
24-
# See details here:
25-
# https://askubuntu.com/questions/441879/why-do-some-packages-have-extra-numbers-before-a-colon-on-the-front-of-their-ver
23+
"#{nvidia_driver_major_version}_#{nvidia_imex_full_version}"
2624
end

cookbooks/aws-parallelcluster-platform/resources/nvidia_imex/partial/_nvidia_imex_common.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22
#
3-
# Copyright:: 2013-2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
# Copyright:: 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License").
66
# You may not use this file except in compliance with the License.
@@ -48,14 +48,15 @@
4848
action :create
4949
end
5050

51-
install_packages 'Install nvidia-imex' do
52-
packages "#{nvidia_imex_service}-#{_nvidia_imex_version}"
53-
action :install
54-
end
51+
action_install_imex
5552
# Save Imex version in Node Attributes for InSpec Tests
5653
node.default['cluster']['nvidia']['imex']['version'] = nvidia_imex_full_version
5754
node.default['cluster']['nvidia']['imex']['package'] = "#{nvidia_imex_service}-#{nvidia_driver_major_version}"
5855
node_attributes 'dump node attributes'
56+
57+
nvidia_repo 'remove nvidia repository' do
58+
action :remove
59+
end
5960
end
6061

6162
action :configure do
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# frozen_string_literal: true
2+
#
3+
# Copyright:: 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License").
6+
# You may not use this file except in compliance with the License.
7+
# A copy of the License is located at
8+
#
9+
# http://aws.amazon.com/apache2.0/
10+
#
11+
# or in the "LICENSE.txt" file accompanying this file.
12+
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
13+
# See the License for the specific language governing permissions and limitations under the License.
14+
15+
action :install_imex do
16+
apt_package "Install nvidia-imex" do
17+
package_name "#{nvidia_imex_service}-#{nvidia_driver_major_version}"
18+
version nvidia_imex_full_version
19+
retries 10
20+
retry_delay 5
21+
end
22+
end
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# frozen_string_literal: true
2+
#
3+
# Copyright:: 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License").
6+
# You may not use this file except in compliance with the License.
7+
# A copy of the License is located at
8+
#
9+
# http://aws.amazon.com/apache2.0/
10+
#
11+
# or in the "LICENSE.txt" file accompanying this file.
12+
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
13+
# See the License for the specific language governing permissions and limitations under the License.
14+
15+
action :install_imex do
16+
install_packages 'Install nvidia-imex' do
17+
packages "#{nvidia_imex_service}-#{_nvidia_imex_version}"
18+
action :install
19+
end
20+
end

cookbooks/aws-parallelcluster-platform/spec/unit/resources/nvidia_imex_spec.rb

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,12 @@ def self.configure(chef_run)
178178
runner(platform: platform, version: version, step_into: ['nvidia_imex'])
179179
end
180180
cached(:nvidia_imex_version) { "1.2.3-1" }
181+
cached(:nvidia_imex_package) { "nvidia-imex-1" }
181182
cached(:nvidia_imex_name) do
182183
if %(redhat rocky).include?(platform) || platform == 'amazon' && version == '2023'
183-
"nvidia-imex-1-#{nvidia_imex_version}"
184+
"#{nvidia_imex_package}-#{nvidia_imex_version}"
184185
else
185-
"nvidia-imex-1_#{nvidia_imex_version}"
186+
"#{nvidia_imex_package}_#{nvidia_imex_version}"
186187
end
187188
end
188189
cached(:node) { chef_run.node }
@@ -219,7 +220,9 @@ def self.configure(chef_run)
219220
end
220221
it 'does not set nvidia-imex version' do
221222
expect(node.default['cluster']['nvidia']['imex']['version']).not_to eq(nvidia_imex_version)
223+
expect(node.default['cluster']['nvidia']['imex']['package']).not_to eq(nvidia_imex_package)
222224
is_expected.not_to write_node_attributes('dump node attributes')
225+
is_expected.not_to remove_nvidia_repo('remove nvidia repository')
223226
end
224227
else
225228
it 'installs nvidia-imex' do
@@ -241,13 +244,23 @@ def self.configure(chef_run)
241244
.with(user: 'root')
242245
.with(group: 'root')
243246
.with(mode: '0644')
244-
is_expected.to install_install_packages('Install nvidia-imex')
245-
.with(packages: "#{nvidia_imex_name}")
246-
.with(action: %i(install))
247+
if platform == 'ubuntu'
248+
is_expected.to install_apt_package('Install nvidia-imex')
249+
.with(package_name: nvidia_imex_package)
250+
.with(version: nvidia_imex_version)
251+
.with(retries: 10)
252+
.with(retry_delay: 5)
253+
else
254+
is_expected.to install_install_packages('Install nvidia-imex')
255+
.with(packages: nvidia_imex_name)
256+
.with(action: %i(install))
257+
end
247258
end
248259
it 'sets nvidia-imex version' do
249260
expect(node.default['cluster']['nvidia']['imex']['version']).to eq(nvidia_imex_version)
261+
expect(node.default['cluster']['nvidia']['imex']['package']).to eq(nvidia_imex_package)
250262
is_expected.to write_node_attributes('dump node attributes')
263+
is_expected.to remove_nvidia_repo('remove nvidia repository')
251264
end
252265
end
253266
end

0 commit comments

Comments
 (0)