Skip to content

Commit 145181c

Browse files
authored
Merge pull request #191 from AI-Hypercomputer/llama3-1-405b-fp8cs-128gpus
Add Llama3 1 405b fp8cs 128gpus recipe
2 parents 04bb364 + 233757c commit 145181c

10 files changed

Lines changed: 1158 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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: v2
16+
name: a4x_max_jobset_workload
17+
description: a4x_max_jobset_workload
18+
type: application
19+
version: 0.1.0
20+
appVersion: "1.16.0"
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
<!-- mdformat global-off -->
2+
# Pretrain llama3-1-405b workloads on a4x-max GKE Node pools with Nvidia Megatron-Bridge Framework
3+
4+
This recipe outlines the steps for running a llama3-1-405b pretraining
5+
workload on [a4x-max GKE Node pools](https://cloud.google.com/kubernetes-engine) by using the
6+
[Megatron-Bridge framework](https://github.com/NVIDIA-NeMo/Megatron-Bridge).
7+
8+
## Orchestration and deployment tools
9+
10+
For this recipe, the following setup is used:
11+
12+
- Orchestration - [Google Kubernetes Engine (GKE)](https://cloud.google.com/kubernetes-engine)
13+
- Pretraining job configuration and deployment - A Helm chart is used to
14+
configure and deploy the [Kubernetes Jobset](https://kubernetes.io/blog/2025/03/23/introducing-jobset) resource which manages the execution of the
15+
[Megatron-Bridge pretraining workload](https://github.com/NVIDIA-NeMo/Megatron-Bridge).
16+
17+
## Test environment
18+
19+
This recipe has been optimized for and tested with the following configuration:
20+
21+
- GKE cluster: Please follow Cluster Toolkit [instructions](https://github.com/GoogleCloudPlatform/cluster-toolkit/) to create your a4x-max GKE cluster.
22+
23+
## Training dataset
24+
25+
This recipe uses a mock pretraining dataset provided by the Megatron-Bridge framework.
26+
27+
## Docker container image
28+
29+
This recipe uses the following docker images:
30+
31+
- `nvcr.io/nvidia/nemo:26.02`
32+
33+
## Run the recipe
34+
35+
From your client workstation, complete the following steps:
36+
37+
### Configure environment settings
38+
39+
Set the environment variables to match your environment:
40+
41+
```bash
42+
export PROJECT_ID=<PROJECT_ID>
43+
export CLUSTER_REGION=<CLUSTER_REGION>
44+
export CLUSTER_NAME=<CLUSTER_NAME>
45+
export GCS_BUCKET=<GCS_BUCKET> # Note: path should not be prefixed with gs://
46+
export KUEUE_NAME=<KUEUE_NAME>
47+
export HF_TOKEN=<YOUR_HF_TOKEN>
48+
```
49+
50+
Replace the following values:
51+
52+
- `<PROJECT_ID>`: your Google Cloud project ID.
53+
- `<CLUSTER_REGION>`: the region where your cluster is located.
54+
- `<CLUSTER_NAME>`: the name of your GKE cluster.
55+
- `<GCS_BUCKET>`: the name of your Cloud Storage bucket. Don't include the `gs://` prefix.
56+
- `<KUEUE_NAME>`: the name of the Kueue local queue. The default queue created by the cluster toolkit is `a4x-max`. Make sure to verify the name of the local queue in your cluster.
57+
- `<YOUR_HF_TOKEN>`: Your HuggingFace token.
58+
59+
Set the default project:
60+
61+
```bash
62+
gcloud config set project $PROJECT_ID
63+
```
64+
65+
### Get the recipe
66+
67+
Clone the `gpu-recipes` repository and set a reference to the recipe folder.
68+
69+
```
70+
git clone https://github.com/ai-hypercomputer/gpu-recipes.git
71+
cd gpu-recipes
72+
export REPO_ROOT=`git rev-parse --show-toplevel`
73+
export RECIPE_ROOT=$REPO_ROOT/training/a4x-max/llama3-1-405b/megatron-bridge-gke/nemo2602/128gpus-fp8cs-seq8192-gbs1536/recipe
74+
cd $RECIPE_ROOT
75+
```
76+
77+
### Get cluster credentials
78+
79+
```
80+
gcloud container clusters get-credentials $CLUSTER_NAME --region $CLUSTER_REGION
81+
```
82+
83+
### Configure and submit a pretraining job
84+
85+
#### Using 128 GPUs fp8cs precision
86+
To execute the job with the default settings, run the following command from
87+
your client:
88+
89+
```bash
90+
cd $RECIPE_ROOT
91+
export WORKLOAD_NAME=$USER-a4x-max-llama3-1-405b-128gpus
92+
helm install $WORKLOAD_NAME . -f values.yaml \
93+
--set-file workload_launcher=launcher.sh \
94+
--set workload.image=nvcr.io/nvidia/nemo:26.02 \
95+
--set volumes.gcsMounts[0].bucketName=${GCS_BUCKET} \
96+
--set volumes.gcsMounts[0].mountPath=/job-logs \
97+
--set workload.envs[0].value=/job-logs/$WORKLOAD_NAME \
98+
--set queue=${KUEUE_NAME}
99+
```
100+
101+
**Examples**
102+
103+
- To set the number of training steps to 100, run the following command from
104+
your client:
105+
106+
```bash
107+
cd $RECIPE_ROOT
108+
export WORKLOAD_NAME=$USER-a4x-max-llama3-1-405b-128gpus
109+
helm install $WORKLOAD_NAME . -f values.yaml \
110+
--set-file workload_launcher=launcher.sh \
111+
--set workload.image=nvcr.io/nvidia/nemo:26.02 \
112+
--set volumes.gcsMounts[0].bucketName=${GCS_BUCKET} \
113+
--set volumes.gcsMounts[0].mountPath=/job-logs \
114+
--set workload.envs[0].value=/job-logs/$WORKLOAD_NAME \
115+
--set queue=${KUEUE_NAME} \
116+
--set workload.arguments[0]="trainer.max_steps=100"
117+
```
118+
119+
### Monitor the job
120+
121+
To check the status of pods in your job, run the following command:
122+
123+
```
124+
kubectl get pods | grep $USER-a4x-max-llama3-1-405b-128gpus
125+
```
126+
127+
Replace the following:
128+
129+
- JOB_NAME_PREFIX - your job name prefix. For example $USER-a4x-max-llama3-1-405b-128gpus.
130+
131+
To get the logs for one of the pods, run the following command:
132+
133+
```
134+
kubectl logs POD_NAME
135+
```
136+
137+
Information about the training job's progress, including crucial details such as
138+
loss, step count, and step time, is generated by the rank 0 process.
139+
This process runs on the pod whose name begins with
140+
`JOB_NAME_PREFIX-workload-0-0`.
141+
For example: `$USER-a4x-max-llama3-1-405b-128gpus-workload-0-0-s9zrv`.
142+
143+
### Uninstall the Helm release
144+
145+
You can delete the job and other resources created by the Helm chart. To
146+
uninstall Helm, run the following command from your client:
147+
148+
```bash
149+
helm uninstall $USER-a4x-max-llama3-1-405b-128gpus
150+
```

0 commit comments

Comments
 (0)