deepspeedai / deepspeedai/DeepSpeed

why use for all-reduce when `contiguous_gradients` is False?

Open
#1,300 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
43.1k
Forks
5k
Avg merge
4d 15h
Merged PRs (30d)
112

Description

Hi there,

On single node with 8A100 GPUs connected with nvlinks, I can still observe the performance benefits with contiguous_gradients set to False. e.g., 10B model backward time: ~1329.30ms vs ~ 1593.24ms (contiguous_gradients=False vs. contiguous_gradients=True).

I am wondering where is the benefits coming from. The all-reduce suppose to incur more communication overheads than reduce-scatter operation.

Could please explain a littile bit about why use all-reduce for each gradient tensor? (I not completely sure that zero3 will do all-reduce for all gradient tensors. But base on the code path at here, I guess so)
https://github.com/microsoft/DeepSpeed/blob/master/deepspeed/runtime/zero/stage3.py#L2314

And what could be the overheads introduced with setting contiguous_gradients=True?

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at deepspeed/runtime/zero/stage3.py around line 2314 and trace the gradient communication path for both contiguous_gradients settings. Compare the all-reduce and reduce-scatter behavior and identify the overheads of contiguous gradient buffers. Done means documenting a clear explanation grounded in that code path and the reported timings.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems, machine-learning, performance
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.