Skip to content

Commit 3c6f75e

Browse files
authored
Merge pull request GoogleCloudPlatform#4578 from arpit974/add_network_wait_solution
Adding network-wait solution to Ubuntu based slurm clusters. It waits until network-online.target is reached (at least 1 NIC is up and routable) It sets itself up to run before google-startup-scripts.service It runs systemd-networkd-wait-online on all the GPU NICs, enforcing routability of each but also giving up after 180 seconds
2 parents cd5e623 + 71af6a4 commit 3c6f75e

4 files changed

Lines changed: 94 additions & 10 deletions

File tree

examples/machine-learning/a3-megagpu-8g/a3mega-slurm-blueprint.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ deployment_groups:
6363
source: modules/scripts/startup-script
6464
settings:
6565
install_ansible: true
66+
enable_gpu_network_wait_online: true
6667
configure_ssh_host_patterns:
6768
- 10.0.0.*
6869
- 10.1.0.*

examples/machine-learning/a3-ultragpu-8g/a3ultra-slurm-blueprint.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ deployment_groups:
5959
source: modules/scripts/startup-script
6060
settings:
6161
install_ansible: true
62+
enable_gpu_network_wait_online: true
6263
docker:
6364
enabled: true
6465
world_writable: true

examples/machine-learning/a4-highgpu-8g/a4high-slurm-blueprint.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ deployment_groups:
6060
source: modules/scripts/startup-script
6161
settings:
6262
install_ansible: true
63+
enable_gpu_network_wait_online: true
6364
docker:
6465
enabled: true
6566
world_writable: true

modules/scripts/startup-script/files/install_gpu_network_wait_online.yml

Lines changed: 91 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
---
16-
- name: Wait until all network interfaces are online
16+
- name: Wait until all network interfaces are online for A3/A4 variants
1717
hosts: all
1818
become: true
1919
tasks:
@@ -32,23 +32,104 @@
3232
Before=google-startup-scripts.service
3333
3434
[Service]
35-
ExecCondition=/bin/bash -c '/usr/bin/curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetata/v1/instance/machine-type | grep -q "/a3-highgpu-8g$"'
35+
# Condition to only run on A3 High machines
36+
ExecCondition=/bin/bash -c '/usr/bin/curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/machine-type | grep -q "/a3-highgpu-8g$"'
3637
ExecStart=/usr/lib/systemd/systemd-networkd-wait-online -i enp0s12 -i enp6s0 -i enp12s0 -i enp134s0 -i enp140s0 -o routable --timeout=180
3738
ExecStartPost=/bin/sleep 30
3839
3940
[Install]
4041
WantedBy=multi-user.target
4142
notify:
4243
- Reload SystemD
43-
- Enable A3 High delay
44+
45+
- name: Create SystemD service for A3 Mega networking
46+
when: ansible_os_family == "Debian"
47+
ansible.builtin.copy:
48+
dest: /etc/systemd/system/delay-a3-mega.service
49+
owner: root
50+
group: root
51+
mode: "0644"
52+
content: |
53+
[Unit]
54+
Description=Delay A3 Mega boot until all network interfaces are routable
55+
After=network-online.target
56+
Wants=network-online.target
57+
Before=google-startup-scripts.service
58+
59+
[Service]
60+
# Condition to only run on A3 Mega machines
61+
ExecCondition=/bin/bash -c '/usr/bin/curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/machine-type | grep -q "/a3-megagpu-8g$"'
62+
ExecStart=/usr/lib/systemd/systemd-networkd-wait-online -i enp0s12 -i enp6s0f0 -i enp7s0f0 -i enp13s0f0 -i enp14s0f0 -i enp134s0f0 -i enp135s0f0 -i enp141s0f0 -i enp142s0f0 -o routable --timeout=180
63+
ExecStartPost=/bin/sleep 30
64+
65+
[Install]
66+
WantedBy=multi-user.target
67+
notify:
68+
- Reload SystemD
69+
70+
- name: Create SystemD service for A3 Ultra networking
71+
when: ansible_os_family == "Debian"
72+
ansible.builtin.copy:
73+
dest: /etc/systemd/system/delay-a3-ultra.service
74+
owner: root
75+
group: root
76+
mode: "0644"
77+
content: |
78+
[Unit]
79+
Description=Delay A3 Ultra boot until all network interfaces are routable
80+
After=network-online.target
81+
Wants=network-online.target
82+
Before=google-startup-scripts.service
83+
84+
[Service]
85+
# Condition to only run on A3 Ultra machines
86+
ExecCondition=/bin/bash -c '/usr/bin/curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/machine-type | grep -q "/a3-ultragpu-8g$"'
87+
ExecStart=/usr/lib/systemd/systemd-networkd-wait-online -i enp0s19 -i enp192s20 -i gpu0rdma0 -i gpu1rdma0 - gpu2rdma0 -i gpu3rdma0 -i gpu4rdma0 -i gpu5rdma0 -i gpu6rdma0 -i gpu7rdma0 -o routable --timeout=180
88+
ExecStartPost=/bin/sleep 30
89+
90+
[Install]
91+
WantedBy=multi-user.target
92+
notify:
93+
- Reload SystemD
94+
95+
- name: Create SystemD service for A4 High networking
96+
when: ansible_os_family == "Debian"
97+
ansible.builtin.copy:
98+
dest: /etc/systemd/system/delay-a4-high.service
99+
owner: root
100+
group: root
101+
mode: "0644"
102+
content: |
103+
[Unit]
104+
Description=Delay A4 High boot until all network interfaces are routable
105+
After=network-online.target
106+
Wants=network-online.target
107+
Before=google-startup-scripts.service
108+
109+
[Service]
110+
# Condition to only run on A4 High machines
111+
ExecCondition=/bin/bash -c '/usr/bin/curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/machine-type | grep -q "/a4-highgpu-8g$"'
112+
ExecStart=/usr/lib/systemd/systemd-networkd-wait-online -i enp0s19 -i enp192s20 -i gpu0rdma0 -i gpu1rdma0 - gpu2rdma0 -i gpu3rdma0 -i gpu4rdma0 -i gpu5rdma0 -i gpu6rdma0 -i gpu7rdma0 -o routable --timeout=180
113+
ExecStartPost=/bin/sleep 30
114+
# To debug interface names on an A4 instance, run: ip link show
115+
116+
[Install]
117+
WantedBy=multi-user.target
118+
notify:
119+
- Reload SystemD
120+
121+
- name: Enable A3/A4 delay services
122+
when: ansible_os_family == "Debian"
123+
ansible.builtin.systemd_service:
124+
name: "{{ item }}"
125+
enabled: true
126+
loop:
127+
- delay-a3-high.service
128+
- delay-a3-mega.service
129+
- delay-a3-ultra.service
130+
- delay-a4-high.service
131+
44132
handlers:
45133
- name: Reload SystemD
46134
ansible.builtin.systemd:
47135
daemon_reload: true
48-
post_tasks:
49-
- name: Enable A3 High delay
50-
# by the time this startup-script executes, we don't care if it's started
51-
# just enabled
52-
ansible.builtin.systemd_service:
53-
name: delay-a3-high
54-
enabled: true

0 commit comments

Comments
 (0)