@@ -6,19 +6,8 @@ name: Build Docker Images - MetaX
66on :
77 workflow_dispatch :
88 inputs :
9- task :
10- description : MetaX image to build
11- required : true
12- type : choice
13- options : [train, inference, all]
14- default : train
15- push :
16- description : Push candidate to shared Harbor
17- required : true
18- type : boolean
19- default : true
209 run_tests :
21- description : Run the current MetaX matrix after build
10+ description : Run the current MetaX train and benchmark matrix after build
2211 required : true
2312 type : boolean
2413 default : true
2716 required : true
2817 type : boolean
2918 default : false
30- tag :
31- description : Optional tag override
32- required : false
33- type : string
3419 base_image :
3520 description : Validated MetaX base image (prefer an immutable digest)
3621 required : true
@@ -41,56 +26,37 @@ permissions:
4126 contents : read
4227
4328concurrency :
44- group : build-image-metax-${{ github.ref }}-${{ inputs.task }}
29+ group : build-image-metax-${{ github.ref }}
4530 cancel-in-progress : false
4631
4732env :
4833 REGISTRY : harbor.baai.ac.cn
4934 REGISTRY_NAMESPACE : flagos-dev
5035 METAX_MEGATRON_REF : 409c1ed949675ddf9aa540aaae48652f446351cc
5136 METAX_TE_REF : 94c7007c84107028919b4e52213d1bcb4ca3f7cf
52- CURRENT_TRAIN_IMAGE : harbor.baai.ac.cn/flagscale/megatron-lm-with-te:202603231839
53- CURRENT_INFERENCE_IMAGE : harbor.baai.ac.cn/flagscale/megatron-lm-with-te:202603231839
5437
5538jobs :
5639 prepare :
57- name : Prepare MetaX candidate
40+ name : Prepare MetaX train candidate
5841 runs-on : ubuntu-latest
5942 outputs :
60- matrix : ${{ steps.params.outputs.matrix }}
6143 candidate : ${{ steps.params.outputs.candidate }}
62- train_image : ${{ steps.params.outputs.train_image }}
63- inference_image : ${{ steps.params.outputs.inference_image }}
6444 steps :
6545 - name : Resolve build parameters
6646 id : params
6747 shell : bash
6848 run : |
6949 set -euo pipefail
7050 short_sha="${GITHUB_SHA::7}"
71- tag='${{ inputs.tag }}'
72- if [ -z "$tag" ]; then
73- tag="${short_sha}-metax-dev"
74- fi
75- candidate="${REGISTRY}/${REGISTRY_NAMESPACE}/flagscale-${{ inputs.task }}:${tag}"
76- train_image="$CURRENT_TRAIN_IMAGE"
77- inference_image="$CURRENT_INFERENCE_IMAGE"
78- case '${{ inputs.task }}' in
79- train) train_image="$candidate" ;;
80- inference) inference_image="$candidate" ;;
81- all) train_image="$candidate"; inference_image="$candidate" ;;
82- esac
83- echo 'matrix={"task":["${{ inputs.task }}"]}' >> "$GITHUB_OUTPUT"
51+ candidate="${REGISTRY}/${REGISTRY_NAMESPACE}/flagscale:${short_sha}-metax-train-dev"
8452 echo "candidate=$candidate" >> "$GITHUB_OUTPUT"
85- echo "train_image=$train_image" >> "$GITHUB_OUTPUT"
86- echo "inference_image=$inference_image" >> "$GITHUB_OUTPUT"
8753
8854 runtime_contract :
8955 name : Validate MetaX base runtime
9056 needs : prepare
9157 runs-on : flagscale-metax-c550-gpu2-8c-256g
9258 steps :
93- - name : Validate devices and collective
59+ - name : Validate eight devices and TP2 collective
9460 shell : bash
9561 run : |
9662 set -euo pipefail
@@ -126,36 +92,22 @@ jobs:
12692 torchrun --standalone --nnodes=1 --nproc-per-node=2 /tmp/metax_collective.py
12793 '
12894
129- - name : Validate MetaX vLLM contract
130- if : inputs.task == 'inference' || inputs.task == 'all'
131- shell : bash
132- run : |
133- set -euo pipefail
134- base_image='${{ inputs.base_image }}'
135- docker run --rm \
136- --ipc=host --group-add video \
137- --device=/dev/dri --device=/dev/mxcd \
138- --entrypoint python "$base_image" -c '
139- import importlib.metadata as metadata
140- import vllm
141- print("vllm:", metadata.version("vllm"))
142- print("module:", vllm.__file__)
143- '
144-
14595 build :
146- name : Build MetaX candidate
96+ name : Build and push MetaX train candidate
14797 needs : [prepare, runtime_contract]
14898 uses : ./.github/workflows/build_image_common.yml
14999 secrets : inherit
150100 with :
151101 platform : metax
152102 runs_on : ' ["flagscale-metax-c550-gpu2-8c-256g"]'
153- matrix : ${{ needs.prepare.outputs.matrix }}
103+ matrix : ' {"task":["train"]} '
154104 target : dev
155105 build_images : true
156106 no_cache : ${{ inputs.no_cache }}
157- push : ${{ inputs.push }}
107+ push : true
158108 registry : harbor.baai.ac.cn
109+ # The common builder requires all three inputs; this train-only matrix
110+ # reads only train_image.
159111 train_image : ${{ needs.prepare.outputs.candidate }}
160112 inference_image : ${{ needs.prepare.outputs.candidate }}
161113 all_image : ${{ needs.prepare.outputs.candidate }}
@@ -166,12 +118,11 @@ jobs:
166118 FLAGSCALE_TE_REF=94c7007c84107028919b4e52213d1bcb4ca3f7cf
167119
168120 candidate_contract :
169- name : Validate MetaX candidate runtime
121+ name : Validate MetaX train candidate
170122 needs : [prepare, build]
171123 runs-on : flagscale-metax-c550-gpu2-8c-256g
172124 steps :
173- - name : Validate pinned training framework imports
174- if : inputs.task == 'train' || inputs.task == 'all'
125+ - name : Validate pinned training stack on C550
175126 shell : bash
176127 run : |
177128 set -euo pipefail
@@ -183,36 +134,40 @@ jobs:
183134 --entrypoint python "$image" -c '
184135 import torch
185136 import transformer_engine
137+ from transformer_engine.pytorch import DotProductAttention, LayerNormLinear
138+ from megatron.core.extensions.transformer_engine import HAVE_TE
139+ from megatron.core.extensions.transformer_engine_spec_provider import TESpecProvider
186140 from megatron.core.models.gpt import GPTModel
187- print("devices:", torch.cuda.device_count())
141+
142+ assert torch.cuda.device_count() == 8
143+ assert HAVE_TE
144+ assert TESpecProvider is not None
188145 print("transformer_engine:", transformer_engine.__file__)
146+ print("TE modules:", DotProductAttention, LayerNormLinear)
189147 print("megatron GPTModel:", GPTModel)
190148 '
191149
192- - name : Validate MetaX vLLM import
193- if : inputs.task == 'inference' || inputs.task == 'all'
150+ - name : Record Harbor digest
194151 shell : bash
195152 run : |
196153 set -euo pipefail
197154 image='${{ needs.prepare.outputs.candidate }}'
198- docker pull "$image"
199- docker run --rm \
200- --ipc=host --group-add video \
201- --device=/dev/dri --device=/dev/mxcd \
202- --entrypoint python "$image" -c '
203- import importlib.metadata as metadata
204- import vllm
205- print("vllm:", metadata.version("vllm"))
206- print("module:", vllm.__file__)
207- '
155+ digest="$(docker image inspect "$image" --format '{{range .RepoDigests}}{{println .}}{{end}}' | head -n 1)"
156+ {
157+ echo '### MetaX train candidate'
158+ echo
159+ echo "- Image: \`$image\`"
160+ echo "- Digest: \`$digest\`"
161+ echo "- Megatron-LM-FL: \`${METAX_MEGATRON_REF}\`"
162+ echo "- TransformerEngine-FL: \`${METAX_TE_REF}\`"
163+ } >> "$GITHUB_STEP_SUMMARY"
208164
209165 tests :
210- name : Test MetaX candidate
166+ name : Test MetaX train candidate
211167 needs : [prepare, build, candidate_contract]
212- if : inputs.push && inputs. run_tests
168+ if : inputs.run_tests
213169 uses : ./.github/workflows/all_tests_common.yml
214170 secrets : inherit
215171 with :
216172 platform : metax
217- ci_train_image : ${{ needs.prepare.outputs.train_image }}
218- ci_inference_image : ${{ needs.prepare.outputs.inference_image }}
173+ ci_train_image : ${{ needs.prepare.outputs.candidate }}
0 commit comments