Skip to main content

Build

Nccl Build

skillsOfficialCertified

Use to build NCCL, its repository examples, and optionally nccl-tests on a CUDA Linux host - guide environment detection, GPU architecture selection, Make builds, and safe execution.

  • New
  • v1.0.0
  • Reviewed Dec 4
  • No reviews yet

Capabilities

  • Purpose

    Get NCCL, its examples, and optionally

  • Required inputs

    These values must be resolved, although they may be discovered rather than

  • Optional inputs

    Never guess a CUDA path, unsupported GPU architecture, install prefix, or MPI

  • Human Approval Boundary

    Do not execute any command that changes files, downloads source, compiles code,

Getting started

Full instructions

Example command

Instructions

make -j<N> src.build CUDA_HOME=<cuda> BUILDDIR=<dir> NVCC_GENCODE="<targets>"

Instructions: SKILL.mdv1.0.0

NCCL Build

Purpose

Get NCCL, its examples, and optionally
nccl-tests, built on Linux with CUDA.

Prerequisites

  • A CUDA-capable Linux build host. A visible GPU is optional for compilation
    but required to run GPU examples or nccl-tests.
  • CUDA Toolkit with nvcc, GNU Make, g++, and Python 3.
  • An NCCL checkout containing makefiles/version.mk, or permission to clone
    https://github.com/NVIDIA/nccl.git.
  • Write access to the selected build directory and enough free disk space.
  • Optional: NVIDIA driver and nvidia-smi for architecture detection; MPI
    compiler and runtime when an example or nccl-tests build uses MPI.

Do not install missing prerequisites. Report them and let the user decide how
to provide them.

Inputs

Resolve these inputs from the user's request and environment before proposing a
build:

Required inputs

These values must be resolved, although they may be discovered rather than
provided explicitly:

  • checkout: NCCL source directory; default to the current directory only when
    it contains makefiles/version.mk.
  • CUDA_HOME: user-supplied CUDA Toolkit root, otherwise derive it from
    nvcc on PATH.
  • BUILDDIR: output directory; use the repository default only when the user
    has not requested another location.
  • N: parallel Make job count; ask or choose a conservative host-appropriate
    value and identify it as agent-derived.
  • NVCC_GENCODE: target GPU architecture flags. Derive these from visible
    GPUs, or ask when no GPU is visible or multiple architectures require a
    choice.
  • action: build NCCL, install it, build a repository example, or build/run
    nccl-tests.

Optional inputs

  • Build flags for non-default configurations.
  • Install prefix when installation is requested.
  • Repository example selection.
  • MPI enablement and MPI installation settings.

Never guess a CUDA path, unsupported GPU architecture, install prefix, or MPI
configuration.

Human Approval Boundary

Do not execute any command that changes files, downloads source, compiles code,
installs artifacts, runs GPU workloads, or otherwise alters system state
without explicit user confirmation.

Before each such operation:

  1. Show the exact command and affected paths.
  2. Explain its purpose and expected changes.
  3. Ask the user to approve, modify, or cancel it.
  4. Wait for explicit approval immediately before execution.

Approval applies only to the displayed command. Obtain new approval if the
command changes. Never run cleanup, deletion, overwrite, package installation,
sudo, or system-wide installation commands without separate explicit
approval. Read-only environment and prerequisite checks may run without
confirmation.

Instructions

  1. Run these read-only prerequisite checks directly, combined in one shell
    command; they are safe and need no consent. Do not follow up by searching
    the filesystem for other CUDA installations or checkouts; report what is
    missing and ask instead:
    • uname -sm
    • locate nvcc from <CUDA_HOME>/bin/nvcc when CUDA_HOME is given,
      otherwise from PATH; run nvcc --version and nvcc --list-gpu-code
    • command -v make g++ python3
    • once the checkout and BUILDDIR are resolved, verify that the build
      directory's parent is writable and inspect available disk space
    • if nvidia-smi is available, run
      nvidia-smi --query-gpu=index,name,compute_cap --format=csv,noheader
      Report missing requirements instead of installing them. An unavailable,
      failing, empty, or unparseable nvidia-smi result means no GPU
      architecture was detected, not that compilation is impossible: ask for the
      target arch. With several visible archs, ask whether
      to build all or one. Confirm every target appears in
      nvcc --list-gpu-code.
  2. Work in an NCCL checkout (makefiles/version.mk present), or show:
    git clone https://github.com/NVIDIA/nccl.git, identify the destination,
    and wait for explicit approval before cloning.
  3. Show the resolved build command:
    bash
    env -u LD_PRELOAD -u LD_AUDIT -u LD_LIBRARY_PATH \
      make -j<N> src.build CUDA_HOME=<cuda> BUILDDIR=<dir> NVCC_GENCODE="<targets>"
    
    Before running a build, clone, install, or test command, give its one-line
    goal and a Parameter | Value | Meaning | Source table, then ask: run as
    shown, change, or cancel. On change, keep the other resolved values, apply
    the requested edits, revalidate affected inputs, and present the revised
    command for fresh approval. Read-only checks need no prompt. Never use
    sudo or /usr/local unless requested.
    When the user only asks to see the command, present it fully resolved from
    the values they supplied even if prerequisites are missing; for example,
    sm_90 becomes NVCC_GENCODE="-gencode=arch=compute_90,code=sm_90". Mark
    values not yet validated in the Source column, list the missing
    prerequisites, and do not run the command.
  4. Verify <dir>/include/nccl.h and <dir>/lib/libnccl.so*; this directory
    is NCCL_HOME. For static-only builds, see
    references/build_options.md. For runtime:
    export LD_LIBRARY_PATH="<NCCL_HOME>/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}".
  5. Install only if asked. Reuse the verified build's BUILDDIR, CUDA_HOME,
    NVCC_GENCODE, and every other build-affecting Make variable; if no build
    directory was selected in this context, ask for it rather than defaulting
    to ./build. Present and obtain consent for:
    bash
    env -u LD_PRELOAD -u LD_AUDIT -u LD_LIBRARY_PATH \
      make src.install CUDA_HOME=<cuda> BUILDDIR=<build-dir> \
      NVCC_GENCODE="<targets>" PREFIX=<install-prefix> [same-build-flags]
    
    After installation, verify <install-prefix>/include/nccl.h and
    <install-prefix>/lib/libnccl.so*.
    For repository examples read references/examples.md; for CMake or
    advanced flags read references/build_options.md; for nccl-tests read
    references/nccl_tests.md.

