Official agent skill

Megatron-LM Container and Dependency Setup

by NVIDIA in NVIDIA/Megatron-LM

Walks an agent through working inside the Megatron-LM CI container and changing dependencies with uv, so lock files resolve the same locally and in CI.

OfficialApache-2.0Auto-check passedDevelopment

Install Megatron-LM Container and Dependency Setup

skills CLI
$ npx skills add NVIDIA/Megatron-LM --skill mcore-build-and-dependency -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install NVIDIA/Megatron-LM mcore-build-and-dependency --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/NVIDIA/Megatron-LM.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/mcore-build-and-dependency .claude/skills/mcore-build-and-dependency && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
mcore-build-and-dependency
GitHub stars
18k
Token cost
~2.6k tokens
SKILL.md length
1,047 words
Files
5
Skills in repo
14
Repo updated
First seen
Licence
Apache-2.0

At a glance

Walks an agent through working inside the Megatron-LM CI container and changing dependencies with uv, so lock files resolve the same locally and in CI.

  • Works in 2 steps: Acquire an Image → Launch the Container
  • Setting up a Megatron-LM development environment in the CI container
  • SKILL.md covers Answer-First Constants, Why Containers, dev vs lts and Step 1 — Acquire an Image, plus 3 more sections
  • Calls uv, docker and git

What it does

The skill tells the agent to do all Megatron-LM environment and dependency work inside the project's CI container instead of on the host. That container carries the CUDA toolkit, the PyTorch build and prebuilt native extensions such as TransformerEngine and DeepEP, which are fragile to reproduce on a bare machine. The container's virtual environment is /opt/venv and is already on the PATH.

Two image variants exist. The default dev variant uses docker/.ngc_version.dev and the dev uv group, while lts uses an older long-term-support base and is meant to be used only when you ask for it. Installs use uv sync --locked with the dev, test, linting or lts groups, and dependency edits go through uv add followed by uv lock, both inside the container. Local builds of docker/Dockerfile.ci.dev should target the main stage, because the jet stage needs an internal secret.

When your agent uses it

  • Setting up a Megatron-LM development environment in the CI container
  • Adding or upgrading a package and regenerating uv.lock
  • Answering questions about the dev and lts container variants
  • Choosing which uv group to sync for tests or linting

Example prompts

  • “Get me into the Megatron-LM CI container so I can run the unit tests.”
  • “Add the tabulate package to Megatron-LM and update uv.lock the right way.”
  • “What is the difference between the dev and lts container builds?”

Requirements

  • Docker, to run the Megatron-LM CI container
  • uv inside the container for dependency changes

Workflow steps

2 steps, taken from the step headings in SKILL.md.

  1. Acquire an Image
  2. Launch the Container

What it can do on your machine

Read from SKILL.md and the folder at commit d5fbb65. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • uv
    • docker
    • git
    • bash
    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Megatron-LM Container and Dependency Setup loads about 2.6k tokens when it runs. Until then it costs about 50 tokens; SKILL.md has 1,047 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~50
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from NVIDIA/Megatron-LM at commit d5fbb65, republished under its Apache-2.0 licence (© NVIDIA). 1,047 words, ~2,624 tokens.

Download SKILL.mdSave it as .claude/skills/mcore-build-and-dependency/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
mcore-build-and-dependency
description
Container-based dev environment setup and dependency management for Megatron-LM. Covers acquiring and launching the CI container, uv package management, and updating uv.lock.
license
Apache-2.0
when_to_use
Adding, removing, or updating a dependency; editing pyproject.toml or uv.lock; uv.lock merge conflict; setting up a dev environment; pulling or building the…
metadata.author
Oliver Koenig <okoenig@nvidia.com>

Build & Dependency Guide

The core principle: build and develop inside containers — the CI container ships the correct CUDA toolkit, PyTorch build, and pre-compiled native extensions (TransformerEngine, DeepEP, …) that cannot be reproduced on a bare host.

Answer-First Constants

