-
Notifications
You must be signed in to change notification settings - Fork 8
Add NCCL backend #55
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
msimberg
wants to merge
52
commits into
ghex-org:main
Choose a base branch
from
msimberg:nccl-context
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
Add NCCL backend #55
Changes from 23 commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
ce31566
Add first dummy version of NCCL backend
msimberg a4b913d
Clean up some unnecessary nccl files and try to port more mpi functio…
msimberg e14eeb3
Add todos
msimberg 303ef54
Update nccl support
msimberg c01f1fe
Slightly more working nccl backend with events as requests and lots o…
msimberg 11564e1
Enable one more nccl test
msimberg aca250b
Remove TODOs
msimberg ac03aaa
Add is_stream_aware, start_group, end_group to all backends
msimberg 0331903
Clean up nccl event/request handling
msimberg 3a4b321
Remove debugging print
msimberg 325adf0
cleap
msimberg a724978
Clean up and disable some tests with NCCL
msimberg a13a3dd
Remove TODO
msimberg 0c452c0
Add missing cuda_event.hpp file
msimberg 162c745
Minor cleanup
msimberg 15670aa
More cleanup
msimberg c1f70d0
Add missing stream argument
msimberg 06d38ec
Add dummy stream parameter to libfabric and ucx backends
msimberg 9653b59
Remove TODO from FindNCCL.cmake
msimberg 3790aee
Remove TODO from test_locality.cpp
msimberg 6e1c866
Add event pool and cached cuda event helper
msimberg 9d38449
Remove duplicate key in clang-format config
msimberg 46e0cf8
Format nccl files
msimberg b3359b3
Update src/nccl/nccl_communicator.hpp
msimberg 4248180
Add missing FindNCCL.cmake for package install
msimberg 2fabf67
Explicitly link against CUDA::cudart with NCCL
msimberg 54fd8fe
Cleanup and check for device buffers with NCCL
msimberg b0a8228
Use plain throw to rethrow exception
msimberg 4d60913
Handle shared/static NCCL library better
msimberg d68f893
Use [[maybe_unused]] for unused stream arguments
msimberg 5ae81d4
Add helper to check if in active NCCL group
msimberg 0c98a0e
Disallowing calling progress/wait while in an active NCCL group
msimberg a5bfaa8
Remove todo
msimberg c831f5d
Update readme
msimberg 452074b
Add test for NCCL group semantics wrt wait/progress
msimberg 0761f70
Fix nccl progress/wait check
msimberg fc5a14f
Clean up test_send_recv
msimberg e616b9f
Remove TODO about multiple nccl plugin inits (fixed in newer versions)
msimberg 8cf11af
Remove extra parenthesis
msimberg 3f4dc08
Make get_transport_option const
msimberg 42f7163
Revert tag changes in test_send_multi
msimberg e41e726
Revert tag changes in test_locality.cpp
msimberg 84cc2f4
Fix another get_transport_option
msimberg 1dc6cfa
Remove old test
msimberg d3b6b96
Add notes about NCCL to readme
msimberg 2121de0
Update test_send_recv for NCCL
msimberg 6db091c
Remove device buffer check for NCCL communicator
msimberg edc6c32
Remove todo
msimberg 11c6c4b
Expand readme with more nccl info
msimberg ab051d8
Clean up nccl backend
msimberg dff4b8f
Add missing const
msimberg 2509800
Add missing find_dependency(NCCL) to oomphConfig.cmake.in
msimberg 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
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,72 @@ | ||
| # From https://github.com/pytorch/gloo/blob/main/cmake/Modules/Findnccl.cmake. | ||
|
|
||
| # Try to find NCCL | ||
| # | ||
| # The following variables are optionally searched for defaults | ||
| # NCCL_ROOT_DIR: Base directory where all NCCL components are found | ||
| # NCCL_INCLUDE_DIR: Directory where NCCL header is found | ||
| # NCCL_LIB_DIR: Directory where NCCL library is found | ||
| # | ||
| # The following are set after configuration is done: | ||
| # NCCL_FOUND | ||
| # NCCL_INCLUDE_DIRS | ||
| # NCCL_LIBRARIES | ||
| # | ||
| # The path hints include CUDA_TOOLKIT_ROOT_DIR seeing as some folks | ||
| # install NCCL in the same location as the CUDA toolkit. | ||
| # See https://github.com/caffe2/caffe2/issues/1601 | ||
|
|
||
| set(NCCL_ROOT_DIR $ENV{NCCL_ROOT_DIR} CACHE PATH "Folder contains NVIDIA NCCL") | ||
|
|
||
| find_path(NCCL_INCLUDE_DIR | ||
| NAMES nccl.h | ||
| HINTS | ||
| ${NCCL_INCLUDE_DIR} | ||
| ${NCCL_ROOT_DIR} | ||
| ${NCCL_ROOT_DIR}/include | ||
| ${CUDA_TOOLKIT_ROOT_DIR}/include) | ||
|
|
||
| if ($ENV{USE_STATIC_NCCL}) | ||
| message(STATUS "USE_STATIC_NCCL detected. Linking against static NCCL library") | ||
| set(NCCL_LIBNAME "libnccl_static.a") | ||
| else() | ||
| set(NCCL_LIBNAME "nccl") | ||
| endif() | ||
msimberg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| find_library(NCCL_LIBRARY | ||
| NAMES ${NCCL_LIBNAME} | ||
| HINTS | ||
| ${NCCL_LIB_DIR} | ||
| ${NCCL_ROOT_DIR} | ||
| ${NCCL_ROOT_DIR}/lib | ||
| ${NCCL_ROOT_DIR}/lib/x86_64-linux-gnu | ||
| ${NCCL_ROOT_DIR}/lib64 | ||
| ${CUDA_TOOLKIT_ROOT_DIR}/lib64) | ||
|
|
||
| include(FindPackageHandleStandardArgs) | ||
| find_package_handle_standard_args(NCCL DEFAULT_MSG NCCL_INCLUDE_DIR NCCL_LIBRARY) | ||
|
|
||
| if (NCCL_FOUND) | ||
| set(NCCL_HEADER_FILE "${NCCL_INCLUDE_DIR}/nccl.h") | ||
| message(STATUS "Determining NCCL version from the header file: ${NCCL_HEADER_FILE}") | ||
| file (STRINGS ${NCCL_HEADER_FILE} NCCL_MAJOR_VERSION_DEFINED | ||
| REGEX "^[ \t]*#define[ \t]+NCCL_MAJOR[ \t]+[0-9]+.*$" LIMIT_COUNT 1) | ||
| if (NCCL_MAJOR_VERSION_DEFINED) | ||
| string (REGEX REPLACE "^[ \t]*#define[ \t]+NCCL_MAJOR[ \t]+" "" | ||
| NCCL_MAJOR_VERSION ${NCCL_MAJOR_VERSION_DEFINED}) | ||
| message(STATUS "NCCL_MAJOR_VERSION: ${NCCL_MAJOR_VERSION}") | ||
| endif() | ||
| set(NCCL_INCLUDE_DIRS ${NCCL_INCLUDE_DIR}) | ||
| set(NCCL_LIBRARIES ${NCCL_LIBRARY}) | ||
| message(STATUS "Found NCCL (include: ${NCCL_INCLUDE_DIRS}, library: ${NCCL_LIBRARIES})") | ||
| mark_as_advanced(NCCL_ROOT_DIR NCCL_INCLUDE_DIRS NCCL_LIBRARIES) | ||
|
|
||
| if(NOT TARGET NCCL::nccl AND NCCL_FOUND) | ||
| add_library(NCCL::nccl SHARED IMPORTED) | ||
| set_target_properties(NCCL::nccl PROPERTIES | ||
| IMPORTED_LOCATION ${NCCL_LIBRARIES} | ||
| INTERFACE_INCLUDE_DIRECTORIES ${NCCL_INCLUDE_DIRS} | ||
| ) | ||
msimberg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| endif() | ||
| endif() | ||
|
|
||
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,18 @@ | ||
| # set all NCCL related options and values | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
| # Enable NCCL support | ||
| #------------------------------------------------------------------------------ | ||
| set(OOMPH_WITH_NCCL OFF CACHE BOOL "Build with NCCL backend") | ||
|
|
||
| if (OOMPH_WITH_NCCL) | ||
| find_package(NCCL REQUIRED) | ||
| add_library(oomph_nccl SHARED) | ||
| add_library(oomph::nccl ALIAS oomph_nccl) | ||
| oomph_shared_lib_options(oomph_nccl) | ||
| target_link_libraries(oomph_nccl PUBLIC NCCL::nccl) | ||
| install(TARGETS oomph_nccl | ||
| EXPORT oomph-targets | ||
| LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
| endif() |
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.
I opened #58 for this.