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: LowppSpec

NCCL 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_t for the description of each field.

blocking: bool | None = None
cga_cluster_size: int | None = None
collnet_enable: bool | None = None
comm_name: str | None = None
cta_policy: CTAPolicy | None = None
graph_stream_ordering: int | None = None
graph_usage_mode: int | None = None
max_ctas: int | None = None
max_p2p_peers: int | None = None
min_ctas: int | None = None
n_channels_per_net_peer: int | None = None
net_name: str | None = None
num_rma_ctx: int | None = None
nvls_ctas: int | None = None
shrink_share: bool | None = None
split_share: bool | None = None
traffic_class: int | None = None

CTAPolicy

class nccl.core.CTAPolicy(*values)

Bases: IntFlag

NCCL performance policy for CTA scheduling, used by NCCLConfig.cta_policy.

DEFAULT = 0
EFFICIENCY = 1
ZERO = 2

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: LowppSpec

NCCL device communicator requirements configuration.

This is a reusable high-level Python request consumed by Communicator.create_dev_comm(). Per-team requirements are declared through the teams tuple. Each call snapshots the request into independent low-level ncclDevCommRequirements_t and linked ncclTeamRequirements_t storage, including separate multimem output handles. NCCL copies the requirements and linked-list nodes before the call returns; the resulting DevCommResource retains the storage referenced by each outMultimemHandle. This object may therefore be changed between calls without affecting device communicators that were already created. Do not mutate it concurrently with Communicator.create_dev_comm().

See also

ncclDevCommRequirements for the description of each field.

barrier_count: int | None = None
gin_connection_type: NcclGinConnectionType | None = None
gin_context_count: int | None = None
gin_counter_count: int | None = None
gin_exclusive_contexts: bool | None = None
gin_force_enable: bool | None = None
gin_queue_depth: int | None = None
gin_signal_count: int | None = None
gin_strong_signals_required: bool | None = None
gin_traffic_class: int | None = None
gin_va_signals_required: bool | None = None
lsa_barrier_count: int | None = None
lsa_ll_a2a_block_count: int | None = None
lsa_ll_a2a_slot_count: int | None = None
lsa_multimem: bool | None = None
rail_gin_barrier_count: int | None = None
resources: tuple[LsaBarrierRequirement | GinBarrierRequirement | LLA2ARequirement, ...] = ()
teams: tuple[TeamRequirement, ...] = ()
world_gin_barrier_count: int | None = None

Requirement entries

The element types of NCCLDevCommRequirements.teams and NCCLDevCommRequirements.resources.

TeamRequirement

class nccl.core.TeamRequirement(team: NCCLTeam, multimem: bool = False)

Bases: object

A per-team requirement for device communicator creation.

Pass a tuple of these as NCCLDevCommRequirements.teams. When multimem is True, NCCL allocates a multicast handle for the team, retrievable afterwards via multimem_handle().

multimem: bool = False
team: NCCLTeam

LsaBarrierRequirement

class nccl.core.LsaBarrierRequirement(team: NCCLTeam, n_barriers: int)

Bases: object

Requests an LSA barrier resource on team with n_barriers barriers.

Add to NCCLDevCommRequirements.resources; the finalized LsaBarrierHandle is returned in resource_handles.

team: NCCLTeam
n_barriers: int

GinBarrierRequirement

class nccl.core.GinBarrierRequirement(team: NCCLTeam, n_barriers: int)

Bases: object

Requests a GIN barrier resource on team with n_barriers barriers.

Add to NCCLDevCommRequirements.resources; the finalized GinBarrierHandle is returned in resource_handles.

team: NCCLTeam
n_barriers: int

LLA2ARequirement

class nccl.core.LLA2ARequirement(n_blocks: int, max_elements: int, max_element_size: int)

Bases: object

Requests a low-latency all-to-all resource with n_blocks blocks, sized to hold up to max_elements elements of at most max_element_size bytes each.

Add to NCCLDevCommRequirements.resources; the finalized LLA2AHandle is returned in resource_handles.

n_blocks: int
max_elements: int
max_element_size: int