Networking NVIDIA HPC-X Software Toolkit

Spectrum-X NCCL Plugin

Overview

The Spectrum-X NCCL Plugin provides a set of plugins designed to optimize NVIDIA’s NCCL library for Spectrum-X and Quantum platforms. It enables more resilient and higher-performance communication across these platforms. In HPC-X, the plugin is located at: $HPCX_DIR/nccl_spectrum-x_plugin/lib

Loading the Plugin

For NCCL to detect the network plugin, add the plugin path to the library search path environment variable.

 The plugin can be loaded by explicitly setting the library search path using LD_LIBRARY_PATH

$ export LD_LIBRARY_PATH=$HPCX_DIR/nccl_spectrum-x_plugin/lib:$LD_LIBRARY_PATH$ <run command>

With HPCX, the plugin can also be loaded by NCCL's environment variable NCCL_NET_PLUGIN=spcx

Features

  • Network Failure Recovery  - Automatically detects and recovers from communication link failures, ensuring uninterrupted distributed training and system stability without user intervention.

  • Dynamic Network Load Balance -  Dynamically redistributes data across multiple network interfaces based on available throughput and communication patterns, preventing bottlenecks and improving overall transfer efficiency.

  • Topology Awareness – Automatically detects long-haul connections using network topology information and applies optimized transport settings to enhance overall network performance.

  • NCCL Profiler Plugin – Enables detailed monitoring of NCCL’s internal network activity during communication.

Resiliency and Load Balancing

The Spectrum-X NCCL Plugin provides enhanced resiliency and load-balancing capabilities when multiple network devices (ports or NICs) are available per GPU in AI workloads. Starting from version 1.2, the plugin also considers the communication pattern being executed by NCCL, like number of peers and traffic per peer, along with device load characteristics to provide optimal distribution of traffic across multiple network devices.  

Topology Injection and Awareness

Starting with version 1.2, the Spectrum-X NCCL Plugin introduces a mechanism to specify network topology and transport parameters. The plugin supports specifying topology through a file format similar to Slurm’s topology format, where each entry defines connections between switches and hosts with relative latency or cable-length values.

Based on this topology, the plugin automatically identifies long-haul connections and takes advantage of NVIDIA XGS configuration for these. It also improves the NCCL algorithm selection model by taking the latencies across the long-haul connections into account.

For more information, refer to NVIDIA XGS.

Configurable Bandwidth Loss Limits

Starting with version 1.3, the Spectrum-X NCCL Plugin introduces configurable thresholds for acceptable bandwidth degradation during transparent failover. Applications can specify multi-tier limits where higher bandwidth loss triggers shorter tolerance windows before a fatal error is raised. Configuration is done through the NCCL_IB_NIC_BW_LOSS_LIMITS environment variable, which accepts comma-separated pairs of loss percentage and duration in minutes:

$ export NCCL_IB_NIC_BW_LOSS_LIMITS=25:2,50:1

This example configuration triggers a fatal error if bandwidth loss reaches 25% for 2+ minutes, and 50% for 1+ minute, allowing brief performance drops during recovery while preventing long-running jobs from continuing with severely degraded performance.

SHARP

Plugin supports Scalable Hierarchical Aggregation and Reduction Protocol (SHARP) - an in-network computing technology on InfiniBand Quantum switches. 

The following environment variable enables the SHARP aggregation with NCCL when using the plugin.

NCCL_COLLNET_ENABLE=1

NVIDIA switches allow a limited number of streaming aggregation flows (maximum: 2). On systems with multiple GPUs and multiple HCAs, NCCL creates an aggregation streaming flow (NCCL Ring/Channel) per HCA rail. It is required to build the cluster topology in such a way that leaf level switches are connected to the same HCA rail from each server.

The following environment variable enables SHARP allgather overlap when using the plugin. This is useful when SHARP‑based Reduce‑Scatter is enabled, so the Reduce‑Scatter ↔ Allgather phase can overlap.

SHARP_COLLNET_OVERLAP_AG=1

Note: In this release, the bundled NCCL tuner enables CollNetDirect AllGather only at PPN=1; for multi-PPN runs, set NCCL_TUNER_PLUGIN=none before NCCL initialization.


GPU-Initiated Networking (GIN)

The Spectrum-X (SPCX) NCCL Plugin adds GIN support on top of the standard Spectrum-X network plugin. GIN allows GPU kernels to initiate network put/signal operations. Load the SPCX plugin as described in before.

GIN backends

