Mcore Testing
NVIDIAOfficialCreated by Philip PetrakianDistributed by NVIDIA
- Skill
- Guidelines
- Software development
- Apache-2.0
- Medium risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured approach to testing within the Megatron-LM ecosystem. It details the directory layout for unit and functional tests, explains the YAML-based recipe system for CI integration, and outlines procedures for local execution, debugging, and managing test lifecycle, including handling flaky tests and golden value updates.
What it does
- Defines the directory structure for unit and functional test suites.
- Explains the YAML recipe format used for defining and scoping test workloads.
- Provides commands for executing tests locally using torch.distributed.run.
- Outlines the process for adding new unit and functional tests.
- Describes how to manage flaky tests using pytest markers and scope suffixes.
- Details the workflow for downloading and committing golden values for functional tests.
When to use it
- When adding new unit or functional tests to the Megatron-LM codebase.
- When debugging test failures or reproducing CI issues locally.
- When modifying test recipes or updating golden values after code changes.
- When needing to temporarily disable a test without deleting its configuration.
Advantages
- Ensures consistency between local development and CI environments.
- Provides clear patterns for handling flaky tests without blocking pipelines.
- Simplifies the process of adding new test cases through standardized YAML recipes.
- Offers specific guidance on multi-rank testing and distributed execution.
Usage examples
- “How do I run a single unit test file locally?”
- The user is provided with the specific torch.distributed.run command structure required to execute a single test file with the necessary GPU configuration.
- “How can I temporarily disable a functional test in the CI?”
- The user is instructed to suffix the scope in the recipe YAML with -broken to skip the test while preserving the configuration for future use.
- “What is the process for updating golden values after a code change?”
- The user is guided to run the test, then use the download_golden_values.py script with the appropriate pipeline ID to fetch and commit the new values.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/nvidia/mcore-testing/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip mcore-testing.zip -d .agents/skills
Documentation by Philip Petrakian
Testing Guide
Answer-First Testing Facts
For questions about disabling tests without deleting them:
Functional recipe entries stay in YAML; disable by suffixing scope with
-broken, for examplescope: [mr-github]->scope: [mr-github-broken].Unit-test skips use pytest markers instead:
@pytest.mark.flaky_in_devskips in the default dev environment, and@pytest.mark.flakyskips in LTS.Do not delete the test case or recipe entry when the goal is discoverability and easy re-enable.
Test Layout
tests/
├── unit_tests/ # pytest, 1 node × 8 GPUs, torch.distributed runner
├── functional_tests/ # end-to-end shell + training scripts
│ └── test_cases/
│ └── {model}/{test_case}/
│ ├── model_config.yaml # training args
│ └── golden_values_{env}_{platform}.json
└── test_utils/
├── recipes/
│ ├── h100/ # YAML recipes for H100 jobs
│ └── gb200/ # YAML recipes for GB200 jobs
└── python_scripts/ # helpers (recipe_parser, golden-value download, …)How Tests Execute
The GitHub Actions runner invokes launch_nemo_run_workload.py, which uses
nemo-run to launch a DockerExecutor container. The repo is bind-mounted
at /opt/megatron-lm; training data is mounted at /mnt/artifacts.
Unit tests are dispatched through torch.distributed.run:
Ranks 0 and 3 are tee-d to stdout; all other ranks write only to log files.
Per-rank log files land at
{assets_dir}/logs/1/and are uploaded as a GitHub artifact after the run.
Functional tests are driven by
tests/functional_tests/shell_test_utils/run_ci_test.sh. Only rank 0 runs the
pytest validation step; training output from all ranks is uploaded as an artifact.
Flaky-failure auto-retry: launch_nemo_run_workload.py retries up to
3 times for known transient patterns (NCCL timeout, ECC error, segfault,
HuggingFace connectivity, …) before declaring a genuine failure.
Recipe YAML Structure
Recipes live in tests/test_utils/recipes/ and are parsed by
tests/test_utils/python_scripts/recipe_parser.py. Each file expands a
cartesian products block into individual workload specs:
type: basic
format_version: 1
maintainers: [mcore]
loggers: [stdout]
spec:
name: "{test_case}_{environment}_{platforms}"
model: gpt # maps to tests/functional_tests/test_cases/{model}/
build: mcore-pyt-{environment}
nodes: 1
gpus: 8
n_repeat: 5
platforms: dgx_h100
time_limit: 1800
script_setup: |
...
script: |-
bash tests/functional_tests/shell_test_utils/run_ci_test.sh ...
products:
- test_case: [my_test]
products:
- environment: [dev, lts]
scope: [mr-github]
platforms: [dgx_h100]Key runtime placeholders: {assets_dir}, {artifacts_dir}, {test_case},
{environment}, {platforms}, {n_repeat}.
Disabling a Test Without Deleting It
To temporarily disable a test case in a recipe YAML, suffix its scope value
with -broken — do not delete the entry:
# before (test runs in CI)
scope: [mr-github]
# after (test is skipped; entry preserved for easy re-enable)
scope: [mr-github-broken]Running Unit Tests Locally
All unit tests initialize a torch.distributed group, so every invocation
requires GPU access and must go through torch.distributed.run:
# Full suite
uv run python -m torch.distributed.run --nproc-per-node 8 -m pytest -q \
tests/unit_tests
# Single file
uv run python -m torch.distributed.run --nproc-per-node 8 -m pytest -q \
tests/unit_tests/models/test_gpt_model.py
# Single test
uv run python -m torch.distributed.run --nproc-per-node 8 -m pytest -q \
tests/unit_tests/models/test_gpt_model.py::TestGPTModel::test_constructor
# Filter by name substring
uv run python -m torch.distributed.run --nproc-per-node 8 -m pytest -q \
tests/unit_tests -k optimizerMarker filters
# Exclude flaky tests during development
uv run python -m torch.distributed.run --nproc-per-node 8 -m pytest -q \
tests/unit_tests -m "not flaky and not flaky_in_dev"
# Include experimental tests
uv run python -m torch.distributed.run --nproc-per-node 8 -m pytest -q \
tests/unit_tests --experimentalCI parity
Use tests/unit_tests/run_ci_test.sh to reproduce a CI bucket failure exactly.
For ad-hoc runs, prefer the direct torch.distributed.run invocations above.
Gotchas
pyproject.tomlsetsaddopts = --durations=15 -s -rA— stdout is not captured (-s), so ranks interleave during multi-rank runs. Override with--capture=fdwhen debugging a specific rank.tests/unit_tests/conftest.pylooks for test data under/opt/dataand attempts a download if missing. Supply it manually or skip data-dependent tests when running outside the canonical container.
Adding a Unit Test
Create
tests/unit_tests/<category>/test_<name>.py.Use fixtures from
tests/unit_tests/conftest.py.Apply markers as needed:
@pytest.mark.internal— skipped onlegacytag@pytest.mark.flaky_in_dev— skipped indevenvironment (CI default; use this to disable a flaky test without blocking the standard pipeline)@pytest.mark.flaky— skipped inltsenvironment@pytest.mark.experimental—latesttag only
Verify locally (see Running Unit Tests Locally above).
If the test needs a dedicated CI bucket, add an entry to
tests/test_utils/recipes/h100/unit-tests.yaml.
Adding a Functional / Integration Test
Create
tests/functional_tests/test_cases/<model>/<test_name>/.Write
model_config.yamlwithMODEL_ARGS,ENV_VARS, andTEST_TYPE.Add a YAML recipe under
tests/test_utils/recipes/h100/(andgb200/if needed). Required fields:scope,environment,platform,n_repeat,time_limit.Push the PR, add the label "Run functional tests" to trigger a full run.
After a successful run, download golden values:
python tests/test_utils/python_scripts/download_golden_values.py \ --source github --pipeline-id <run-id>Commit the downloaded golden values.
Common Pitfalls
| Problem | Cause | Fix |
|---|---|---|
| Test passes locally but fails in CI | Different environment or data path | Check DATA_PATH, DATA_CACHE_PATH, and the environment tag (dev vs lts) |
| Golden value mismatch after a code change | Numerical regression | Download new golden values via download_golden_values.py after a clean run |
cicd-integration-tests-gb200 not triggered | GB200 jobs require maintainer status | Ask a maintainer to trigger, or add the Run functional tests label |
Files
- ATTRIBUTION.mdAdded by AutoGineer907 B
- BENCHMARK.md2.7 KiB
- LICENSELicence file added by AutoGineer11.2 KiB
- SKILL.md7.3 KiB
- evals/evals.json3 B
- skill-card.md2.5 KiB
- skill.oms.sig4.5 KiB
BENCHMARK.md
Evaluation Report
Evaluation of the mcore-testing skill before publication through NVSkills-Eval.
This benchmark summarizes 3-Tier Evaluation from NVSkills-Eval results for the skill. The goal is to document whether the skill is safe, discoverable, effective, and useful for agents before it is published for broader workflow use.
Evaluation Summary
Skill:
mcore-testingEvaluation date: 2026-05-29
NVSkills-Eval profile:
externalOverall verdict: PASS
Tier 3 live agent evaluation: not available in this report
Agents Used
Tier 3 agent details were not available in this report.
Metrics Used
Reported benchmark dimensions:
Security: checks whether skill-assisted execution avoids unsafe behavior such as secret leakage, destructive commands, or unauthorized access.
Correctness: checks whether the agent follows the expected workflow and produces the correct final output.
Discoverability: checks whether the agent loads the skill when relevant and avoids using it when irrelevant.
Effectiveness: checks whether the agent performs measurably better with the skill than without it.
Efficiency: checks whether the agent uses fewer tokens and avoids redundant work.
Underlying evaluation signals used in this run:
No Tier 3 evaluation signal details were available in this report.
Test Tasks
Tier 3 evaluation task details were not available in this report.
Results
Tier 3 dimension rollup was not available in this report.
Tier 1: Static Validation Summary
Tier 1 validation passed with observations. NVSkills-Eval ran 9 checks and found 7 total findings.
Top findings:
MEDIUM QUALITY/quality_correctness: SKILL_SPEC recommended field missing: 'metadata.tags' (
skills/mcore-testing/SKILL.md)MEDIUM SCHEMA/body_recommended_section: Missing recommended section: '## Instructions' (
skills/mcore-testing/SKILL.md)MEDIUM SCHEMA/body_recommended_section: Missing recommended section: '## Examples' (
skills/mcore-testing/SKILL.md)LOW QUALITY/quality_discoverability: No '## Purpose' section (
skills/mcore-testing/SKILL.md)LOW QUALITY/quality_reliability: No prerequisites/requirements documented (
skills/mcore-testing/SKILL.md)
Tier 2: Deduplication Summary
Tier 2 validation passed. NVSkills-Eval ran 2 checks and found 0 total findings.
Notable observations:
Context Deduplication: Collected 1 file(s)
Inter-Skill Deduplication: Parsed skill 'mcore-testing': 163 char description
Publication Recommendation
The skill is suitable to proceed toward NVSkills-Eval publication based on this benchmark. Skill owners should keep this file with the skill and refresh it when the evaluation dataset, skill behavior, or target agents materially change.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Python, Needs Node.js
Security
What our scanner noticed· Medium risk
- Large base64-encoded blobs
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Philip Petrakian
- Publisher
- NVIDIA (Official)
- Distributed by
- NVIDIA
- Source
- NVIDIA/skills · skills/mcore-testing · commit fce3cca
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE-APACHE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Philip Petrakian or NVIDIA.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download mcore-testing.zip