Configuration
Configuration objects passed to communicator creation methods, plus the flag enums they consume.
NCCLConfig
Used by Communicator.init(), Communicator.initialize(),
Communicator.split(), Communicator.shrink(), and
Communicator.grow(). Fields left unset (None) remain at NCCL’s
internal default; values are validated by the C library when the config is
consumed.
- class nccl.core.NCCLConfig(*, blocking: bool | None = None, cga_cluster_size: int | None = None, min_ctas: int | None = None, max_ctas: int | None = None, net_name: str | None = None, split_share: bool | None = None, traffic_class: int | None = None, comm_name: str | None = None, collnet_enable: bool | None = None, cta_policy: CTAPolicy | None = None, shrink_share: bool | None = None, nvls_ctas: int | None = None, n_channels_per_net_peer: int | None = None, nvlink_centric_sched: bool | None = None, graph_usage_mode: int | None = None, num_rma_ctx: int | None = None, max_p2p_peers: int | None = None, graph_stream_ordering: int | None = None)
Bases:
LowppSpecNCCL configuration for communicator initialization.
Provides configuration options for NCCL communicators, allowing fine-tuning of performance and behavior characteristics. Fields not set in the constructor remain at NCCL’s internal default; values are validated by the C library when the config is consumed.
See also
ncclConfig_tfor the description of each field.- blocking: bool | None = None
Blocking (True) or non-blocking (False) communicator behavior. If unset, NCCL uses True.
- cga_cluster_size: int | None = None
Cooperative Group Array (CGA) size for kernels (0-8). If unset, NCCL uses 4 for sm90+, 0 otherwise.
- min_ctas: int | None = None
Minimum number of CTAs per kernel; positive integer up to 32. If unset, NCCL uses 1.
- max_ctas: int | None = None
Maximum number of CTAs per kernel; positive integer up to 32. If unset, NCCL uses 32.
- net_name: str | None = None
Network module name (e.g. ‘IB’, ‘Socket’). Case-insensitive. If unset, NCCL auto-selects.
Share resources with the child communicator during split. If unset, NCCL uses False.
- traffic_class: int | None = None
Traffic class (TC) for network operations (>= 0). Network-specific meaning.
- comm_name: str | None = None
User-defined communicator name for logging and profiling.
- collnet_enable: bool | None = None
Enable (True) or disable (False) IB SHARP. If unset, NCCL uses False.
Share resources with the child communicator during shrink. If unset, NCCL uses False.
- nvls_ctas: int | None = None
Total number of CTAs for NVLS kernels (positive integer). If unset, NCCL auto-determines.
- n_channels_per_net_peer: int | None = None
Number of network channels for pairwise communication. Positive integer, rounded up to power of 2. If unset, NCCL uses an AlltoAll-optimized value.
- nvlink_centric_sched: bool | None = None
Enable NVLink-centric scheduling. If unset, NCCL uses False.
- graph_usage_mode: int | None = None
Graph usage mode (NCCL 2.29+). Supported values are 0 (no graphs), 1 (one graph), 2 (multiple graphs or mix of graph and non-graph). If unset, NCCL uses 2.
- num_rma_ctx: int | None = None
Number of RMA contexts (NCCL 2.29+). Positive integer. If unset, NCCL uses 1.
- max_p2p_peers: int | None = None
Maximum number of peers any rank will concurrently communicate with using P2P (NCCL 2.30+). Positive integer. If unset, NCCL uses the communicator size.
- graph_stream_ordering: int | None = None
Whether NCCL preserves stream-ordering semantics for collectives captured into CUDA graphs. Supported values are 0 (disabled) or 1 (enabled). The value 0 cannot be combined with
graph_usage_mode=2. Also controllable via theNCCL_GRAPH_STREAM_ORDERINGenvironment variable. If unset, NCCL uses 1.
CTAPolicy
- class nccl.core.CTAPolicy(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
IntFlagNCCL performance policy for CTA scheduling, used by
NCCLConfig.cta_policy.- DEFAULT = 0
Default CTA policy.
- EFFICIENCY = 1
Optimize for efficiency.
- ZERO = 2
Zero-CTA optimization.
NCCLDevCommRequirements
Used by Communicator.create_dev_comm(). Fields left unset
(None) remain at NCCL’s internal default.
- class nccl.core.NCCLDevCommRequirements(*, lsa_multimem: bool | None = None, barrier_count: int | None = None, lsa_barrier_count: int | None = None, rail_gin_barrier_count: int | None = None, lsa_ll_a2a_block_count: int | None = None, lsa_ll_a2a_slot_count: int | None = None, gin_force_enable: bool | None = None, gin_context_count: int | None = None, gin_signal_count: int | None = None, gin_counter_count: int | None = None, gin_connection_type: NcclGinConnectionType | None = None, gin_exclusive_contexts: bool | None = None, gin_queue_depth: int | None = None, gin_traffic_class: int | None = None, world_gin_barrier_count: int | None = None, gin_strong_signals_required: bool | None = None, gin_va_signals_required: bool | None = None, teams: tuple[TeamRequirement, ...] = (), resources: tuple[LsaBarrierRequirement | GinBarrierRequirement | LLA2ARequirement, ...] = ())
Bases:
LowppSpecNCCL device communicator requirements configuration.
This is a reusable high-level Python request consumed by
Communicator.create_dev_comm(). Per-team requirements are declared through theteamstuple. Each call snapshots the request into independent low-levelncclDevCommRequirements_tand linkedncclTeamRequirements_tstorage, including separate multimem output handles. NCCL copies the requirements and linked-list nodes before the call returns; the resultingDevCommResourceretains the storage referenced by eachoutMultimemHandle. This object may therefore be changed between calls without affecting device communicators that were already created. Do not mutate it concurrently withCommunicator.create_dev_comm().See also
ncclDevCommRequirementsfor the description of each field.- lsa_multimem: bool | None = None
Enable multimem on the LSA team. If unset, NCCL uses False.
- barrier_count: int | None = None
Number of barriers required. If unset, NCCL uses 0.
- lsa_barrier_count: int | None = None
Number of LSA barriers. If unset, NCCL uses 0.
- rail_gin_barrier_count: int | None = None
Number of railed GIN barriers. If unset, NCCL uses 0.
- lsa_ll_a2a_block_count: int | None = None
LSA low-latency all-to-all block count. If unset, NCCL uses 0.
- lsa_ll_a2a_slot_count: int | None = None
LSA low-latency all-to-all slot count. If unset, NCCL uses 0.
- gin_force_enable: bool | None = None
Force-enable GPU-Initiated Networking (GIN). If unset, NCCL uses False.
- gin_context_count: int | None = None
Number of GIN contexts (hint; actual count may differ). If unset, NCCL uses 4.
- gin_signal_count: int | None = None
Number of GIN signals (guaranteed to start at id=0). If unset, NCCL uses 0.
- gin_counter_count: int | None = None
Number of GIN counters (guaranteed to start at id=0). If unset, NCCL uses 0.
- gin_connection_type: NcclGinConnectionType | None = None
GIN connection type. If unset, NCCL uses NcclGinConnectionType.NONE.
- gin_exclusive_contexts: bool | None = None
Use exclusive GIN contexts. If unset, NCCL uses False.
- gin_queue_depth: int | None = None
GIN queue depth. If unset, NCCL uses 0.
- gin_traffic_class: int | None = None
GIN traffic class. If unset, NCCL uses its internal default.
- world_gin_barrier_count: int | None = None
Number of world GIN barriers. If unset, NCCL uses 0.
- gin_strong_signals_required: bool | None = None
Whether GIN strong signals are required by kernels using this devComm. When False, using GIN strong signals results in undefined behavior. If unset, NCCL uses True.
- gin_va_signals_required: bool | None = None
Whether GIN VA signals are required by kernels using this devComm. When False, using GIN VA signals results in undefined behavior. If unset, NCCL uses True.
- teams: tuple[TeamRequirement, ...] = ()
Per-team requirements. Entries for the same team (by value) are merged, keeping first-appearance order; multimem is requested for a team if any of its entries sets it. A team requested with
multimem=Trueyields a multimem handle retrievable viamultimem_handle().
- resources: tuple[LsaBarrierRequirement | GinBarrierRequirement | LLA2ARequirement, ...] = ()
Device resource requirements (LSA/GIN barriers, low-latency all-to-all). Each entry yields, in order, a handle in
resource_handles. Entries are kept as-is (not merged): each is a distinct resource.
Requirement entries
The element types of NCCLDevCommRequirements.teams and
NCCLDevCommRequirements.resources.
TeamRequirement
- class nccl.core.TeamRequirement(team: NCCLTeam, multimem: bool = False)
Bases:
objectA per-team requirement for device communicator creation.
Pass a tuple of these as
NCCLDevCommRequirements.teams. Whenmultimemis True, NCCL allocates a multicast handle for the team, retrievable afterwards viamultimem_handle().- multimem: bool = False
LsaBarrierRequirement
- class nccl.core.LsaBarrierRequirement(team: NCCLTeam, n_barriers: int)
Bases:
objectRequests an LSA barrier resource on
teamwithn_barriersbarriers.Add to
NCCLDevCommRequirements.resources; the finalizedLsaBarrierHandleis returned inresource_handles.- n_barriers: int
GinBarrierRequirement
- class nccl.core.GinBarrierRequirement(team: NCCLTeam, n_barriers: int)
Bases:
objectRequests a GIN barrier resource on
teamwithn_barriersbarriers.Add to
NCCLDevCommRequirements.resources; the finalizedGinBarrierHandleis returned inresource_handles.- n_barriers: int
LLA2ARequirement
- class nccl.core.LLA2ARequirement(n_blocks: int, max_elements: int, max_element_size: int)
Bases:
objectRequests a low-latency all-to-all resource with
n_blocksblocks, sized to hold up tomax_elementselements of at mostmax_element_sizebytes each.Add to
NCCLDevCommRequirements.resources; the finalizedLLA2AHandleis returned inresource_handles.- n_blocks: int
- max_elements: int
- max_element_size: int