With NCCL_GIN_ENABLE=1, set NCCL_GIN_TYPE to select the backend exposed by the Spectrum-X plugin:

  • Proxy — NCCL_GIN_TYPE=2. Host-side progress over InfiniBand verbs. 

  • GDAKI — NCCL_GIN_TYPE=3. GPU-initiated path using DOCA GPUNetIO. 

  • GPI — NCCL_GIN_TYPE=4. General-push interface uses Spectrum-X software and hardware capabilities, and in this release, it is based on an experimental GPI interface.

 

GIN GPI Requirements (Experimental GPI Interface)

  • GPI is supported only through the Spectrum-X plugin; set NCCL_NET_PLUGIN=spcx to enable it. GPI requires NCCL 2.30.7 or later, a Spectrum-X switch and a Connect-X NIC (CX8+) with GPUDirect RDMA enabled (peermem or DMA-BUF).

  • For X86-based system, GPI requires setting the PeerMappingOverride=1

    • $ cat /etc/modprobe.d/nvidia.conf
      options nvidia NVreg_RegistryDwords="PeerMappingOverride=1;"

  • The current GPI backend uses an experimental GPI interface intended for early enablement and is subject to change.

  • Current GPI release is supported only with physical-function (PF) NICs. Virtual-function (VF) and VF+PF hybrid configurations are not supported.

  • For MPI/UCX launches, if UCX and SPCX GPI use the same HCA ports, UCX device-memory allocations can prevent GPI channel creation. Set `UCX_IB_DM_COUNT=0` before MPI initialization.


Default GIN backend

If NCCL_GIN_TYPE is unset, the Spectrum-X plugin uses auto-selection:

  • Try GDAKI (GPUNetIO) first when the plugin is built with GDAKI support, GPUNetIO-capable devices are present, and GPU Direct RDMA requirements are met. Log line: GIN: using GDAKI backend.

  • If GDAKI cannot be used (no devices or no GDR), fall back to Proxy (host verbs). Log line: GIN: using Proxy backend.

  • GPI is not auto-selected. Set NCCL_GIN_TYPE=4 explicitly to use GPI.

 
Environment variables — Spectrum-X / NCCL

Core settings for GIN with the Spectrum-X plugin (assuming SPCX plugin has already been selected by NCCL):

Variable

Default

Description

NCCL_GIN_ENABLE

1

Set to 0 to disable GIN

NCCL_GIN_TYPE

-1

-1 = Auto, 2 = Proxy; 3 = GDAKI; 4 = GPI 

 

All other NCCL GIN parameters

Connection counts, context counts, GPUNetIO library path, symmetric GIN kernels, and other tuning (for example NCCL_GIN_NCONNECTIONS, NCCL_GIN_NCONTEXTS, NCCL_GIN_GPUNETIO_PATH, NCCL_SYM_GIN_KERNELS_ENABLE) are defined in the NVIDIA NCCL User Guide. Use the NCCL documentation for those variables.

 Please visit NCCL Documentation

Known limitations

 

The following apply to the current Spectrum-X plugin and HPC-X drop. They are targeted for fix in the next HPC-X release.

  • GPI + symmetric collectives + CTA limit. Symmetric NCCL collectives over GIN (NCCL_SYM_GIN_KERNELS_ENABLE=1) on GPI require NCCL_SYM_CTAS of 32 or less. Higher CTA counts are not supported on the current GPI path and can cause failures on symmetric ReduceScatter / AllGather. Until the next HPC-X release, keep NCCL_SYM_CTAS<=32 for GPI symmetric workloads, or avoid symmetric GIN collectives on GPI except for validation.

  • GPI may run into a memory allocation issue due to limited resources. If you see something like Cannot allocate memory error, try reducing the channel size (ginQueueDepth) and/or the number of gin contexts (ginContextCount) in the ncclDevCommRequirements structure

  • GPI on InfiniBand. If GPI fails during QP connection with an INIT→RTR error, set this temporary workaround before launch: GWQ_USE_GRH=1


NetInspector Profiler

The Spectrum-X NCCL Plugin extends the NCCL Inspector profiler with NetInspector, which adds network-level instrumentation and telemetry.

