How rocm/rccl works
Main Components
• Core Library – Represent the central “RCCL Engine”, which provides the collective operations. This includes:
• The API and header files (found in src/include) that define the NCCL-like interface.
• Core implementation files in the src folder (e.g., bootstrap.cc, channel.cc, collectives.cc, graph-related files, etc.).
• Device and Kernel Layer – Highlight the modules that manage GPU-level operations:
• src/device: kernels, CUDA/C++ code for all the collective primitives, and device-specific optimizations.
• Communication/Transport Layer – Capture the networking and inter-node communication aspects:
• src/transport: multiple implementations such as net.cc, net_ib.cc, net_socket.cc, and p2p communication.
• Components handling low-level interconnects (InfiniBand, TCP sockets, etc.).
• Files in src/graph (e.g., rings, trees, and topology discovery routines) that compute the optimal collective communication pattern.
• External Modules – Represent the optionally integrated modules that can extend or tune the library:
• ext-net and ext-tuner directories provide examples and plugins for networking and tuning, respectively.
• CMakeLists.txt, Makefile, cmake scripts, and packaging directories (pkg, makefiles) indicate a carefully layered build process.
• CI/CD configuration folders (.azuredevops, .github, .jenkins) show automated testing and integration.
• The test directory for unit tests (using Googletest) and multiple tools in the tools folder for benchmarking, timing, topology visualization, and diagnostics.
• Documentation – A separate block for docs, showcasing that the project also maintains comprehensive user and API documentation (docs, .readthedocs.yaml, Sphinx requirements).
Relationships & Data Flow
• User-level Application ↔ RCCL Library API: Indicate that external applications or MPI frameworks call into the RCCL API, which is defined in the include files.
• Core Operations Flow: Show that when a collective call is made, the RCCL Engine uses its graph algorithms to choose the routes (rings, trees) and then dispatches work to the device layer (kernel launches) and transport layer.
• Build/CI/Packaging: Illustrate that the build system (CMake, Makefile, etc.) ties everything together and that CI systems validate the integration and performance via tests and tools.
• External Plugins/Extensions: Demonstrate how ext-net and ext-tuner can plug into the core system, perhaps enhancing functionalities without disturbing the main architecture.
Architectural Patterns & Design Principles
• Modular Separation: Emphasize the separation of concerns (API, algorithm, device handling, transport, testing).
• Layered Architecture: Show that higher-level collective function calls are abstracted from low-level device or kernel implementations.
• Extensibility: Illustrate extension points by highlighting directories and plugins (ext-net, ext-tuner, external dependencies via CMake).
• CI/CD Integration: Note the robust integration of multiple CI systems (Azure, GitHub, Jenkins) to support continuous testing.