NVIDIA / NVIDIA/Megatron-LM

[QUESTION] How to overlap comms and computation with `--overlap-grad-reduce` & `--overlap-param-gather`?

Open
#1,468 4 comments 0 reactions 1 assignee Claimed by @erhoo82 View on GitHub
bug
Dominant language
Python
Stars
17.9k
Forks
4.5k
Avg merge
4d 6h
Merged PRs (30d)
271

Description

Hello Megatron team,

Visualising a trace setting `--overlap-grad-reduce` & `--overlap-param-gather` I observed that we aren't overlapping anything when setting those flags. Im running a 8B model with TP = 1, PP = 1, CP = 1 & DP = 64.

Image

But, when I unset `CUDA_DEVICE_MAX_CONNECTIONS` (In the first image it was set to 1), I can clearly see that we are overlapping comms and computations

Image

Image

In [arguments.py](https://github.com/NVIDIA/Megatron-LM/blob/832f1d2915e2e56a0d81e02ad249f5c55a6210b8/megatron/training/arguments.py#L687-L690) we are checking that `CUDA_DEVICE_MAX_CONNECTIONS` as it's a requirement for TP & CP, but shouldn't we check/warn that when setting TP/CP > 1 the overlap features are useless? I think It would be a good idea to check and document this behaviour with `CUDA_DEVICE_MAX_CONNECTIONS` so users can leverage this great optimisations!

I could document this behaviour myself through a PR.

Toni

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.