NetInspector provides:

  • Collective performance – Per-collective metrics including algorithm bandwidth, bus bandwidth, message sizes (full logical and per-rank), execution time, and timing source (GPU/CPU). Supports optional verbose mode with detailed event sequence numbers and timestamps per kernel channel. With DTS export, collective metrics are also accumulated and exported as counters (nccl_coll_*).

  • Transaction-level metrics – Per-transaction send/receive data including chunk sizes, resent bytes, div sizes (for app-aware load balancing), peer addressing, and collective/P2P context. Requires NCCL_INSPECTOR_TELEMETRY_LEVEL=2.

  • Burst bandwidth telemetry – Real-time bandwidth measurements per InfiniBand device using exponential moving averages (EMA). Export cadence is controlled by NCCL_INSPECTOR_BURST_BANDWIDTH_FLUSH_INTERVAL_MS.

  • Burst slowdown detection – Configurable threshold-based alerts when burst bandwidth falls below expected levels, with deficit tracking (deficit_gbps).

  • Queue Pair and Load Balancing telemetry – QP create events and cumulative load-balancing (CLB) weight metrics per device. Weights are updated on each QP weight change and also heartbeated on the dynamic-flow resample interval. Load-balance weight-asymmetry variance between planes is also exported.

  • Dynamic-Flow telemetry – Periodic resample of 12 InfiniBand failure/recovery counters (nccl_ib_*_total) that track sender/receiver recovery lifecycle, backup device activation/deactivation, persistent bandwidth-loss failures, and QPs reaching minimum allowed bandwidth.

  • Device resilience – Device failure and recovery events with total bandwidth, active device count, and bandwidth delta tracking.

  • Link error monitoring – Link error events with IB work completion status codes and cumulative link-error counts per device.

  • Async thread events – InfiniBand asynchronous event monitoring (port state changes, errors, etc.) captured from the IB async thread.

Export Formats

NetInspector supports two export backends:

JSON Lines (.jsonl) — NCCL_INSPECTOR_DUMP_TYPE=json

Offline, per-event records with microsecond-level timestamps. Output directory defaults to nccl-inspector-unknown-jobid or nccl-inspector-<SLURM_JOBID> under SLURM (overridable via NCCL_INSPECTOR_DUMP_DIR).

DTE (DOCA Telemetry Exporter) — NCCL_INSPECTOR_DUMP_TYPE=dts

Prometheus-compatible metrics via CollectX. Discrete device/link/burst/async events require optional OTLP logs (NCCL_INSPECTOR_DTS_OTLP_LOGS=1).

Metrics can be exported by pull (Prometheus scrape endpoint) or push (Prometheus Remote Write / PRW), or both:

Prometheus scrape endpoint (pull) — CollectX exposes a local HTTP metrics endpoint for Prometheus (or another scraper) to pull from:

export NCCL_INSPECTOR_DUMP_TYPE=dts
export PROMETHEUS_ENDPOINT="http://0.0.0.0:9091"

Then scrape http://<host>:9091/metrics from Prometheus.

Prometheus Remote Write / PRW (push) — CollectX pushes time-series samples to a remote Prometheus-compatible receiver:

export NCCL_INSPECTOR_DUMP_TYPE=dts
export CLX_REMOTE_WRITE_RECEIVER="http://RECEIVER_HOST:RECEIVER_PORT/api/v1/write"

# For exporting via Prometheus Remote Write protocol v2, add:
export CLX_REMOTE_WRITE_CONTENT_TYPE="application/x-protobuf;proto=io.prometheus.write.v2.Request"

# Recommended for short jobs so shutdown flush can complete:
export CLX_REMOTE_WRITE_METRICS_SHUTDOWN_FLUSH_TIMEOUT_MS=500

# For exporting OTLP logs to an open telemetry receiver
export NCCL_INSPECTOR_DTS_OTLP_LOGS=1
export CLX_OPEN_TELEMETRY_RECEIVER="http://RECEIVER_HOST:RECEIVER_PORT/"

Environment Variables

Variable

Default

Description

NCCL_INSPECTOR_ENABLE

0

Enables the Inspector plugin. Set to 1 to enable profiling.

NCCL_PROFILER_PLUGIN

Path to the profiler plugin library. Example: /path/to/libnccl-profiler-inspector.so, or inspector to search in LD_LIBRARY_PATH.

NCCL_INSPECTOR_TELEMETRY_LEVEL

0

Controls network-event verbosity:
0 = collective and kernel-channel events only (no net events);
1 = net events enabled (QP, burst BW, link/device/async, dynamic-flow; no per-transaction logging);
2 = full telemetry including per-transaction logging (also enables P2P/proxy event activation). Transaction records are JSON-only.

NCCL_INSPECTOR_DUMP_TYPE

json

Export backend:
0/none = disabled;
1/json = JSON Lines;
2/dts = DOCA Telemetry Service. Accepts integer or string values.
When unset, defaults to JSON.

NCCL_INSPECTOR_DUMP_THREAD_INTERVAL_MICROSECONDS

0

Interval (µs) for the internal dump thread. 0 disables the dump thread. Lower values increase export frequency but may affect performance.
Standard value is 1000000 (1 second) or higher.

NCCL_INSPECTOR_DUMP_VERBOSE

0

Enables detailed event trace output (sequence numbers, timestamps per kernel channel). Applies to JSON export. Set to 1 for verbose mode.

NCCL_INSPECTOR_DUMP_DIR

(auto-generated)

