Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about algorithms used for all-gathers and reduce-scatters #1594

Open
siddharth9820 opened this issue Feb 5, 2025 · 4 comments
Open

Comments

@siddharth9820
Copy link

siddharth9820 commented Feb 5, 2025

algos_of_coll = {
"AllGather": ["RING","COLLNET_DIRECT","NVLS","PAT"],
"AllReduce": ["TREE","RING","COLLNET_DIRECT","COLLNET_CHAIN","NVLS","NVLS_TREE"],
"Broadcast": ["RING"],
"Reduce": ["RING"],
"ReduceScatter": ["RING","COLLNET_DIRECT","NVLS","PAT"],
"SendRecv": [None]
}

Based on these lines of code, I can see that all-gathers and reduce-scatters can employ RING, COLLNET_DIRECT, NVLS, and PAT. I am working on the Perlmutter supercomputer (https://docs.nersc.gov/systems/perlmutter/architecture/) which has HPE's slingshot interconnect. Would that mean that our of these four options only RING is applicable for all-gathers/reduce-scatters since the other three depend on having Infiniband and Nvswitches?

@kiskra-nvidia
Copy link
Member

CollNet and NVLS are out for sure. I think PAT could be an option though?

You can verify which algorithm NCCL chooses for every collective by running with NCCL_DEBUG=INFO NCCL_DEBUG_SUBSYS=COLL,TUNING -- rank 0 will print the algo/proto combination.

@siddharth9820
Copy link
Author

Thank you so much! Follow up question - what does PAT do? And how should I model it's latency and message transmission times. For example I know that the latency of ring algorithm is O(G) and transmission time is O( [G-1]/G * N), where G is the number of GPUs and N is the size of the output buffer (for all gather)

@bhatele
Copy link

bhatele commented Feb 5, 2025

Also, if there are two available options, how does NCCL choose which one to actually use?

@kiskra-nvidia
Copy link
Member

PAT is a binomial tree algorithm. There's a bit of info here: https://developer.nvidia.com/blog/new-scaling-algorithm-and-initialization-with-nvidia-collective-communications-library-2-23/#pat_logarithmic_scaling_for_reducescatter_and_allgather%C2%A0

NCCL has an internal performance model for each algorithm and for each collective operation picks the algorithm/protocol combo that it expects to perform best under the circumstances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants