Install any skill in seconds. Free to start, no credit card required.
Get Started Free →NVIDIA Collective Communications Library integration for multi-GPU operations. Initialize NCCL communicators, execute collective operations, configure communication topologies, profile collective performance, and support RCCL for AMD compatibility.
.claude/skills/a5c-ai-nccl-communication/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 166% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 147% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 126% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 100% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 54% | 0% |
You are nccl-communication - a specialized skill for NVIDIA Collective Communications Library (NCCL) integration. This skill provides expert capabilities for multi-GPU collective operations.
This skill enables AI-powered multi-GPU communication including:
Initialize communicators:
c#include <nccl.h> // Single-node multi-GPU initialization int numGPUs = 4; ncclComm_t comms[4]; int devs[4] = {0, 1, 2, 3}; ncclCommInitAll(comms, numGPUs, devs); // Per-rank initialization for MPI integration ncclUniqueId id; ncclComm_t comm; if (rank == 0) { ncclGetUniqueId(&id); } MPI_Bcast(&id, sizeof(id), MPI_BYTE, 0, MPI_COMM_WORLD); cudaSetDevice(localRank); ncclCommInitRank(&comm, worldSize, id, rank); // Cleanup ncclCommDestroy(comm);
Reduce across all GPUs:
c// Synchronous all-reduce ncclAllReduce(sendbuff, recvbuff, count, ncclFloat, ncclSum, comm, stream); cudaStreamSynchronize(stream); // In-place all-reduce ncclAllReduce(buff, buff, count, ncclFloat, ncclSum, comm, stream); // Supported reduction operations: // ncclSum, ncclProd, ncclMax, ncclMin, ncclAvg // Multiple data types: // ncclInt8, ncclUint8, ncclInt32, ncclUint32, ncclInt64, ncclUint64 // ncclFloat16, ncclFloat32, ncclFloat64, ncclBfloat16
Gather data from all GPUs:
c// All-gather: each GPU contributes sendcount elements // Result: recvbuff has numGPUs * sendcount elements per GPU ncclAllGather(sendbuff, recvbuff, sendcount, ncclFloat, comm, stream); // Verify output size size_t totalElements = sendcount * numGPUs;
c// Reduce-scatter: reduces and scatters to each GPU // Each GPU gets 1/numGPUs of the reduced result ncclReduceScatter(sendbuff, recvbuff, recvcount, ncclFloat, ncclSum, comm, stream); // Useful for gradient reduction in data parallelism
c// Broadcast from root to all int root = 0; ncclBroadcast(sendbuff, recvbuff, count, ncclFloat, root, comm, stream); // In-place broadcast ncclBroadcast(buff, buff, count, ncclFloat, root, comm, stream); // Reduce to root ncclReduce(sendbuff, recvbuff, count, ncclFloat, ncclSum, root, comm, stream);
Batch multiple operations:
c// Start group ncclGroupStart(); // Queue multiple operations ncclAllReduce(buff1, buff1, count1, ncclFloat, ncclSum, comm, stream); ncclAllReduce(buff2, buff2, count2, ncclFloat, ncclSum, comm, stream); ncclBroadcast(buff3, buff3, count3, ncclFloat, 0, comm, stream); // End group - operations execute efficiently ncclGroupEnd(); // Useful for: // - Multiple collectives in single launch // - Send/Recv pairs for point-to-point
c// Send from rank 0 to rank 1 if (rank == 0) { ncclSend(sendbuff, count, ncclFloat, 1, comm, stream); } else if (rank == 1) { ncclRecv(recvbuff, count, ncclFloat, 0, comm, stream); } // Bidirectional exchange using groups ncclGroupStart(); ncclSend(sendbuff, count, ncclFloat, peerRank, comm, stream); ncclRecv(recvbuff, count, ncclFloat, peerRank, comm, stream); ncclGroupEnd();
Configure for hardware topology:
bash# Check GPU topology nvidia-smi topo -m # Environment variables for optimization export NCCL_TOPO_FILE=/path/to/topo.xml export NCCL_GRAPH_FILE=/path/to/graph.xml # Algorithm selection export NCCL_ALGO=Tree # Tree reduction export NCCL_ALGO=Ring # Ring reduction export NCCL_ALGO=CollnetDirect # NVSwitch direct # Protocol selection export NCCL_PROTO=Simple # Default export NCCL_PROTO=LL # Low-latency export NCCL_PROTO=LL128 # Low-latency 128-byte # Network settings export NCCL_IB_DISABLE=0 # Enable InfiniBand export NCCL_NET_GDR_LEVEL=5 # GPU Direct RDMA level
c// Multi-node with MPI #include <mpi.h> #include <nccl.h> int main(int argc, char* argv[]) { MPI_Init(&argc, &argv); int worldSize, rank; MPI_Comm_size(MPI_COMM_WORLD, &worldSize); MPI_Comm_rank(MPI_COMM_WORLD, &rank); // Get local rank for GPU assignment int localRank; MPI_Comm localComm; MPI_Comm_split_type(MPI_COMM_WORLD, MPI_COMM_TYPE_SHARED, rank, MPI_INFO_NULL, &localComm); MPI_Comm_rank(localComm, &localRank); // Initialize NCCL ncclUniqueId id; if (rank == 0) ncclGetUniqueId(&id); MPI_Bcast(&id, sizeof(id), MPI_BYTE, 0, MPI_COMM_WORLD); cudaSetDevice(localRank); ncclComm_t comm; ncclCommInitRank(&comm, worldSize, id, rank); // Use comm for collectives... ncclCommDestroy(comm); MPI_Finalize(); return 0; }
c// NCCL timing with CUDA events cudaEvent_t start, stop; cudaEventCreate(&start); cudaEventCreate(&stop); cudaEventRecord(start, stream); ncclAllReduce(buff, buff, count, ncclFloat, ncclSum, comm, stream); cudaEventRecord(stop, stream); cudaEventSynchronize(stop); float milliseconds; cudaEventElapsedTime(&milliseconds, start, stop); // Calculate bandwidth size_t bytes = count * sizeof(float); float algoBW = bytes / milliseconds / 1e6; // GB/s float busBW = algoBW * 2 * (numGPUs - 1) / numGPUs; // Bus bandwidth printf("AllReduce: %.2f ms, %.2f GB/s (bus: %.2f GB/s)\n", milliseconds, algoBW, busBW);
bash# Enable NCCL debug output export NCCL_DEBUG=INFO export NCCL_DEBUG_SUBSYS=ALL # NCCL tests for benchmarking ./build/all_reduce_perf -b 8 -e 256M -f 2 -g 4
This skill integrates with the following processes:
multi-gpu-programming.js - Multi-GPU developmentgpu-cluster-computing.js - Cluster computingjson{ "operation": "all-reduce", "status": "success", "configuration": { "num_gpus": 4, "data_size_bytes": 268435456, "data_type": "float32", "reduction": "sum" }, "performance": { "time_ms": 2.34, "algorithm_bandwidth_gbps": 114.5, "bus_bandwidth_gbps": 171.8 }, "topology": { "interconnect": "NVLink", "algorithm": "Tree", "protocol": "LL128" } }
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 6,869 | 14,637 | +113% | 1 | 1 | 0% | 1,435 | 3,819 | +166% | 0 | 0 | — |
case-02 | fail→pass | 9,789 | 18,646 | +90% | 1 | 1 | 0% | 2,132 | 5,262 | +147% | 0 | 0 | — |
case-03 | fail→pass | 9,529 | 5,858 | -39% | 1 | 1 | 0% | 1,525 | 3,444 | +126% | 0 | 0 | — |
case-04 | pass→pass | 11,428 | 9,037 | -21% | 1 | 1 | 0% | 2,302 | 3,534 | +54% | 0 | 0 | — |
case-05 | pass→pass | 8,329 | 6,973 | -16% | 1 | 1 | 0% | 1,135 | 3,219 | +184% | 0 | 0 | — |
case-06 | pass→pass | 10,010 | 11,067 | +11% | 1 | 1 | 0% | 1,445 | 4,225 | +192% | 0 | 0 | — |
case-07 | pass→pass | 4,274 | 6,199 | +45% | 1 | 1 | 0% | 588 | 3,042 | +417% | 0 | 0 | — |
case-08 | pass→pass | 8,904 | 6,765 | -24% | 1 | 1 | 0% | 1,769 | 3,580 | +102% | 0 | 0 | — |
case-09 | pass→pass | 6,695 | 8,133 | +21% | 1 | 1 | 0% | 956 | 3,336 | +249% | 0 | 0 | — |
case-10 | pass→pass | 9,452 | 7,312 | -23% | 1 | 1 | 0% | 1,423 | 3,608 | +154% | 0 | 0 | — |
case-11 | pass→pass | 10,802 | 11,566 | +7% | 1 | 1 | 0% | 1,546 | 3,797 | +146% | 0 | 0 | — |
case-12 | pass→pass | 9,833 | 6,914 | -30% | 1 | 1 | 0% | 1,535 | 3,594 | +134% | 0 | 0 | — |
case-13 | pass→pass | 4,138 | 4,048 | -2% | 1 | 1 | 0% | 781 | 2,789 | +257% | 0 | 0 | — |
case-14 | pass→pass | 7,412 | 3,589 | -52% | 1 | 1 | 0% | 1,109 | 2,873 | +159% | 0 | 0 | — |
case-15 | pass→pass | 4,629 | 4,663 | +1% | 1 | 1 | 0% | 621 | 2,859 | +360% | 0 | 0 | — |
case-16 | pass→pass | 6,259 | 3,023 | -52% | 1 | 1 | 0% | 938 | 2,813 | +200% | 0 | 0 | — |
case-17 | fail→pass | 9,668 | 9,170 | -5% | 1 | 1 | 0% | 1,743 | 3,486 | +100% | 0 | 0 | — |
case-18 | pass→pass | 9,022 | 5,057 | -44% | 1 | 1 | 0% | 1,678 | 3,109 | +85% | 0 | 0 | — |
case-19 | pass→pass | 8,404 | 9,048 | +8% | 1 | 1 | 0% | 1,451 | 3,592 | +148% | 0 | 0 | — |
case-20 | pass→pass | 4,640 | 5,762 | +24% | 1 | 1 | 0% | 827 | 2,960 | +258% | 0 | 0 | — |
case-21 | pass→pass | 7,744 | 4,975 | -36% | 1 | 1 | 0% | 1,085 | 2,882 | +166% | 0 | 0 | — |
case-22 | pass→pass | 17,935 | 19,925 | +11% | 1 | 1 | 0% | 3,892 | 6,569 | +69% | 0 | 0 | — |
case-23 | pass→pass | 11,198 | 13,539 | +21% | 1 | 1 | 0% | 1,677 | 4,337 | +159% | 0 | 0 | — |
case-24 | pass→pass | 7,571 | 8,786 | +16% | 1 | 1 | 0% | 1,779 | 4,124 | +132% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted. The headline lift of +17 percentage points is the difference between those two pass rates over the 24 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.