Skip to content

Commit 3eb3521

Browse files
committed
updating the readme and adding the sample workload files
1 parent 9a63ccd commit 3eb3521

6 files changed

Lines changed: 591 additions & 73 deletions

File tree

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Copyright 2026 "Google LLC"
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: batch/v1
16+
kind: Job
17+
metadata:
18+
name: gpu-job-1
19+
spec:
20+
template:
21+
spec:
22+
nodeSelector:
23+
cloud.google.com/gke-flex-start: "true"
24+
containers:
25+
- name: gpu-container-1
26+
image: gcr.io/k8s-staging-perf-tests/sleep:latest
27+
args: ["10s"] # Sleep for 10 seconds
28+
resources:
29+
requests:
30+
nvidia.com/gpu: 1
31+
limits:
32+
nvidia.com/gpu: 1
33+
restartPolicy: OnFailure
34+
---
35+
apiVersion: batch/v1
36+
kind: Job
37+
metadata:
38+
name: gpu-job-2
39+
spec:
40+
template:
41+
spec:
42+
nodeSelector:
43+
cloud.google.com/gke-flex-start: "true"
44+
containers:
45+
- name: gpu-container-2
46+
image: gcr.io/k8s-staging-perf-tests/sleep:latest
47+
args: ["10s"] # Sleep for 10 seconds
48+
resources:
49+
requests:
50+
nvidia.com/gpu: 1
51+
limits:
52+
nvidia.com/gpu: 1
53+
restartPolicy: OnFailure
Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
# Copyright 2026 Google Inc. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: jobset.x-k8s.io/v1alpha2
16+
kind: JobSet
17+
metadata:
18+
generateName: ag-2-
19+
namespace: default
20+
labels:
21+
kueue.x-k8s.io/queue-name: dws-local-queue
22+
annotations:
23+
provreq.kueue.x-k8s.io/maxRunDurationSeconds: "600"
24+
spec:
25+
ttlSecondsAfterFinished: 1200
26+
suspend: False
27+
network:
28+
enableDNSHostnames: true
29+
replicatedJobs:
30+
- name: w
31+
template:
32+
spec:
33+
parallelism: 2
34+
completions: 2
35+
36+
template:
37+
metadata:
38+
annotations:
39+
networking.gke.io/default-interface: 'eth0'
40+
networking.gke.io/interfaces: |
41+
[
42+
{"interfaceName":"eth0","network":"default"},
43+
{"interfaceName":"eth1","network":"vpc1"},
44+
{"interfaceName":"eth2","network":"vpc2"},
45+
{"interfaceName":"eth3","network":"vpc3"},
46+
{"interfaceName":"eth4","network":"vpc4"},
47+
{"interfaceName":"eth5","network":"vpc5"},
48+
{"interfaceName":"eth6","network":"vpc6"},
49+
{"interfaceName":"eth7","network":"vpc7"},
50+
{"interfaceName":"eth8","network":"vpc8"}
51+
]
52+
spec:
53+
activeDeadlineSeconds: 3600
54+
restartPolicy: Never
55+
nodeSelector:
56+
cloud.google.com/gke-nodepool: a3-megagpu-8g-a3-megagpu-pool
57+
cloud.google.com/gke-flex-start: "true"
58+
tolerations:
59+
- key: cloud.google.com/gke-queued
60+
effect: NoSchedule
61+
value: "true"
62+
63+
- key: "nvidia.com/gpu"
64+
operator: "Exists"
65+
effect: "NoSchedule"
66+
67+
setHostnameAsFQDN: true
68+
volumes:
69+
- name: nvidia
70+
hostPath:
71+
path: /home/kubernetes/bin/nvidia
72+
- name: lib64
73+
hostPath:
74+
path: /lib64
75+
- name: shared-memory
76+
emptyDir:
77+
medium: "Memory"
78+
sizeLimit: 250Gi
79+
- name: sys
80+
hostPath:
81+
path: /sys
82+
- name: proc-sys
83+
hostPath:
84+
path: /proc/sys
85+
86+
initContainers:
87+
- name: gpu-healthcheck
88+
image: alpine:latest
89+
command: ["/bin/sh", "-c"]
90+
args:
91+
- |
92+
apk add --no-cache bash # Install bash
93+
/bin/bash -c "set -ex
94+
NUM_GPUS=$(/usr/local/nvidia/bin/nvidia-smi --query-gpu=driver_version --format=csv,noheader,nounits | wc -l)
95+
if [ \${NUM_GPUS} -lt 8 ]; then
96+
echo \"Error: Only \${NUM_GPUS} GPUs and expected 8\"
97+
exit 1
98+
fi
99+
gpu_errors=(\$(/usr/local/nvidia/bin/nvidia-smi --query-gpu=ecc.errors.uncorrected.volatile.total --format=csv,noheader,nounits))
100+
for gpu_index in \${!gpu_errors[@]}; do
101+
if [ \${gpu_errors[\$gpu_index]} == '[N/A]' ]; then
102+
echo 'Error: ERR detected in GPU index '\$gpu_index
103+
exit 1
104+
elif [ \${gpu_errors[\$gpu_index]} -gt 0 ]; then
105+
echo 'Error: Unrecoverable ECC errors detected in GPU index '\$gpu_index
106+
exit 1
107+
fi
108+
done
109+
echo \${NUM_GPUS} GPUs found with no ERR or Unrecoverable ECC errors"
110+
111+
volumeMounts:
112+
- name: nvidia
113+
mountPath: /usr/local/nvidia
114+
- name: lib64
115+
mountPath: /lib64
116+
securityContext:
117+
privileged: true
118+
env:
119+
- name: LD_LIBRARY_PATH
120+
value: /usr/local/nvidia/lib64
121+
122+
containers:
123+
- name: nccl
124+
stdin: true
125+
tty: true
126+
image: us-docker.pkg.dev/gce-ai-infra/gpudirect-tcpxo/nccl-plugin-gpudirecttcpx-dev:v1.0.15
127+
securityContext:
128+
privileged: true
129+
env:
130+
- name: MY_NODE_NAME
131+
valueFrom:
132+
fieldRef:
133+
fieldPath: spec.nodeName
134+
- name: OMPI_ALLOW_RUN_AS_ROOT
135+
value: "1"
136+
- name: OMPI_ALLOW_RUN_AS_ROOT_CONFIRM
137+
value: "1"
138+
command:
139+
- bash
140+
- -c
141+
- |
142+
set -x
143+
export N_NODES=2
144+
echo "Starting workload container on ${MY_NODE_NAME} for $N_NODES benchmark"
145+
146+
# Load all the cuda libs
147+
/sbin/ldconfig
148+
149+
# Install ping
150+
apt update -y
151+
apt install -y iputils-ping
152+
153+
# Start sshd
154+
/scripts/container_entry.sh daemon &
155+
156+
# Get helper variables to form all hostnames
157+
export POSTFIX=$(hostname | cut -d . -f 2-)
158+
export WORKERS_BASENAME=$(hostname | cut -d . -f 1 | rev | cut -d - -f 2- | rev )
159+
export NODE_RANK=$JOB_COMPLETION_INDEX
160+
161+
# For every worker, wait till online and add to hostfile
162+
for i in `seq 0 $(($N_NODES-1))`; do
163+
OTHER=${WORKERS_BASENAME}-${i}.${POSTFIX}
164+
until ssh -p 222 -o StrictHostKeyChecking=no $OTHER hostname; do
165+
echo Waiting for ${OTHER}...
166+
sleep 10
167+
done
168+
echo ${OTHER} port=222 slots=8 | tee -a /tmp/hostfile;
169+
done
170+
171+
cat /tmp/hostfile
172+
173+
# Launch from head node
174+
if [[ "${NODE_RANK}" -eq "0" ]]; then
175+
export NCCL_TESTS_SPLIT_MASK="0x0";
176+
ENV_VARS=$(echo ${!NCCL*} ${!OMPI*} LD_LIBRARY_PATH PATH | sed 's/ / -x /g')
177+
178+
mpirun --hostfile /tmp/hostfile \
179+
-x $ENV_VARS \
180+
-mca plm_rsh_no_tree_spawn 1 \
181+
--mca orte_keep_fqdn_hostnames 1 \
182+
--mca btl self,tcp \
183+
--mca btl_tcp_if_include eth0 \
184+
--bind-to none \
185+
--mca plm_rsh_agent "ssh -q -o LogLevel=ERROR -o StrictHostKeyChecking=no -p 222" \
186+
/third_party/nccl-tests/build/all_gather_perf -b 1K -e 8G -f 2 -g 1 -w 5 --iters 100 -c 1
187+
188+
else
189+
while ping -c 1 ${WORKERS_BASENAME}-0.${POSTFIX}; do
190+
sleep 5
191+
done
192+
fi
193+
194+
exit 0
195+
196+
volumeMounts:
197+
- name: nvidia
198+
mountPath: /usr/local/nvidia
199+
- name: shared-memory
200+
mountPath: /dev/shm
201+
resources:
202+
limits:
203+
nvidia.com/gpu: 8
204+
requests:
205+
nvidia.com/gpu: 8

0 commit comments

Comments
 (0)