-
Notifications
You must be signed in to change notification settings - Fork 957
[TransferEngine] Add NCCL host and device transport backend #2852
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
Open
akhillanger
wants to merge
7
commits into
kvcache-ai:main
Choose a base branch
from
akhillanger:alanger/pr/te_nccl_host_transport
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7044a12
[TE] Add NCCL DeviceTransport backend
0e337b7
[TE] Make NCCL DeviceTransport backend-neutral
15184ed
Add NCCL host backend
akhillanger 9f3cdfb
Fix NCCL host transport failure paths
akhillanger 73cea44
Optimize NCCL device helper hot path
akhillanger b005c2e
Format NCCL transport changes
akhillanger 19d9086
Preserve dynamic P2P ports for bare hosts
akhillanger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| # Locate NCCL 2.30.4+ with the experimental Device API. | ||
| # | ||
| # Prefer NCCL's exported package so version metadata, include paths, library | ||
| # variants, CUDA, and thread dependencies come from NCCL itself. Keep a manual | ||
| # fallback for tarball and pre-package installations. | ||
|
|
||
| set(_NCCL_DEVICE_MIN_VERSION "2.30.4") | ||
| set(_NCCL_DEVICE_USING_CONFIG FALSE) | ||
|
|
||
| find_package(NCCL ${_NCCL_DEVICE_MIN_VERSION} CONFIG QUIET) | ||
| if(NCCL_FOUND AND TARGET NCCL::nccl) | ||
| set(_NCCL_DEVICE_USING_CONFIG TRUE) | ||
| set(NCCLDevice_VERSION "${NCCL_VERSION}") | ||
| find_path(NCCL_DEVICE_INCLUDE_DIR | ||
| NAMES nccl_device.h | ||
| HINTS ${NCCL_INCLUDE_DIRS} | ||
| NO_DEFAULT_PATH) | ||
| endif() | ||
|
|
||
| if(NOT _NCCL_DEVICE_USING_CONFIG) | ||
| find_path(NCCL_DEVICE_INCLUDE_DIR | ||
| NAMES nccl_device.h | ||
| HINTS | ||
| ${NCCL_ROOT} | ||
| $ENV{NCCL_ROOT} | ||
| $ENV{NCCL_HOME} | ||
| PATH_SUFFIXES include build/include | ||
| PATHS | ||
| /usr/local/cuda | ||
| /usr/local | ||
| /usr) | ||
|
|
||
| find_library(NCCL_DEVICE_LIBRARY | ||
| NAMES nccl | ||
| HINTS | ||
| ${NCCL_ROOT} | ||
| $ENV{NCCL_ROOT} | ||
| $ENV{NCCL_HOME} | ||
| PATH_SUFFIXES lib lib64 build/lib build/lib64 | ||
| PATHS | ||
| /usr/local/cuda | ||
| /usr/local | ||
| /usr) | ||
|
|
||
| if(NCCL_DEVICE_INCLUDE_DIR AND | ||
| EXISTS "${NCCL_DEVICE_INCLUDE_DIR}/nccl.h") | ||
| foreach(_component MAJOR MINOR PATCH) | ||
| file(STRINGS "${NCCL_DEVICE_INCLUDE_DIR}/nccl.h" | ||
| _nccl_${_component}_line | ||
| REGEX "^#define NCCL_${_component}[ \t]+[0-9]+" | ||
| LIMIT_COUNT 1) | ||
| string(REGEX MATCH "[0-9]+$" _nccl_${_component} | ||
| "${_nccl_${_component}_line}") | ||
| endforeach() | ||
| if(_nccl_MAJOR AND _nccl_MINOR AND _nccl_PATCH) | ||
| set(NCCLDevice_VERSION | ||
| "${_nccl_MAJOR}.${_nccl_MINOR}.${_nccl_PATCH}") | ||
| endif() | ||
| endif() | ||
| endif() | ||
|
|
||
| include(FindPackageHandleStandardArgs) | ||
| if(_NCCL_DEVICE_USING_CONFIG) | ||
| find_package_handle_standard_args(NCCLDevice | ||
| REQUIRED_VARS NCCL_DEVICE_INCLUDE_DIR | ||
| VERSION_VAR NCCLDevice_VERSION) | ||
| else() | ||
| find_package_handle_standard_args(NCCLDevice | ||
| REQUIRED_VARS NCCL_DEVICE_INCLUDE_DIR NCCL_DEVICE_LIBRARY | ||
| VERSION_VAR NCCLDevice_VERSION) | ||
| endif() | ||
|
|
||
| if(NCCLDevice_FOUND) | ||
| find_package(CUDAToolkit REQUIRED) | ||
|
|
||
| if(NOT TARGET NCCL::nccl) | ||
| add_library(NCCL::nccl UNKNOWN IMPORTED) | ||
| set_target_properties(NCCL::nccl PROPERTIES | ||
| IMPORTED_LOCATION "${NCCL_DEVICE_LIBRARY}" | ||
| INTERFACE_INCLUDE_DIRECTORIES "${NCCL_DEVICE_INCLUDE_DIR}" | ||
| INTERFACE_LINK_LIBRARIES "CUDA::cudart") | ||
| endif() | ||
|
|
||
| set_property(TARGET NCCL::nccl APPEND PROPERTY | ||
| INTERFACE_COMPILE_DEFINITIONS | ||
| NCCL_DEVICE_PERMIT_EXPERIMENTAL_CODE=1) | ||
| endif() | ||
|
|
||
| mark_as_advanced(NCCL_DEVICE_INCLUDE_DIR NCCL_DEVICE_LIBRARY) | ||
| unset(_NCCL_DEVICE_MIN_VERSION) | ||
| unset(_NCCL_DEVICE_USING_CONFIG) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have two options here, but I only see
USE_NCCL_DEVICEin thebuild.mddoc.