For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo module
ccl
Provides Mojo FFI bindings for NCCL (NVIDIA) and RCCL (AMD) collective operations.
Selects and loads the correct vendor library at runtime: librccl.so on AMD
systems and libnccl.so on NVIDIA systems. Exposes allreduce, allgather, and
broadcast collectives, along with communicator initialization helpers and
availability probes.
comptime valuesβ
CCL_LIBRARYβ
comptime CCL_LIBRARY = _Global[StringSlice("CCL_LIBRARY"), _init_ccl_dylib]
NCCL_LIBRARY_PATHSβ
comptime NCCL_LIBRARY_PATHS = List(Path("libnccl.so"), Path("libnccl.so.2"), Path("/usr/lib/x86_64-linux-gnu/libnccl.so"), Path("/usr/lib/x86_64-linux-gnu/libnccl.so.2"), __list_literal__=NoneType(None))
ncclComm_tβ
comptime ncclComm_t = Optional[Pointer[NoneType, MutUntrackedOrigin, _safe=False]]
RCCL_LIBRARY_PATHSβ
comptime RCCL_LIBRARY_PATHS = List(Path("librccl.so"), Path("librccl.so.1"), Path("/opt/rocm/lib/librccl.so"), Path("/opt/rocm/lib/librccl.so.1"), __list_literal__=NoneType(None))
Structsβ
- β
Communicators: Holds NCCL/RCCL communicator handles for a fixed set of GPUs. - β
ncclDataType_t: Data-type selector for NCCL/RCCL collective calls. - β
ncclRedOp_t: Reduction operation selector for NCCL/RCCL collective calls. - β
ncclResult_t: Status code returned by NCCL/RCCL collective operations.
Functionsβ
- β
allgather: Performs an allgather across all GPUs via the vendor CCL library. - β
allreduce: Per-GPU allreduce for use in multi-threaded contexts. - β
broadcast: Per-GPU broadcast for use in multi-threaded contexts. - β
group: Returns a context manager that groups NCCL/RCCL collective calls. - β
init_comms: Pre-initialize NCCL/RCCL communicators. - β
is_allgather_available: Reports whether the vendor CCL allgather symbol is loadable at runtime. - β
is_allreduce_available: Reports whether the vendor CCL allreduce symbol is loadable at runtime. - β
is_broadcast_available: Reports whether the vendor CCL broadcast symbol is loadable at runtime. - β
ncclCommInitAll: Initializes NCCL/RCCL communicators for a set of GPUs. - β
wait_for_comms: Spin-wait until communicators for ngpus have been initialized.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!