Repository navigation
Let a device conduit move large host chunks, publish endpoint capabilities #8242
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
base: master
Are you sure you want to change the base?
Changes from all commits
366b376
237714c
c58ee85
9f48f31
8695b62
f4e82ae
0ff67c8
a0245c0
398d284
2484524
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # Copyright (c) 2026 Hartmut Kaiser | ||
| # | ||
| # SPDX-License-Identifier: BSL-1.0 | ||
| # Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
| # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
|
||
| # Find NVIDIA's NCCL library. Hints: NCCL_ROOT, NCCL_DIR, the environment | ||
| # variables NCCL_ROOT and NCCL_HOME, and the CUDA toolkit directory. Sets | ||
| # NCCL_FOUND, NCCL_VERSION (from nccl.h), NCCL_INCLUDE_DIR, NCCL_LIBRARY and | ||
| # defines the imported target NCCL::nccl. | ||
|
|
||
| if(NOT TARGET NCCL::nccl) | ||
|
|
||
| find_path( | ||
| NCCL_INCLUDE_DIR nccl.h | ||
| HINTS ${NCCL_ROOT} | ||
| ${NCCL_DIR} | ||
| ENV | ||
| NCCL_ROOT | ||
| ENV | ||
| NCCL_HOME | ||
| ${CUDAToolkit_INCLUDE_DIRS} | ||
| PATH_SUFFIXES include | ||
| ) | ||
|
|
||
| find_library( | ||
| NCCL_LIBRARY | ||
| NAMES nccl | ||
| HINTS ${NCCL_ROOT} | ||
| ${NCCL_DIR} | ||
| ENV | ||
| NCCL_ROOT | ||
| ENV | ||
| NCCL_HOME | ||
| ${CUDAToolkit_LIBRARY_DIR} | ||
| PATH_SUFFIXES lib lib64 | ||
| ) | ||
|
|
||
| if(NCCL_INCLUDE_DIR AND EXISTS "${NCCL_INCLUDE_DIR}/nccl.h") | ||
| file(STRINGS "${NCCL_INCLUDE_DIR}/nccl.h" _nccl_version_lines | ||
| REGEX "#define NCCL_(MAJOR|MINOR|PATCH)[ \t]+[0-9]+" | ||
| ) | ||
| foreach(_part MAJOR MINOR PATCH) | ||
| string(REGEX MATCH "NCCL_${_part}[ \t]+([0-9]+)" _match | ||
| "${_nccl_version_lines}" | ||
| ) | ||
| set(NCCL_VERSION_${_part} "${CMAKE_MATCH_1}") | ||
| endforeach() | ||
| set(NCCL_VERSION | ||
| "${NCCL_VERSION_MAJOR}.${NCCL_VERSION_MINOR}.${NCCL_VERSION_PATCH}" | ||
| ) | ||
| unset(_nccl_version_lines) | ||
| unset(_match) | ||
| endif() | ||
|
|
||
| include(FindPackageHandleStandardArgs) | ||
| find_package_handle_standard_args( | ||
| NCCL | ||
| REQUIRED_VARS NCCL_LIBRARY NCCL_INCLUDE_DIR | ||
| VERSION_VAR NCCL_VERSION | ||
| ) | ||
|
|
||
| if(NCCL_FOUND) | ||
| add_library(NCCL::nccl INTERFACE IMPORTED GLOBAL) | ||
| target_include_directories(NCCL::nccl SYSTEM INTERFACE ${NCCL_INCLUDE_DIR}) | ||
| target_link_libraries(NCCL::nccl INTERFACE ${NCCL_LIBRARY}) | ||
| endif() | ||
|
|
||
| mark_as_advanced(NCCL_INCLUDE_DIR NCCL_LIBRARY) | ||
|
|
||
| endif() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # Copyright (c) 2026 Hartmut Kaiser | ||
| # | ||
| # SPDX-License-Identifier: BSL-1.0 | ||
| # Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
| # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
|
||
| include(HPX_Message) | ||
|
|
||
| # Finds the library of the NCCL device conduit: NCCL with CUDA, RCCL (the same | ||
| # API) with HIP, and defines HPX::nccl for it. Non-blocking communicators and | ||
| # ncclGetLastError need NCCL 2.14 or newer (RCCL of ROCm 5.4 or newer). | ||
| macro(hpx_setup_nccl) | ||
| if(NOT TARGET HPX::nccl) | ||
| if(HPX_WITH_HIP) | ||
| # RCCL_ROOT (the module of the CI stack sets it) or the ROCm directory | ||
| find_package( | ||
| rccl | ||
| REQUIRED | ||
| CONFIG | ||
| HINTS | ||
| ${RCCL_ROOT} | ||
| $ENV{RCCL_ROOT} | ||
| ${ROCM_PATH} | ||
| $ENV{ROCM_PATH} | ||
| /opt/rocm | ||
| ) | ||
| add_library(HPX::nccl INTERFACE IMPORTED GLOBAL) | ||
| target_link_libraries(HPX::nccl INTERFACE roc::rccl) | ||
| hpx_info(" RCCL ${rccl_VERSION} for the device conduit") | ||
| elseif(HPX_WITH_CUDA) | ||
| find_package(CUDAToolkit REQUIRED) | ||
| find_package(NCCL 2.14 REQUIRED) | ||
| add_library(HPX::nccl INTERFACE IMPORTED GLOBAL) | ||
| target_link_libraries(HPX::nccl INTERFACE NCCL::nccl CUDA::cudart) | ||
| hpx_info( | ||
| " NCCL ${NCCL_VERSION} for the device conduit: ${NCCL_LIBRARY}" | ||
| ) | ||
| else() | ||
| hpx_error( | ||
| "The NCCL device conduit requires CUDA or HIP (HPX_WITH_CUDA=ON or HPX_WITH_HIP=ON)" | ||
| ) | ||
| endif() | ||
| endif() | ||
| endmacro() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
| #include <hpx/config.hpp> | ||
| #include <hpx/assert.hpp> | ||
| #include <hpx/serialization/detail/allow_zero_copy_receive.hpp> | ||
| #include <hpx/serialization/serialization_chunk.hpp> | ||
| #include <hpx/serialization/serialization_fwd.hpp> | ||
| #include <hpx/serialization/serialize.hpp> | ||
| #include <hpx/serialization/traits/is_bitwise_serializable.hpp> | ||
|
|
@@ -80,15 +81,18 @@ namespace hpx::serialization { | |
| ar.template try_get_extra_data< | ||
| detail::allow_zero_copy_receive>() != nullptr; | ||
|
|
||
| // an array doesn't use its elements while it is loaded: | ||
| // a device transport may deliver them afterwards | ||
| ar.load_binary_chunk( | ||
| detail::array_of_fundamental_type_v<element_type>, m_t, | ||
| m_element_count * sizeof(T), allow_zero_copy_receive); | ||
| m_element_count * sizeof(T), allow_zero_copy_receive, | ||
| chunk_memory::host, true); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Require an explicit opt-in before deferring arbitrary arrays. If a custom load function reads an array immediately, the unconditional Default generic arrays to synchronous delivery. Permit deferred delivery only when the enclosing serializer guarantees the destination lifetime and defers all reads. Keep that opt-in available for supported persistent containers. As per coding guidelines, “Preserve existing APIs and behavior unless the task explicitly asks otherwise.” Also applies to: 95-95
|
||
| } | ||
| else | ||
| { | ||
| ar.save_binary_chunk( | ||
| detail::array_of_fundamental_type_v<element_type>, m_t, | ||
| m_element_count * sizeof(T)); | ||
| m_element_count * sizeof(T), chunk_memory::host, true); | ||
| } | ||
| } | ||
| else | ||
|
|
||
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.
Preserve dependency roots supplied by downstream projects.
These assignments replace explicit downstream
NCCL_ROOTandRCCL_ROOTvalues with paths from the HPX build. If those build-machine paths are unavailable, dependency discovery can fail even when the consumer supplies the correct root.Use the configured paths only as fallbacks when the corresponding root is not set.