Skip to content

Commit b7508d3

Browse files
authored
Merge pull request GoogleCloudPlatform#4275 from abbas1902/qf
Revamp install_cloud_rdma_drivers startup script
2 parents 8d1c563 + 70e7428 commit b7508d3

5 files changed

Lines changed: 9 additions & 22 deletions

File tree

examples/h4d-vm.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ deployment_groups:
6969
settings:
7070
configure_ssh_host_patterns:
7171
- $(vars.hostname_prefix)-*
72-
install_cloud_rdma_drivers: true
7372
set_ofi_cloud_rdma_tunables: true
7473
local_ssd_filesystem:
7574
fs_type: ext4

examples/hpc-slurm-h4d.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ deployment_groups:
6969
- id: h4d_startup
7070
source: modules/scripts/startup-script
7171
settings:
72-
install_cloud_rdma_drivers: true
7372
set_ofi_cloud_rdma_tunables: true
7473
local_ssd_filesystem:
7574
fs_type: ext4

modules/scripts/startup-script/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ No modules.
326326
| <a name="input_http_proxy"></a> [http\_proxy](#input\_http\_proxy) | Web (http and https) proxy configuration for pip, apt, and yum/dnf and interactive shells | `string` | `""` | no |
327327
| <a name="input_install_ansible"></a> [install\_ansible](#input\_install\_ansible) | Run Ansible installation script if either set to true or unset and runner of type 'ansible-local' are used. | `bool` | `null` | no |
328328
| <a name="input_install_cloud_ops_agent"></a> [install\_cloud\_ops\_agent](#input\_install\_cloud\_ops\_agent) | Warning: Consider using `install_stackdriver_agent` for better performance. Run Google Ops Agent installation script if set to true. | `bool` | `false` | no |
329-
| <a name="input_install_cloud_rdma_drivers"></a> [install\_cloud\_rdma\_drivers](#input\_install\_cloud\_rdma\_drivers) | If true, will install and reload Cloud RDMA drivers. Currently only supported on Rocky Linux 8. | `bool` | `false` | no |
329+
| <a name="input_install_cloud_rdma_drivers"></a> [install\_cloud\_rdma\_drivers](#input\_install\_cloud\_rdma\_drivers) | If true, will install and reload Cloud RDMA drivers. Currently only supported on Rocky Linux 8. Should not be enabled if using the HPC VM Image. | `bool` | `false` | no |
330330
| <a name="input_install_docker"></a> [install\_docker](#input\_install\_docker) | DEPRECATED: use var.docker. | `bool` | `null` | no |
331331
| <a name="input_install_stackdriver_agent"></a> [install\_stackdriver\_agent](#input\_install\_stackdriver\_agent) | Run Google Stackdriver Agent installation script if set to true. Preferred over ops agent for performance. | `bool` | `false` | no |
332332
| <a name="input_labels"></a> [labels](#input\_labels) | Labels for the created GCS bucket. Key-value pairs. | `map(string)` | n/a | yes |

modules/scripts/startup-script/files/install_cloud_rdma_drivers.sh

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,21 @@ set -e -o pipefail
1717
OS_ID="$(awk -F '=' '/^ID=/ {print $2}' /etc/os-release | sed -e 's/"//g')"
1818
OS_VERSION="$(awk -F '=' '/VERSION_ID/ {print $2}' /etc/os-release | sed -e 's/"//g')"
1919
OS_VERSION_MAJOR="$(awk -F '=' '/VERSION_ID/ {print $2}' /etc/os-release | sed -e 's/"//g' -e 's/\..*$//')"
20+
REBOOT_FILE="/etc/.rdma_reboot"
2021

2122
if { [ "${OS_ID}" = "rocky" ] || [ "${OS_ID}" = "rhel" ]; } && { [ "${OS_VERSION_MAJOR}" = "8" ]; }; then
2223
KMOD_VERSION="$(dnf list installed | awk '$1 ~ /^kmod-idpf-irdma(\.|$)/ {print $2}')"
2324

2425
# For images that do not already have Cloud RDMA drivers installed
25-
if [ -z "${KMOD_VERSION}" ]; then
26+
if [ -z "${KMOD_VERSION}" ] && [ -z "${REBOOT_FILE}" ]; then
27+
sudo dnf update -y
2628
sudo dnf install https://depot.ciq.com/public/files/gce-accelerator/irdma-kernel-modules-el8-x86_64/irdma-repos.rpm -y
2729
sudo dnf install kmod-idpf-irdma rdma-core libibverbs-utils librdmacm-utils infiniband-diags perftest -y
28-
sudo rmmod idpf
29-
sudo rmmod irdma
30-
sudo modprobe idpf
31-
exit 0
32-
else
33-
# Downloading the RDMA packages and upgrading existing drivers
34-
sudo dnf install https://depot.ciq.com/public/files/gce-accelerator/irdma-kernel-modules-el8-x86_64/irdma-repos.rpm -y
35-
sudo dnf upgrade kmod-idpf-irdma rdma-core libibverbs-utils librdmacm-utils infiniband-diags perftest -y
36-
NEW_KMOD_VERSION="$(dnf list installed | awk '$1 ~ /^kmod-idpf-irdma(\.|$)/ {print $2}')"
37-
38-
# Restarting drivers so they can use RDMA without needing a reboot (specifically checking for kmod package updates)
39-
if [ "${KMOD_VERSION}" != "${NEW_KMOD_VERSION}" ]; then
40-
sudo rmmod idpf
41-
sudo rmmod irdma
42-
sudo modprobe idpf
43-
fi
44-
exit 0
30+
sudo touch "${REBOOT_FILE}"
31+
reboot
4532
fi
33+
echo "This image has IRDMA packages already installed, exiting."
34+
exit 0
4635
else
4736
echo "Unsupported operating system ${OS_ID} ${OS_VERSION}. Cloud RDMA Drivers are only supported on Rocky Linux 8."
4837
exit 1

modules/scripts/startup-script/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ variable "http_no_proxy" {
280280
}
281281

282282
variable "install_cloud_rdma_drivers" {
283-
description = "If true, will install and reload Cloud RDMA drivers. Currently only supported on Rocky Linux 8."
283+
description = "If true, will install and reload Cloud RDMA drivers. Currently only supported on Rocky Linux 8. Should not be enabled if using the HPC VM Image."
284284
type = bool
285285
default = false
286286
}

0 commit comments

Comments
 (0)