Validation and Error Handling

  • Validate all requested targets against nvcc --list-gpu-code before Make.
    Reject unsupported targets and do not start the build.
  • Treat any nonzero clone, configure, build, install, or test exit status as a
    failure. Preserve the relevant command and concise error output; never claim
    success from partial artifacts.
  • After a successful src.build, require both <dir>/include/nccl.h and at
    least one <dir>/lib/libnccl.so*. After a static-only build, require
    <dir>/include/nccl.h and <dir>/lib/libnccl_static.a.
  • After an example or nccl-tests build, verify the requested executable exists
    before offering to run it.
  • If a command fails, diagnose the first actionable error, keep the source and
    existing artifacts intact, and propose the smallest retry. Ask for consent
    again before a changed build, install, or test command.
  • If required input remains unresolved, stop before mutation and ask one
    focused question.

Troubleshooting

  • nvcc missing: report that CUDA Toolkit is unavailable and ask for a valid
    CUDA_HOME; do not install CUDA.
  • nvidia-smi missing or no GPU visible: compilation can continue after the
    user supplies a target architecture; do not guess one.
  • Unsupported NVCC_GENCODE: show the codes from nvcc --list-gpu-code and
    ask for a supported target.
  • makefiles/version.mk missing: the directory is not an NCCL checkout. Offer
    the official clone command and wait for consent.
  • Compiler or linker failure: report the first relevant error and the resolved
    CUDA, compiler, target, and build-directory values.
  • Runtime loader cannot find NCCL: prepend <NCCL_HOME>/lib to
    LD_LIBRARY_PATH without discarding the existing value.
  • MPI headers or libraries missing: disable MPI unless required, or follow
    references/nccl_tests.md after the user supplies the MPI installation.

Limitations

  • This skill supports CUDA Linux hosts only; it does not build NCCL on macOS or
    Windows.
  • A no-GPU host can compile but cannot validate runtime collective behavior.
  • Cross-compilation, package creation, container-image construction, and
    cluster provisioning are outside the default workflow.
  • Successful local compilation does not prove multi-node networking, RDMA, or
    performance correctness.
  • Repository examples and nccl-tests have separate dependencies and consent
    boundaries; building NCCL does not authorize building or running them.

Examples

Standard local build

For “Build NCCL with the visible GPUs,” run the prerequisite checks, derive and
validate the GPU targets, resolve all parameters, then present:

bash
env -u LD_PRELOAD -u LD_AUDIT -u LD_LIBRARY_PATH \
  make -j<N> src.build CUDA_HOME=<cuda> BUILDDIR=<dir> \
  NVCC_GENCODE="<validated-targets>"

Show the goal and Parameter | Value | Meaning | Source table, then wait for
the user to run as shown, change, or cancel.

Build when no GPU is visible

For “Build NCCL in this CUDA container; no GPU is visible,” explain that
compilation is still possible, ask for the target architecture, validate it
with nvcc --list-gpu-code, and only then present the resolved build command.
Report built, not run after successful artifact validation.

Missing CUDA compiler

For “Prepare an NCCL build, but nvcc is unavailable,” report nvcc as a
missing prerequisite, ask whether the user has a CUDA Toolkit path to use, and
stop without installing packages, invoking Make, or claiming success.

Guardrails

Tests come only from NVIDIA/nccl-tests, checked out outside the NCCL tree.
Environment checks are read-only. Never install packages or use sudo to
repair a missing dependency unless the user explicitly asks.

Explore more skills

Browse all
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Signing

SignedSLSA L2
Signed by
skills-hub.ai distributor
Method
Distributor-signed by skills-hub.aiSigned with the skills-hub.ai Ed25519 distributor key over this exact slug, version and content. Check it with `npx @skills-hub-ai/cli verify`.
Key
skills-hub-ed25519-2026-11
Signed

Reviews (0)

More from skills

View source →

Frequently asked questions about nccl-build

What does the nccl-build skill do?

Use to build NCCL, its repository examples, and optionally nccl-tests on a CUDA Linux host - guide environment detection, GPU architecture selection, Make builds, and safe execution. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the nccl-build skill?

Run `npx @skills-hub-ai/cli install skills-nccl-build` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/skills-nccl-build/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does nccl-build work with?

nccl-build runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the nccl-build skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use nccl-build after installing it?

In Claude Code, type `/skills-nccl-build` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the nccl-build skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.

Badge for your README

Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.

Install on Skills Hub badge preview
Markdown
[![Install on Skills Hub](https://skills-hub.ai/api/badges/skill/skills-nccl-build)](https://skills-hub.ai/skills/skills-nccl-build)
HTML
<a href="https://skills-hub.ai/skills/skills-nccl-build"><img src="https://skills-hub.ai/api/badges/skill/skills-nccl-build" alt="Install on Skills Hub"></a>

More options in the badge docs.