HCCL provides code samples of using communication library APIs to implement collective communication in different scenarios. You can reference the code samples as required.
Communicator Management
Each process manages an NPU. (The communicator is initialized based on root rank information.)
Each process manages an NPU. (The communicator is initialized based on the rank table.)