mcore-cicd

작성자: nvidia

CI/CD reference for Megatron-LM. Covers CI pipeline structure, PR scope labels, triggering internal GitLab CI (which force-pushes the current branch to a…

npx skills add https://github.com/nvidia/megatron-lm --skill mcore-cicd

CI/CD Guide


Answer-First CI Facts

For PR-label or trigger questions, lead with the exact values:

  • No label: scope=mr-github-slim, n_repeat=5, lightweight=false.
  • Run tests: scope=mr-github, n_repeat=1, lightweight=true.
  • Run functional tests: scope=mr-github, n_repeat=5, lightweight=false.
  • container::lts only switches the container image path to LTS and combines with any scope label.
  • Run MBridge tests additionally triggers the MBridge L1 suite.
  • ⚠️ WARNING — destructive remote write. tools/trigger_internal_ci.py force-pushes the current branch to the internal GitLab remote as pull-request/<branch>. Always run with --dry-run first and confirm the destination ref before invoking it without the flag. Never run against a shared or protected branch — only target your own pull-request branch. Safe preflight: python tools/trigger_internal_ci.py --gitlab-origin gitlab --dry-run. Add the optional --functional-test-* flags only after the dry-run output matches the intended destination.

CI Pipeline Structure

The main workflow is .github/workflows/cicd-main.yml. It triggers on pushes to branches matching pull-request/[0-9]+ and deploy-release/*, on merge groups, on a daily schedule, and on manual dispatch.

is-not-external-contributor
  └─ pre-flight
       └─ configure          # determines scope, container tag, n_repeat
            ├─ linting
            ├─ cicd-container-build
            │    ├─ cicd-parse-unit-tests → cicd-unit-tests-latest
            │    ├─ cicd-parse-integration-tests-h100 → cicd-integration-tests-latest-h100
            │    └─ cicd-parse-integration-tests-gb200 → cicd-integration-tests-latest-gb200 (maintainers only)
            └─ Nemo_CICD_Test  # final pass/fail gate

Images are pushed to:

  • AWS ECR: 766267172432.dkr.ecr.us-east-1.amazonaws.com/…
  • GCP Artifact Registry: us-east4-docker.pkg.dev/nv-projdgxchipp-20260113193621/megatron-lm/…

CI Test Scope Labels

The CI pipeline reads PR labels to decide test scope, n_repeat, and container image.

Decision tree (first match wins):

Conditionscopen_repeatlightweightNotes
Merge groupmr-github1falseAutomatic, no label needed
Label: Run testsmr-github1trueTrains 4 steps, no golden-value compare
Label: Run functional testsmr-github5falseTrains 100 steps, golden-value compare
(no label)mr-github-slim5falseSlim subset only

Orthogonal image label:

LabelEffect
container::ltsUse the LTS base image instead of dev (combinable with any scope label)
Run MBridge testsAlso triggers the MBridge L1 test suite

Which label to attach when opening a PR

Changed paths / nature of changeLabel to attach
Docs only (docs/, *.md, docstrings)(none)
CI/tooling only (.github/, tools/, Makefile)(none)
Test files only (tests/) — existing tests, no new golden valuesRun tests
New test cases added (no golden values exist yet)Run functional tests
Re-enabling a disabled test (scope -broken → active)Run functional tests
Non-numerical library code (logging, error handling, CLI flags, refactors)Run tests
Could affect training numerics (model arch, attention, optimizer, distributed, MoE routing)Run functional tests
Container or dependency changes (docker/, pyproject.toml, uv.lock)Run tests + container::lts
Touches MBridge integrationadd Run MBridge tests

Rule of thumb: default to Run tests. Always use Run functional tests when the PR adds new test cases (golden values must be generated) or when the change could plausibly shift loss curves.


Triggering Internal CI

Use tools/trigger_internal_ci.py after the internal GitLab remote and GITLAB_TOKEN are configured; see @tools/trigger_internal_ci.md for setup details. First run a dry run and verify the destination ref:

python tools/trigger_internal_ci.py --gitlab-origin gitlab --dry-run

The script force-pushes the current branch to pull-request/<branch> before triggering the pipeline. Only target your own pull-request branch, never a shared or protected branch. Add optional --functional-test-* flags only after the dry-run output matches the intended destination.


CI Failure Investigation

CI branches always follow the pattern pull-request/<number>.

Locating the PR from a CI Branch

# Extract PR number from the current branch
PR_NUMBER=$(git rev-parse --abbrev-ref HEAD | grep -oP '(?<=pull-request/)\d+')

# Fetch the PR metadata (title, labels, author, base branch)
gh pr view "$PR_NUMBER" --repo NVIDIA/Megatron-LM

# Show the changeset for that PR
gh pr diff "$PR_NUMBER" --repo NVIDIA/Megatron-LM

Reading CI Job Logs

# List recent workflow runs for the PR
gh run list --repo NVIDIA/Megatron-LM --branch "pull-request/$PR_NUMBER"

# Stream failing job output
gh run view <run-id> --repo NVIDIA/Megatron-LM --log-failed

Full per-rank logs are not in the runner stdout. They are uploaded as GitHub artifacts named logs-<test_case>-<run_id>-<uuid>.

# 1. Find artifact name
gh run view <run-id> --repo NVIDIA/Megatron-LM --json artifacts \
  --jq '.artifacts[].name'

# 2. Download the artifact zip
gh run download <run-id> --repo NVIDIA/Megatron-LM \
  --name "logs-<artifact-name>" -D ./ci-logs

# 3. Locate which rank logs contain errors
grep -r -l "ERROR\|Traceback\|FAILED\|fatal" ./ci-logs/

# 4. Log files can exceed 10 000 lines — never read a full log at once.
wc -l ./ci-logs/<test>/<attempt>/attempt_0/<rank>/stderr.log
sed -n '1,200p' ./ci-logs/.../stderr.log   # read in chunks

Identifying Failure Root Cause

  1. Linting failure — re-run tools/autoformat.sh locally; the diff shows exactly what needs to change.
  2. Container build failure — inspect the cicd-container-build job log.
  3. Unit test failure — the failing bucket is in the cicd-unit-tests-latest job matrix.
  4. Functional test failure — look at the cicd-integration-tests-* job. Start with stdout.log for rank 0.
  5. Flaky test — the runner retries automatically up to 3 times. If all retries exhausted and the pattern matches a known transient (NCCL, ECC, segfault), it is infrastructure noise.

Correlating a Failure with the PR Changeset

# Find unit tests that cover a changed source file
grep -r "from megatron.core.transformer.attention" tests/unit_tests/ -l

# Check CODEOWNERS for reviewer assignment
cat .github/CODEOWNERS | grep "<changed-path>"

nvidia의 다른 스킬

compileiq-debug
nvidia
Use when something is wrong: Search() hangs, all evaluations return INVALID_SCORE, scores aren't improving, every config returns the same number, ptxas errors…
official
create-github-pr
nvidia
gh CLI를 사용하여 GitHub 풀 리퀘스트를 생성합니다. 사용자가 새 PR을 만들거나, 코드 리뷰를 제출하거나, 풀 리퀘스트를 열고자 할 때 사용합니다. 트리거 키워드 -…
official
diagnose-perf
nvidia
First-responder performance triage for Isaac Sim and Isaac Lab. Identifies bottleneck category (GPU-bound, CPU-bound, VRAM, loading) using nvidia-smi and…
official
eagle3-review-logs
nvidia
Review EAGLE3 pipeline experiment logs from the launcher's experiments/ directory. Summarizes pass/fail status for all 4 tasks, diagnoses failures with root…
official
nemoclaw-maintainer-cross-issue-sweep
nvidia
다른 열린 이슈들을 스캔하여 주어진 PR이 함께 수정하거나 실수로 망가뜨릴 수 있는 이슈를 찾습니다. 인접 수정 기회와 모순 위험을 file:line…과 함께 출력합니다.
official
karpathy-guidelines
nvidia
일반적인 LLM 코딩 실수를 줄이기 위한 행동 지침입니다. 코드 작성, 검토 또는 리팩토링 시 과도한 복잡성을 피하고 정밀한 변경을 위해 사용하세요.
official
fhir-basics
nvidia
에이전트에게 FHIR R4 API의 작동 방식, 사용 가능한 리소스, 검색 매개변수를 사용한 쿼리 방법, 모든 응답 형식을 올바르게 파싱하는 방법을 가르칩니다…
official
underdeclared-agent
nvidia
A helpful assistant agent
official