Skip to content

Commit c8eae66

Browse files
committed
Add A4XMAX kimi-k2 FP8mx 512 GPUs recipe
1 parent eef14ea commit c8eae66

8 files changed

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

0 commit comments

Comments
 (0)