For text-only dependency or container questions, give these repo-specific facts up front before the longer workflow:

  • Run dependency work inside the Megatron-LM CI container, not on the host.
  • The container venv is /opt/venv, already on PATH.
  • Default dev uses docker/.ngc_version.dev and the dev uv group; lts uses docker/.ngc_version.lts and the lts uv group. The container::lts PR label selects the LTS path; otherwise CI uses dev.
  • lts is opt-in only when the user explicitly asks for it. It is the older long-term-support base, not a routine second lane — never attach container::lts, build the LTS image, or run the lts uv group on your own initiative, not even for a container or dependency change.
  • Install commands inside the container: uv sync --locked --group dev --group test, uv sync --locked --only-group linting, or uv sync --locked --group lts --group test.
  • Dependency edits use uv add <package> followed by uv lock, both inside the container.
  • docker/Dockerfile.ci.dev has main and jet stages. The jet stage needs an internal secret; local/public builds should pass --target main.

Why Containers

Megatron-LM depends on CUDA, NCCL, PyTorch with GPU support, TransformerEngine, and optional components like ModelOpt and DeepEP. Installing these on a bare host is fragile and hard to reproduce. The project ships Dockerfiles that pin every dependency.

Use the container as your development environment. This guarantees:

  • Identical CUDA / NCCL / cuDNN versions across all developers and CI.
  • uv.lock resolves the same way locally and in CI.
  • GPU-dependent operations (training, testing) work out of the box.

dev vs lts

Two image variants exist, each with its own Dockerfile, selected by the container::lts PR label. The defining difference is the base container: dev tracks the latest NGC PyTorch release, while lts ("long-term support") pins the previous, still-supported NGC PyTorch/CUDA release. container::lts exists to verify a change still works on that older base — the dependency differences below follow from it, they are not the point.