Output directory for JSON profiler logs. Defaults to nccl-inspector-unknown-jobid or nccl-inspector-<SLURM_JOBID> when running under SLURM.

NCCL_INSPECTOR_BURST_SLOWDOWN_THRESHOLD_MBPS

0

Burst slowdown detection threshold in MB/s. When burst bandwidth falls below this threshold, a burst_slowdown event is generated. 0 disables detection.

NCCL_INSPECTOR_BURST_BANDWIDTH_FLUSH_INTERVAL_MS

1000

How often burst bandwidth gauges are flushed to the exporter (ms). Values ≤ 0 use 1000; values below 10 clamp to 10.

NCCL_INSPECTOR_RESAMPLE_INTERVAL_MS

5000

Dynamic-flow resample interval (ms) for IB counters, LB variance gauges, and CLB weight heartbeats. Values ≤ 0 use 5000; values below 100 (but > 0) clamp to 100. CLB weights are also exported on each QP weight update.

NCCL_INSPECTOR_DTS_METRICS_FLUSH_INTERVAL_MS

1000

When DUMP_TYPE=dts, DOCA CollectX periodic metrics flush interval (ms), independent of the dump thread. Values ≤ 0 use 1000; values below 10 clamp to 10.

NCCL_INSPECTOR_DTS_OTLP_LOGS

0

When DUMP_TYPE=dts, enables OTLP log export for device/link/burst/async events. Set to 1 to enable. Without this, those events are not exported under DTS.

NCCL_INSPECTOR_ENABLE_OPTIONAL_LABELS

0

When DUMP_TYPE=dts, enables extra labels/attributes such as job_id on metrics and OTLP events.

NCCL_INSPECTOR_JOB_ID

(from SLURM_JOBID, else unknown)

Overrides the job ID used in exporter labels/metadata. Requires NCCL_INSPECTOR_ENABLE_OPTIONAL_LABELS=1

Metrics (DTS / Prometheus)

Name

Type

Description

nccl_coll_msg_size_total_bytes

Counter

Cumulative full logical collective message size in bytes.

nccl_per_rank_msg_size_total_bytes

Counter

Cumulative per-rank NCCL API message size in bytes (count * datatype_size).

nccl_coll_total_count

Counter

Cumulative count of completed collectives.

nccl_coll_duration_total_microseconds

Counter

Cumulative collective execution duration in microseconds.

nccl_burst_bandwidth_gbps

Gauge

Per-device burst bandwidth in Gbps (Exponential Moving Average).

nccl_cumulative_load_balancing_weight

Gauge

Cumulative load-balancing (CLB) weight per InfiniBand device.

nccl_load_balance_weight_asymmetry_variance_sum_total

Gauge

Cumulative LB weight-asymmetry variance sum per merged NIC group.

nccl_load_balance_weight_asymmetry_variance_count_total

Counter

Count of positive contributions to the LB weight-asymmetry variance sum.

nccl_ib_sender_failure_recovery_started_total

Counter

Sender-side failure recovery started.

nccl_ib_sender_failure_recovery_completed_total

Counter

Sender-side failure recovery completed successfully.

nccl_ib_sender_failure_recovery_timeout_total

Counter

Sender-side failure recovery timed out.

nccl_ib_sender_failure_recovery_error_limit_total

Counter

Sender-side failure recovery hit the error limit.

nccl_ib_receiver_failure_recovery_started_total

Counter

Receiver-side failure recovery started.

nccl_ib_receiver_failure_recovery_completed_total

Counter

Receiver-side failure recovery completed successfully.

nccl_ib_receiver_failure_recovery_timeout_total

Counter

Receiver-side failure recovery timed out.

nccl_ib_receiver_failure_recovery_error_limit_total

Counter

Receiver-side failure recovery hit the error limit.

nccl_ib_backup_device_activated_total

Counter

Backup InfiniBand device activated.

nccl_ib_backup_device_deactivated_total

Counter

Backup InfiniBand device deactivated.

nccl_ib_failed_due_to_persistent_bandwidth_loss_total

Counter

Device marked failed due to persistent bandwidth loss.

nccl_ib_qp_reached_minimum_allowed_bandwidth_total

Counter

QP reached the minimum allowed bandwidth.

Logs (DTS OTLP; requires NCCL_INSPECTOR_DTS_OTLP_LOGS=1)

Name

Severity

Description

burst_slowdown_event

WARN

Burst bandwidth fell below the configured threshold; includes device, current BW, threshold, and deficit.

link_error_event

ERROR

InfiniBand link/work-completion error; includes status, device, port, and cumulative error count.

device_fail_recover_event

ERROR (failure) / INFO (recovery)

Device failure or recovery; includes bandwidth delta, total bandwidth, and active device count.

async_thread_error_event

ERROR


 

 

Last updated: