Skip to content

Commit a8bc68f

Browse files
authored
Merge branch 'main' into gptoss-120b-card
2 parents db4ea1f + 8e2e25e commit a8bc68f

235 files changed

Lines changed: 9524 additions & 1499 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.dev.commit‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cae55c1f0991abd3e391d0029b15bcb35723d3f6
1+
b3b1e2d793c596c2fa61076d001ab93f294e4e87

‎.github/CODEOWNERS‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ pyproject.toml @nvidia-nemo/automation
55
ruff.toml @nvidia-nemo/automation
66
.pre-commit-config.yaml
77

8-
scripts/performance/argument_parser.py @nvidia-nemo/automation @malay-nagda @erhoo82
9-
scripts/performance/setup_experiment.py @nvidia-nemo/automation @malay-nagda @erhoo82
10-
scripts/performance/bootstrap.py @nvidia-nemo/automation @malay-nagda @erhoo82
11-
scripts/performance/run_script.py @nvidia-nemo/automation @malay-nagda @erhoo82
12-
scripts/performance/run_recipe.py @nvidia-nemo/automation @malay-nagda @erhoo82
8+
scripts/performance @malay-nagda @dingqingy-nv
9+
src/megatron/bridge/perf_recipes @malay-nagda @dingqingy-nv
10+
11+
scripts/performance/argument_parser.py @nvidia-nemo/automation
12+
scripts/performance/setup_experiment.py @nvidia-nemo/automation
13+
scripts/performance/bootstrap.py @nvidia-nemo/automation
14+
scripts/performance/run_script.py @nvidia-nemo/automation
15+
scripts/performance/run_recipe.py @nvidia-nemo/automation

‎.github/actions/test-template/action.yml‎

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ inputs:
4343
description: "Has Azure credentials"
4444
required: false
4545
default: "false"
46-
PAT:
47-
description: "GitHub Personal Access Token"
46+
github-token:
47+
description: "GitHub token"
4848
required: true
4949
container-image:
5050
description: "Container image to use for test"
@@ -59,6 +59,14 @@ inputs:
5959
runner:
6060
description: "Runner to use for test"
6161
required: true
62+
shard-id:
63+
description: "Zero-based pytest shard index"
64+
required: false
65+
default: ""
66+
num-shards:
67+
description: "Total number of pytest shards"
68+
required: false
69+
default: ""
6270