VariantBase image pinDockerfileWhere deps liveWhen used
devdocker/.ngc_version.dev (latest NGC release)docker/Dockerfile.ci.devpyproject.toml dev extra (uv-resolved)Default — CI, local development, most PRs
ltsdocker/.ngc_version.lts (older long-term-support release)docker/Dockerfile.ci.ltsdocker/lts/requirements.txt (pinned, sourced from main's uv.lock at AUT-479)Backward-compat lane — verify the change still runs on the older NGC base; extras not carried on it (ModelOpt, the CUDA-13 TransformerEngine build) are dropped

LTS deps used to live in [project.optional-dependencies].lts in pyproject.toml. They were moved into docker/lts/requirements.txt so pyproject.toml can host meaningful module-level extras without colliding with the LTS pin set. To bump an LTS dependency, edit the version in docker/lts/requirements.txt and rebuild docker/Dockerfile.ci.lts.

Use dev for everything. lts is off-limits unless the user explicitly asks for it. CI runs dev by default, and that is the only variant you touch on your own initiative. Treat container::lts as a high barrier, not a fallback: do not attach the label, build docker/Dockerfile.ci.lts, or run the lts uv group unless the user has explicitly requested LTS validation — not even for a container or dependency change. When they do ask, container::lts verifies the change still works on the older long-term-support PyTorch/CUDA base that LTS users run. The @pytest.mark.flaky_in_dev marker skips tests in the dev environment; @pytest.mark.flaky skips them in lts.


Step 1 — Acquire an Image

Option A — NVIDIA-internal: pull a CI-built image

⚠️ Requires access to the internal GitLab instance. See @tools/trigger_internal_ci.md for setup (adding the git remote, obtaining a token).

The internal GitLab CI publishes images to its container registry. Derive the registry host from your configured gitlab remote — the same host you use for trigger_internal_ci.py:

bash
# Derive host from your 'gitlab' remote:
GITLAB_HOST=$(git remote get-url gitlab | sed 's/.*@\(.*\):.*/\1/')

docker pull ${GITLAB_HOST}/adlr/megatron-lm/mcore_ci_dev:main

Option B — Build from scratch (works for everyone)

⚠️ Dockerfile.ci.dev has two stages: main and jet. The jet stage requires an internal build secret and will fail without it. Always pass --target main to stop at the public stage.

bash
# dev image (default)
docker build \
  --target main \
  --build-arg FROM_IMAGE_NAME=$(cat docker/.ngc_version.dev) \
  --build-arg IMAGE_TYPE=dev \
  -f docker/Dockerfile.ci.dev \
  -t megatron-lm:local .

# lts image (uses a dedicated Dockerfile; no IMAGE_TYPE arg)
docker build \
  --target main \
  --build-arg FROM_IMAGE_NAME=$(cat docker/.ngc_version.lts) \
  -f docker/Dockerfile.ci.lts \
  -t megatron-lm:local-lts .

Which image variant is used is controlled by the PR label container::lts; absent that label, dev is used.


Show full SKILL.md (413 more words)Show less

Step 2 — Launch the Container

Option A — Local Docker runtime

bash
docker run --rm --gpus all \
  -v $(pwd):/workspace \
  -w /workspace \
  megatron-lm:local \
  bash -c "<your command>"

Option B — Slurm cluster (for those without a local Docker runtime)

NVIDIA clusters typically use Pyxis + enroot. Request an interactive session:

bash
srun \
  --nodes=1 --gpus-per-node=8 \
  --container-image megatron-lm:local \
  --container-mounts $(pwd):/workspace \
  --container-workdir /workspace \
  --pty bash

For clusters that require a .sqsh archive first:

bash
enroot import -o megatron-lm.sqsh dockerd://megatron-lm:local
srun \
  --nodes=1 --gpus-per-node=8 \
  --container-image $(pwd)/megatron-lm.sqsh \
  --container-mounts $(pwd):/workspace \
  --container-workdir /workspace \
  --pty bash

Dependency Management

Dependencies are declared in pyproject.toml. The venv lives at /opt/venv inside the container (already on PATH).

All uv operations must be run inside the container. Never run uv sync / uv pip install on the host.

uv Dependency Groups
GroupPurpose
trainingRuntime training extras
devFull dev environment (TransformerEngine, ModelOpt, …)
testpytest, coverage, nemo-run
lintingruff, black, isort, pylint
buildCython, pybind11, nvidia-mathdx

The previous lts extra has been emptied. LTS deps are pinned in docker/lts/requirements.txt rather than pyproject.toml. Do not add new packages under [project.optional-dependencies].lts.

Install commands (inside the container):

bash
# Full dev + test environment
uv sync --locked --group dev --group test

# Linting only
uv sync --locked --only-group linting

The LTS environment is reproduced by building docker/Dockerfile.ci.lts end-to-end; there is no uv sync-only equivalent because the LTS deps no longer live in pyproject.toml. The LTS top-level pin set is in docker/lts/requirements.txt; bump versions there and rebuild the image.

Several dependencies are sourced directly from git (TransformerEngine, nemo-run, FlashMLA, Emerging-Optimizers, nvidia-resiliency-ext). The locked uv.lock file pins exact revisions; update it with uv lock when changing pyproject.toml.

Adding a New Dependency

Follow this three-step workflow:

  1. Acquire a container image — see Step 1 above.

  2. Launch the container interactively — see Step 2 above.

  3. Update the lock file inside the container, then commit it:

    bash
    # Inside the container:
    uv add <package>          # adds to pyproject.toml and resolves
    uv lock                   # regenerates uv.lock
    # Exit the container, then on the host:
    git add pyproject.toml uv.lock
    git commit -S -s -m "build: add <package> dependency"
Resolving a merge conflict in uv.lock

uv.lock is machine-generated; never resolve conflicts manually. Instead:

bash
git checkout origin/main -- uv.lock   # take main's version as the base
# then inside the container:
uv lock                               # re-resolve on top of your pyproject.toml changes

Common Pitfalls

ProblemCauseFix
uv sync --locked failsDependency conflict or stale uv.lockRe-run uv lock inside the container and commit updated lock
ModuleNotFoundError after pip installpip installed outside the uv-managed venvUse uv add and uv sync, never bare pip install
uv: command not found inside containerWrong container imageUse the megatron-lm image built from Dockerfile.ci.dev
No space left on device during uv opsCache fills container's /root/.cache/Mount a host cache dir via -v $HOME/.cache/uv:/root/.cache/uv
docker build fails with secret-related errorDockerfile.ci.dev has a jet stage that requires an internal secretAdd --target main to stop before the jet stage
access forbidden when pullingRegistry URL includes an explicit port (e.g. :5005)Use ${GITLAB_HOST}/adlr/... with no port — the sed extracts the hostname only

© NVIDIA, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 4 other files in skills/mcore-build-and-dependency of NVIDIA/Megatron-LM.

  • SKILL.md
  • BENCHMARK.md
  • evals/evals.json
  • skill-card.md
  • skill.oms.sig

Open the folder on GitHubat commit d5fbb65

Compare with similar skills

Megatron-LM Container and Dependency Setup next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Megatron-LM Container and Dependency Setup compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Megatron-LM Container and Dependency Setup this skillNVIDIA/Megatron-LM18k—~2.6kAutomated safety check: PassApache-2.0
Sync Dependabot Pinsossf/oss-crs165—~1.7kAutomated safety check: NotesMIT
Flowfile Build and Environment SetupEdwardvaneechoud/Flowfile373—~7.3kAutomated safety check: NotesMIT
AI ServerOpentrons/opentrons521—~2.5kAutomated safety check: NotesApache-2.0
Cyberowlaikarimhabush/cyberowl263—~2.5kAutomated safety check: PassMIT
Generate Nemo Gym Envadithya-s-k/FineEnvs443—~2.1kAutomated safety check: PassApache-2.0

Similar skills

  • After a Dependabot bump of oss-crs-infra/dependabot-pins.Dockerfile, resolve the human-readable version tag for each updated digest, fix the inline comment, and sync the digest to…

    165 GitHub stars~1.7k tokensUpdated 2 days ago
    DevelopmentAuto-check: notes
  • Flowfile Build and Environment Setup

    Edwardvaneechoud/Flowfile

    Recreates every Flowfile development and build environment from scratch, with exact version pins and an explanation of what each Makefile target really does.

    373 GitHub stars~7.3k tokensUpdated today
    DevelopmentAuto-check: notes
  • AI Server

    Opentrons/opentrons

    Conventions for the opentrons-ai-server FastAPI service — project structure, uv dependency management, settings, testing, Docker, and deployment.

    521 GitHub stars~2.5k tokensUpdated today
    DevOps & CloudAuto-check: notes
  • Cyberowlai

    karimhabush/cyberowl

    Check if recent cybersecurity alerts from 10 international CERTs affect your current project.

    263 GitHub stars~2.5k tokensUpdated today
    SecurityAuto-check passed
  • Generate Nemo Gym Env

    adithya-s-k/FineEnvs

    Builds a NeMo Gym (NVIDIA) variant of an RL environment. An agent skill from adithya-s-k/FineEnvs.

    443 GitHub stars~2.1k tokensUpdated yesterday
    DevOps & CloudAuto-check passed
  • Setup Workshop

    brevdev/workshop-build-an-agent

    This skill should be used when the user wants to set up, install, deploy, bootstrap, or "spin up" the Build-an-Agent workshop (a.k.a.

    144 GitHub stars~2.3k tokensUpdated yesterday
    DevOps & CloudAuto-check: notes

More from NVIDIA/Megatron-LM

All 14 skills in this repo
  • Megatron Core Testing Guide

    NVIDIA/Megatron-LM

    Official

    Guide to the Megatron-LM test system: layout, recipe YAML, running and adding unit and functional tests, golden values, marker filters and CI parity.

    18k GitHub starsUsed in 1 repo~2.1k tokens
    Auto-check passed
  • Official

    Refreshes stored golden values from a GitHub Actions run, reports signed percentage changes per model, and writes a summary ready for a pull request description.

    18k GitHub stars~2.8k tokensUpdated today
    Auto-check passed
  • Megatron-LM Base Image Bump

    NVIDIA/Megatron-LM

    Official

    Moves Megatron-LM CI to a newer NVIDIA PyTorch base image, updating both the GitHub and GitLab pins together and handling the CI follow-up.

    18k GitHub stars~2.8k tokensUpdated today
    Auto-check passed
  • Megatron-LM CI/CD Guide

    NVIDIA/Megatron-LM

    Official

    Explains Megatron-LM's CI pipeline, PR scope labels, triggering the internal GitLab CI with a dry run first, and investigating CI failures.

    18k GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Official

    Investigates a failing GitHub Actions run or job for Megatron-LM, finds the root cause plus the PR and test author involved, and files a structured bug issue.

    18k GitHub stars~1.6k tokensUpdated today
    Auto-check passed
  • Official

    Guides moving Megatron Core GPTModel checkpoints, configs, training commands and launch scripts to HybridModel, following the repository's migration document.

    18k GitHub stars~1.6k tokensUpdated today
    Auto-check passed

Questions about Megatron-LM Container and Dependency Setup

What does Megatron-LM Container and Dependency Setup do?

Walks an agent through working inside the Megatron-LM CI container and changing dependencies with uv, so lock files resolve the same locally and in CI. The skill tells the agent to do all Megatron-LM environment and dependency work inside the project's CI container instead of on the host. That container carries the CUDA toolkit, the PyTorch build and prebuilt native extensions such as TransformerEngine and DeepEP, which are fragile to reproduce on a bare machine.

When should I use Megatron-LM Container and Dependency Setup?

Megatron-LM Container and Dependency Setup fits situations like: setting up a Megatron-LM development environment in the CI container; adding or upgrading a package and regenerating uv.lock; answering questions about the dev and lts container variants; choosing which uv group to sync for tests or linting.

How do I install Megatron-LM Container and Dependency Setup in Claude Code?

Run `npx skills add NVIDIA/Megatron-LM --skill mcore-build-and-dependency -a claude-code`. Or copy the skill folder (skills/mcore-build-and-dependency in NVIDIA/Megatron-LM) into .claude/skills/mcore-build-and-dependency in your project. Claude Code loads it when a task matches its description.

How do I install Megatron-LM Container and Dependency Setup in Codex?

Run `npx skills add NVIDIA/Megatron-LM --skill mcore-build-and-dependency -a codex`. Or copy the skill folder (skills/mcore-build-and-dependency in NVIDIA/Megatron-LM) into .agents/skills/mcore-build-and-dependency in your project. Codex loads it when a task matches its description.

Can I use Megatron-LM Container and Dependency Setup in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add NVIDIA/Megatron-LM --skill mcore-build-and-dependency -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mcore-build-and-dependency, .gemini/skills/mcore-build-and-dependency, .github/skills/mcore-build-and-dependency and .opencode/skills/mcore-build-and-dependency in your project.

What does Megatron-LM Container and Dependency Setup need to run?

Going by SKILL.md and its folder, Megatron-LM Container and Dependency Setup needs the command-line tools its instructions call (uv, docker, git, bash and pip). Our summary lists: Docker, to run the Megatron-LM CI container; uv inside the container for dependency changes.

Does Megatron-LM Container and Dependency Setup access the network?

SKILL.md names 1 domain. As links in the text: github.com. This is read from the text; nothing was executed.

Is Megatron-LM Container and Dependency Setup safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Megatron-LM Container and Dependency Setup use?

Megatron-LM Container and Dependency Setup is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Megatron-LM Container and Dependency Setup use?

About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Megatron-LM Container and Dependency Setup?

Skills that share tags, products or a category with Megatron-LM Container and Dependency Setup: Sync Dependabot Pins (ossf/oss-crs, 165 stars), Flowfile Build and Environment Setup (Edwardvaneechoud/Flowfile, 373 stars), AI Server (Opentrons/opentrons, 521 stars) and Cyberowlai (karimhabush/cyberowl, 263 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Megatron-LM Container and Dependency Setup?

NVIDIA (a GitHub organization, an official publisher) maintains it in NVIDIA/Megatron-LM, which has 18,083 GitHub stars. The repository holds 14 skills in this directory. The repository was last updated on October 8, 2026.

Source: NVIDIA/Megatron-LM on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.