CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
NCCL User Buffer Registration Examples
Overview
This directory contains minimal examples that demonstrate NCCL user buffer registration for improving performance by allowing NCCL to operate directly on user-allocated buffers.
Examples
01_allreduce
AllReduce with User Buffer Registration
- Pattern: Register communication buffers once and reuse across operations
- API:
ncclCommRegister,ncclCommDeregister,ncclMemAlloc,ncclAllReduce - Use case: Repeated collectives on the same buffers; performance-critical workloads
- Key features:
- Buffers allocated via
ncclMemAllocfor registration compatibility - Registration handles managed explicitly (register → use → deregister)
- Collective operations executed on registered buffers
- Correct cleanup and verification
- Buffers allocated via
Choosing the Right Pattern
Scenario : Optimize performance for repeated collectives on same buffers Addresses : Throughput-sensitive training loops Dependencies : pthread or MPI
Why Buffer Registration?
Pre-registering buffers eliminates per-call registration overhead and enables direct access. It can accelerate collectives and greatly reduce the resource usage (e.g. #channel usage). Also, this is a prerequisite for advanced features such as symmetric memory or device API calls.
// Allocate using NCCL convenience function and register buffers
NCCLCHECK(ncclMemAlloc((void**)&d_send, size_bytes));
NCCLCHECK(ncclCommRegister(comm, d_send, size_bytes, &send_handle));
// Use in collectives
NCCLCHECK(ncclAllReduce(d_send, d_recv, count, ncclFloat, ncclSum, comm, stream));
// Deregister and free
NCCLCHECK(ncclCommDeregister(comm, send_handle));
NCCLCHECK(ncclMemFree(d_send));
Building
Quick Start
# Build example by directory name
make 01_allreduce
Individual Examples
# Build and run AllReduce with user buffer registration
cd 01_allreduce && make
./allreduce_ub