6371
runs:
6472
using: "composite"
@@ -114,9 +122,14 @@ runs:
114122
echo "::group::Start test container"
115123
if [[ "$MOUNT_FS" == "true" ]]; then
116124
VOLUME_ARGS="--volume ${{ inputs.test-data-path }}:/home/TestData --env HF_HUB_OFFLINE=1"
125+
HF_HOME=/home/TestData/HF_HOME
126+
NEMO_HOME=/home/TestData/nemo_home
117127
else
118128
VOLUME_ARGS=""
129+
HF_HOME=/home/ubuntu/.cache/huggingface
130+
NEMO_HOME=/home/ubuntu/.cache/nemo
119131
fi
132+
HF_MODULES_CACHE=/home/ubuntu/.cache/huggingface/modules
120133
121134
cmd=$(cat <<RUN_TEST_EOF
122135
#!/bin/bash
@@ -131,10 +144,13 @@ runs:
131144
--cpus=40 \
132145
--env GHA_RUNNER=${{ inputs.runner }} \
133146
--env HYDRA_FULL_ERROR=1 \
134-
--env HF_HOME=/home/TestData/HF_HOME \
135-
--env NEMO_HOME=/home/TestData/nemo_home \
147+
--env HF_HOME=$HF_HOME \
148+
--env HF_MODULES_CACHE=$HF_MODULES_CACHE \
149+
--env NEMO_HOME=$NEMO_HOME \
136150
--env RUN_ID=${{ github.run_id }} \
137151
--env UV_NO_SYNC=1 \
152+
--env SHARD_ID=${{ inputs.shard-id }} \
153+
--env NUM_SHARDS=${{ inputs.num-shards }} \
138154
--workdir /opt/Megatron-Bridge \
139155
$VOLUME_ARGS \
140156
${{ inputs.container-image }} \
@@ -159,7 +175,7 @@ runs:
159175
160176
docker exec -t nemo_container_${{ github.run_id }} bash -c '
161177
set -e
162-
export GH_TOKEN=${{ inputs.PAT }}
178+
export GH_TOKEN=${{ inputs.github-token }}
163179
164180
timeout $(( ${{ inputs.timeout }} * 60 ))s bash tests/${{ inputs.is_unit_test == 'true' && 'unit_tests' || format('functional_tests/launch_scripts/{0}', inputs.script_dir) }}/${{ inputs.script }}.sh || EXIT_CODE=$?
165181

‎.github/scripts/test_docker_dependency_layers.sh‎

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set -euo pipefail
33

44
dockerfile="${1:-docker/Dockerfile.ci}"
55
workflow="${2:-.github/workflows/cicd-main.yml}"
6+
fw_final_dockerfile="${3:-docker/Dockerfile.fw_final}"
67

78
baseline_arg_line=$(grep -n '^ARG BASELINE_MCORE_REF$' "$dockerfile" | cut -d: -f1)
89
baseline_clone_line=$(grep -n 'git clone --filter=blob:none --no-checkout' "$dockerfile" | cut -d: -f1)
@@ -24,14 +25,23 @@ trap 'rm -rf "$temporary_dir"' EXIT
2425
((baseline_line < dispatched_copy_line))
2526
((dispatched_copy_line < delta_line))
2627

28+
fw_final_from_line=$(grep -n '^FROM ${NEMO_FW_FINAL_BASE_IMAGE} AS nemo_fw_final$' "$fw_final_dockerfile" | cut -d: -f1)
29+
fw_final_root_line=$(grep -n '^USER root$' "$fw_final_dockerfile" | cut -d: -f1)
30+
fw_final_clone_line=$(grep -n '^RUN git clone --depth 1 https://github.com/NVIDIA-NeMo/NeMo.git' "$fw_final_dockerfile" | cut -d: -f1)
31+
[[ -n "$fw_final_from_line" ]]
32+
[[ -n "$fw_final_root_line" ]]
33+
[[ -n "$fw_final_clone_line" ]]
34+
((fw_final_from_line < fw_final_root_line))
35+
((fw_final_root_line < fw_final_clone_line))
36+
2737
grep -q -- '--mount=type=cache,target=/root/.cache/uv' "$dockerfile"
2838
if grep -q -- '--mount=type=secret,id=GH_TOKEN' "$dockerfile"; then
2939
echo "Baseline MCore clone must not require a GitHub token" >&2
3040
exit 1
3141
fi
3242
mcore_reinstall_line=$(grep -n 'uv pip install --no-deps --reinstall -e 3rdparty/Megatron-LM' "$dockerfile" | cut -d: -f1)
3343
helper_assertion_line=$(grep -n "find 3rdparty/Megatron-LM/megatron/core/datasets -maxdepth 1 -name 'helpers_cpp\*\.so'" "$dockerfile" | cut -d: -f1)
34-
final_copy_line=$(grep -n '^COPY --chmod=644 \. /opt/Megatron-Bridge$' "$dockerfile" | cut -d: -f1)
44+
final_copy_line=$(grep -nE '^COPY (--chmod=644|--chown=1000:1000) \. /opt/Megatron-Bridge$' "$dockerfile" | cut -d: -f1)
3545
[[ -n "$mcore_reinstall_line" ]]
3646
[[ -n "$helper_assertion_line" ]]
3747
[[ -n "$final_copy_line" ]]
@@ -232,17 +242,59 @@ if "$temporary_dir/revision-validator" "$revision_repo" not-a-full-sha; then
232242
exit 1
233243
fi
234244

245+
if ! grep -A1 '^te = \[$' pyproject.toml | grep -Fxq ' "megatron-core[te]",'; then
246+
echo "Bridge's TE extra must enable the selected MCore ref's TE extra" >&2
247+
exit 1
248+
fi
249+
if ! grep -Fq \
250+
'{ name = "megatron-core", extras = ["te"], marker = "extra == '\''te'\''", editable = "3rdparty/Megatron-LM" }' \
251+
uv.lock; then
252+
echo "Bridge's lock metadata must preserve the MCore TE extra" >&2
253+
exit 1
254+
fi
235255
if grep -q 'transformer-engine @ git+https://github.com/NVIDIA/TransformerEngine.git@' pyproject.toml || \
236256
grep -q '^name = "transformer-engine"$' pyproject.toml; then
237257
echo "Bridge must inherit the TransformerEngine source and metadata from the selected MCore ref" >&2
238258
exit 1
239259
fi
240260

261+
lock_package_field() {
262+
local lock_file="$1"
263+
local package="$2"
264+
local field="$3"
265+
266+
awk -v package="$package" -v field="$field" '
267+
$0 == "[[package]]" { in_package = 1; package_matches = 0; next }
268+
in_package && $0 ~ /^\[\[/ { in_package = 0; package_matches = 0 }
269+
in_package && $0 == "name = \"" package "\"" { package_matches = 1; next }
270+
package_matches && index($0, field " = ") == 1 { print; exit }
271+
' "$lock_file"
272+
}
273+
274+
mlm_te_source=$(lock_package_field 3rdparty/Megatron-LM/uv.lock transformer-engine source)
275+
bridge_te_source=$(lock_package_field uv.lock transformer-engine source)
276+
if [[ ! "$mlm_te_source" =~ ^source\ =\ \{\ git\ =\ \"https://github.com/NVIDIA/TransformerEngine\.git\?rev=[0-9a-f]{40}#[0-9a-f]{40}\"\ \}$ ]]; then
277+
echo "Selected MCore lock must pin TransformerEngine to a full source revision" >&2
278+
exit 1
279+
fi
280+
if [[ "$bridge_te_source" != "$mlm_te_source" ]]; then
281+
echo "Bridge must lock the TransformerEngine source selected by MCore" >&2
282+
exit 1
283+
fi
284+
241285
composite_action=".github/actions/test-template/action.yml"
242286
if grep -qE 'mcore_(commit|ref)|MCORE_COMMIT|uv sync --all-extras --all-groups' "$composite_action"; then
243287
echo "Test template must use the already-validated MCore in the built image" >&2
244288
exit 1
245289
fi
290+
grep -Fq 'VOLUME_ARGS="--volume ${{ inputs.test-data-path }}:/home/TestData --env HF_HUB_OFFLINE=1"' "$composite_action"
291+
grep -q 'MOUNT_FS: ${{ inputs.is_unit_test == '\''false'\'' }}' "$composite_action"
292+
grep -q 'HF_HOME=/home/TestData/HF_HOME' "$composite_action"
293+
grep -q 'NEMO_HOME=/home/TestData/nemo_home' "$composite_action"
294+
grep -q 'HF_HOME=/home/ubuntu/.cache/huggingface' "$composite_action"
295+
grep -q 'NEMO_HOME=/home/ubuntu/.cache/nemo' "$composite_action"
296+
grep -q 'HF_MODULES_CACHE=/home/ubuntu/.cache/huggingface/modules' "$composite_action"
297+
grep -q -- '--env HF_MODULES_CACHE=\$HF_MODULES_CACHE' "$composite_action"
246298

247299
# The baseline dependency layer must be structurally independent of the mutable
248300
# dispatched checkout. CI validates the ordering statically so this regression
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
workflow="${1:-.github/workflows/cicd-main.yml}"
5+
6+
awk '
7+
function check_job() {
8+
if (!in_queue_chain || !has_success) {
9+
return
10+
}
11+
12+
checked++
13+
if (!allows_queue_bypass) {
14+
print job " uses success() but does not allow the intentional queue skip" > "/dev/stderr"
15+
failed = 1
16+
}
17+
}
18+
19+
/^ [[:alnum:]_-]+:$/ {
20+
check_job()
21+
job = $1
22+
sub(/:$/, "", job)
23+
in_queue_chain = (in_queue_chain || job == "cicd-compute-build-matrix")
24+
if (job == "Nemo_CICD_Test") {
25+
in_queue_chain = 0
26+
}
27+
has_success = 0
28+
allows_queue_bypass = 0
29+
next
30+
}
31+
32+
in_queue_chain && /success\(\)/ {
33+
has_success = 1
34+
}
35+
36+
in_queue_chain && /needs\.configure\.outputs\.skip_queue == '\''true'\'' && !failure\(\)/ {
37+
allows_queue_bypass = 1
38+
}
39+
40+
END {
41+
check_job()
42+
if (checked == 0) {
43+
print "No queue-dependent success() conditions found" > "/dev/stderr"
44+
exit 1
45+
}
46+
exit failed
47+
}
48+
' "$workflow"

0 commit comments

Comments
 (0)