nccl-extensions (Python)
Python bindings for the nccl-extensions communication libraries.
Package layout
This package installs into the nccl namespace, so the import paths are
nccl.ep and nccl.m2n:
import nccl.ep as ep
import nccl.m2n as m2n
It contributes exactly three directories to that namespace, and no
nccl/__init__.py:
| path | contents |
|---|---|
nccl/ep/ |
public facade for nccl_ep, plus CUDA-specific native libraries and headers |
nccl/m2n/ |
public facade for NCCL M2N, plus CUDA-specific native libraries and headers. See the M2N Python guide for API usage and examples. |
nccl/_extensions/ |
internals shared by every extension library — the Cython bindings, binding_dataclass, the distribution version |
Install
CUDA_HOME=/usr/local/cuda pip install -e python/
Building requires a CUDA toolkit and a Cython toolchain.
Stage native artifacts before building a distributable wheel:
python/nccl/ep/lib/cu{12,13}/libnccl_ep.so.0
python/nccl/ep/include/**
python/nccl/m2n/lib/cu{12,13}/libnccl_m2n.so
python/nccl/m2n/include/**
EP wheels include one regular SONAME file (currently libnccl_ep.so.0) in
each nccl/ep/lib/cu{12,13}/ directory. The Python loader opens this file
directly. Native consumers can link with -l:libnccl_ep.so.0 (or its full
path) and set RPATH/RUNPATH to the matching CUDA variant directory. Wheels
do not include the unversioned linker name or the full release-version name.
For a complete Linux wheel build, the internal
build_assets/build_wheels.sh script builds and
stages these artifacts in a temporary project copy before running
cibuildwheel. It does not stage artifacts into the source package tree.
Missing shared libraries emit explicit build warnings by default. Set
NCCL_EXTENSIONS_REQUIRE_NATIVE_LIBS=1 to turn a missing library into a build
error; the production wheel script sets this automatically. With the default
value 0, the resulting wheel is not self-contained and needs compatible
external libraries at runtime.
The sdist is source-only and excludes native shared libraries. Building a wheel from it must stage the native libraries at the paths above to bundle them, or provide compatible external libraries for runtime loading.
Pick a CUDA-variant extra to pull in the matching runtime stack (they forward
to nccl4py's cu12 / cu13 extras, and are mutually exclusive):
pip install -e 'python/[cu13]'
At runtime, the installed cuda.bindings major selects the matching bundled
lib/cu12 or lib/cu13 native libraries. NCCL EP compiles kernels at runtime
with NCCL_EP_JIT_NVCC, NVCC, or the compiler under CUDA_HOME; that compiler
and its headers must match the selected CUDA major.
Do not run Python from inside
python/. There is nonccl/__init__.pythere, so that directory resolves only as a namespace portion and these modules become invisible. Always go through the editable install.
NCCL EP handle lifecycle
Group.create_handle(...) remains the fused route. The v0.2 facade also
exposes the split and imported-handle C APIs, which let applications allocate
routing memory before CUDA graph capture or restore a prepared HT routing
buffer:
import nccl.ep as ep
from nccl.core.typing import NcclDataType
# device_uint8_buffer must provide at least this many bytes.
num_bytes = group.handle_mem_size(ep.Layout.EXPERT_MAJOR, num_topk=-1)
handle_mem = ep.Tensor(device_uint8_buffer)
handle = group.init_handle(
ep.Layout.EXPERT_MAJOR,
num_topk=-1,
handle_mem=handle_mem,
)
handle.update(topk_idx, layout_info=layout_info, stream=stream)
# After copying a prepared HT handle buffer, bind the snapshot locally.
state = ep.HandleState(
num_tokens=num_tokens,
num_topk=num_topk,
topk_idx_datatype=NcclDataType.INT32,
)
restored = group.import_handle(
ep.Layout.EXPERT_MAJOR,
state,
restored_handle_mem,
)
Combine-side MXFP8 is selected with
CombineConfig(quantization_recipe=CombineQuantizationRecipe.MXFP8). It is an
HT expert-major, single-LSA-team path; input tokens are BF16 and
CombineInputs.scales must be None because NCCL EP generates E8M0 scales
internally.
NCCL EP active-mask fault tolerance
Create an LL group with GroupConfig(enable_mask=True) to enable rank masking.
The public group methods expose the mask and the separate host timeout flag:
import numpy as np
# mask_status is a preallocated ep.Tensor over contiguous GPU int32[num_ranks]
# memory on the group's device. Allocate it before CUDA graph capture.
group.mask_query(mask_status, stream=stream)
# Update takes CPU memory; keep it alive and unchanged until stream completion.
mask = np.ones(num_ranks, dtype=np.int32)
mask[-1] = 0 # 1 = active, 0 = masked
group.mask_update(mask, stream=stream)
error = group.get_async_error() # 0 = no error, 1 = a rank timed out
# After at least one LL handle has been initialized, all surviving ranks
# call clean together to reset RDMA buffers and re-admit delayed ranks.
group.mask_clean(stream=stream)
stream.sync()
group.error_clear() # Clean does not clear the timeout flag.
mask_query fills the supplied output without allocating or synchronizing and
supports CUDA graph capture. Keep the output buffer alive through completion of
all graph replays. Read it in stream order, or establish a dependency before
using it on another stream. Reading on the CPU requires a device-to-host copy
and synchronization. mask_update does not promise graph capture support.
Error polling and clearing operate on the host without GPU synchronization.
These methods are not supported for HT groups. Mask cleaning re-admits delayed
ranks within the same communicator; replacing a failed rank requires a new
communicator and EP group.
Generated bindings
Everything under nccl/_extensions/bindings/ is generated and checked in. Do
not edit it by hand. Public builds use these checked-in sources directly.
Metadata
Release files for nccl-extensions 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 299.1 MB
Release files / nccl_extensions-0.2.0-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | nccl_extensions-0.2.0-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 25.1 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
5360b46c5a28dfdb46c0dd9d50d0f4d9a4e2c5096fb90666bae0d66ef3c01695
|
|
BLAKE2b-256 checksum How to use checksums |
fc367624244df305b625aeb193d644a54345d69537980069bf00ee4f214e6328
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / nccl_extensions-0.2.0-cp314-cp314t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | nccl_extensions-0.2.0-cp314-cp314t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 24.8 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
32f9262e995b535d033a1f0d8731d9ed4d0a763334d0155eeead5d2ff949152d
|
|
BLAKE2b-256 checksum How to use checksums |
7e5ecccb7f44fc8255e804e2f9f3e04a79bbac0baf4ef44d400cea883bd7213a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / nccl_extensions-0.2.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | nccl_extensions-0.2.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 25.1 MB |
| Tags | CPython 3.14 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
eee14860a9fe5bf4eb6441f1bd17be7d9814c36a3471255e30d9cc9b3baf68ff
|
|
BLAKE2b-256 checksum How to use checksums |
aa82e9c096d9a0339eec10b3823da7471020dbe7f530f3ecffc581c1b4792558
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / nccl_extensions-0.2.0-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | nccl_extensions-0.2.0-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 24.7 MB |
| Tags | CPython 3.14 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
51753bf18102e856d9400248b917aad71d2c33098290def9000ab357efad566a
|
|
BLAKE2b-256 checksum How to use checksums |
bdebaabeb75a91a3c389a14ace982eb96e42e49978d331c027a06cce9c7b7a78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / nccl_extensions-0.2.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | nccl_extensions-0.2.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 25.1 MB |
| Tags | CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
1dcd4aff2d85216b6410048b09b2599e1c20d03fbd063d8a428e7ba5a0168114
|
|
BLAKE2b-256 checksum How to use checksums |
49d69e1af79949865799bfb4a1f01eb488738b6435ee5c2e2814c76d88ce590e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / nccl_extensions-0.2.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | nccl_extensions-0.2.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 24.8 MB |
| Tags | CPython 3.13 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
ea1c5d9e38355ec48668be8dab483dcb7afbbdcd71015afbd21c49993c2dc052
|
|
BLAKE2b-256 checksum How to use checksums |
719977f2bddf5a42c6e79a1b77d954994355f06a0375bb1079bf1e590c9e0cdb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / nccl_extensions-0.2.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | nccl_extensions-0.2.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 25.1 MB |
| Tags | CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
7db0d5980c734fa94823125d35e1024af86090c7b8f5ffe7de3ba2d242dc52e9
|
|
BLAKE2b-256 checksum How to use checksums |
b5802e510944b5993adb368a37241742e257b2c45b152b3e93f83011be74285e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / nccl_extensions-0.2.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | nccl_extensions-0.2.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 24.8 MB |
| Tags | CPython 3.12 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
6ec10419199cf662519deaa5a7ebf9b8f8c6bcab26623b31a78af4b44ab20a4f
|
|
BLAKE2b-256 checksum How to use checksums |
a96f5144b170010058910672e9a5f8e02898c8831d8b2be0740ef30ef89d51c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / nccl_extensions-0.2.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | nccl_extensions-0.2.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 25.1 MB |
| Tags | CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
d50298ff2d0176e60f5deb1f5ca977071d8e1cd796f50177d2f217b66b330247
|
|
BLAKE2b-256 checksum How to use checksums |
f36ad465f26675cfd648030b6ee0d3f9dc0ad1ddb7bb0a0946bb9a741c28edcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / nccl_extensions-0.2.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | nccl_extensions-0.2.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 24.8 MB |
| Tags | CPython 3.11 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
929b0cc8f3812ec649cd0d905396314fb58ee92cbaccb4f99baaf69d603bbc15
|
|
BLAKE2b-256 checksum How to use checksums |
61e371531a574a4696c1f6c3e1dbda05baddd395b6d1e9562eb7436358bdbd55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / nccl_extensions-0.2.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | nccl_extensions-0.2.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 25.0 MB |
| Tags | CPython 3.10 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
c0e69f3b40c6003c92657c72a2accd30724c8a9db5f83e7d5c1d8a4c33293c55
|
|
BLAKE2b-256 checksum How to use checksums |
afa8b49778030c90fe8c5963fa64c70f4077b02184fb2698a1499c398ab9c9dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / nccl_extensions-0.2.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | nccl_extensions-0.2.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 24.6 MB |
| Tags | CPython 3.10 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
029a0a35cd1c9371a7556fd3be929f89dbb15640fa0ed67572fcad02ab20bf60
|
|
BLAKE2b-256 checksum How to use checksums |
662c36de0d96df9440e56db2fffe14cf7e84d6adb474d2538bc5de4dabc0e2e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Security for nccl-extensions 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.