Skip to content

[C/PyTorch] Removed MPI dependence in Userbuffers - #901

Merged
denera merged 11 commits into
NVIDIA:mainfrom
denera:remove-mpi-from-userbuffers
Jun 13, 2024
Merged

denera merged 11 commits into
NVIDIA:mainfrom
denera:remove-mpi-from-userbuffers

Conversation

@denera

@denera denera commented Jun 10, 2024 •

Copy link
Copy Markdown
Collaborator

Description

This PR splits off the userbuffers MPI-dependence removal from PR #760.

With these changes, userbuffers is now bootstrapped via callbacks to torch.distributed collectives. In the absence of the MPI dependence, userbuffers is always compiled as part of the PyTorch extension and no longer requires the NVTE_WITH_USERBUFFERS=1 flag.

The old MPI-based bootstrapping can be re-activated via UB_MPI_BOOTSTRAP=1 at compile time.

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Changes

  • TE build no longer supports the NVTE_WITH_USERBUFFERS=1 option and Userbuffers is now always compiled into the PyTorch extensions module.
  • MPI collectives in Userbuffers bootstrapping are replaced with callbacks to torch.distributed collectives.
  • New UB_MPI_BOOTSTRAP=1 option in the TE build activates the old Userbuffers bootstrapping via MPI collectives.
  • transformer_engine.pytorch.module.base.initialize_ub(...) is now more conveniently accessible via transformer_engine.pytorch.initialize_ub(...).
  • Userbuffer communicators can now be cleaned up via transformer_engine.pytorch.destroy_ub(...).
  • transformer_engine.pytorch.initialize_ub(...) now requires the tensor-parallel process group instead of just the tensor-parallel size.
  • Added comm+GEMM overlap example with te.LayerNormMLP.

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

denera added 3 commits June 10, 2024 07:23
…s is now always compiled

Signed-off-by: Alp Dener <adener@nvidia.com>
Signed-off-by: Alp Dener <adener@nvidia.com>
@denera
denera requested review from ksivaman, ptrendx and timmoon10 June 10, 2024 16:02
@denera denera self-assigned this Jun 10, 2024
@timmoon10
timmoon10 self-requested a review June 10, 2024 21:11
denera added 2 commits June 11, 2024 14:00
Signed-off-by: Alp Dener <adener@nvidia.com>
Signed-off-by: Alp Dener <adener@nvidia.com>
@denera
denera force-pushed the remove-mpi-from-userbuffers branch from 40ca7e6 to 6dee146 Compare June 12, 2024 00:13

@timmoon10 timmoon10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@timmoon10

Copy link
Copy Markdown
Member

/te-ci pytorch

denera added 2 commits June 12, 2024 18:30
…formerEngine into remove-mpi-from-userbuffers
Signed-off-by: Alp Dener <adener@nvidia.com>
@timmoon10

Copy link
Copy Markdown
Member

/te-ci pytorch

Comment thread build_tools/pytorch.py Resolved
Comment thread transformer_engine/CMakeLists.txt Resolved
Signed-off-by: Alp Dener <adener@nvidia.com>
denera added 2 commits June 13, 2024 01:20
Signed-off-by: Alp Dener <adener@nvidia.com>
…ompile into transformer_engine/common/CmakeLists.txt

Signed-off-by: Alp Dener <adener@nvidia.com>
@denera
denera requested a review from ksivaman June 13, 2024 14:29

@ksivaman ksivaman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@denera
denera merged commit e706e5f into NVIDIA:main Jun 13, 2024
denera added a commit to denera/TransformerEngine that referenced this pull request Jul 20, 2024
This reverts commit e706e5f.

Signed-off-by: Alp Dener <adener@nvidia.com>
@timmoon10 timmoon10 mentioned this pull request Feb 18, 2025
1 of 6 tasks
xiaoteng-cui-mt pushed a commit to MooreThreads/MT-TransformerEngine that referenced this pull request Oct 9, 2026
* added DL framework callbacks for bootstrapping userbuffers without MPI

Signed-off-by: Alp Dener <adener@nvidia.com>

* removed userbuffers availability check in TE modules since userbuffers is now always compiled

Signed-off-by: Alp Dener <adener@nvidia.com>

* added comm+GEMM overlap example with LayerNormMLP

Signed-off-by: Alp Dener <adener@nvidia.com>

* lintin and review fixes

Signed-off-by: Alp Dener <adener@nvidia.com>

* linting and review fixes

Signed-off-by: Alp Dener <adener@nvidia.com>

* added header guards

Signed-off-by: Alp Dener <adener@nvidia.com>

* removed defunct userbuffers checks in build_utils and setup.py

Signed-off-by: Alp Dener <adener@nvidia.com>

* added exposed API in modules/base.py to __all__

Signed-off-by: Alp Dener <adener@nvidia.com>

* removed transformer_engine/CMakeLists.txt and shifted all TE/common compile into transformer_engine/common/CmakeLists.txt

Signed-off-by: Alp Dener <adener@nvidia.com>

---------

Signed-off-by: Alp Dener <adener@nvidia.com>
Co-authored-by: Tim Moon <4406448+timmoon10@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

3 participants