Skip to content

Commit a4607d5

Browse files
authored
Merge branch 'main' into enforce-abi3audit
2 parents c64faf5 + 123f281 commit a4607d5

4 files changed

Lines changed: 85 additions & 2 deletions

File tree

cpp/src/communicator/ucxx.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,26 @@
1818
#include <rapidsmpf/error.hpp>
1919
#include <rapidsmpf/utils/misc.hpp>
2020

21+
#include "ucxx_internal.hpp"
22+
2123
namespace rapidsmpf {
2224

2325
namespace ucxx {
2426

27+
namespace detail {
28+
29+
std::shared_ptr<::ucxx::Context> create_context(ProgressMode progress_mode) {
30+
auto feature_flags = ::ucxx::Context::defaultFeatureFlags;
31+
if (progress_mode == ProgressMode::Polling
32+
|| progress_mode == ProgressMode::ThreadPolling)
33+
{
34+
feature_flags &= ~static_cast<std::uint64_t>(UCP_FEATURE_WAKEUP);
35+
}
36+
return ::ucxx::contextBuilder(feature_flags).build();
37+
}
38+
39+
} // namespace detail
40+
2541
namespace {
2642

2743
/**
@@ -984,8 +1000,7 @@ std::unique_ptr<rapidsmpf::ucxx::InitializedRank> init(
9841000
});
9851001

9861002
auto create_worker = [progress_mode]() {
987-
auto context =
988-
::ucxx::contextBuilder(::ucxx::Context::defaultFeatureFlags).build();
1003+
auto context = detail::create_context(progress_mode);
9891004
auto worker = context->workerBuilder().build();
9901005

9911006
RAPIDSMPF_EXPECTS(
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
#pragma once
6+
7+
#include <memory>
8+
9+
#include <ucxx/context.h>
10+
11+
#include <rapidsmpf/communicator/ucxx.hpp>
12+
13+
namespace rapidsmpf::ucxx::detail {
14+
15+
[[nodiscard]] std::shared_ptr<::ucxx::Context> create_context(ProgressMode progress_mode);
16+
17+
} // namespace rapidsmpf::ucxx::detail

cpp/tests/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ if(RAPIDSMPF_HAVE_MPI)
157157

158158
if(RAPIDSMPF_HAVE_UCXX)
159159
add_executable(ucxx_tests main/ucxx.cpp)
160+
target_sources(ucxx_tests PRIVATE test_ucxx.cpp)
161+
target_include_directories(ucxx_tests PRIVATE "${PROJECT_SOURCE_DIR}/src")
160162
set_target_properties(
161163
ucxx_tests
162164
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${RAPIDSMPF_BINARY_DIR}/gtests"

cpp/tests/test_ucxx.cpp

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/**
2+
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <cstdint>
7+
8+
#include <gtest/gtest.h>
9+
#include <ucp/api/ucp.h>
10+
#include <ucxx/context.h>
11+
12+
#include <rapidsmpf/communicator/ucxx.hpp>
13+
14+
#include "communicator/ucxx_internal.hpp"
15+
16+
namespace {
17+
18+
struct ProgressModeFeatureFlagsParam {
19+
rapidsmpf::ucxx::ProgressMode progress_mode;
20+
bool wakeup_enabled;
21+
};
22+
23+
class ProgressModeFeatureFlagsTest
24+
: public ::testing::TestWithParam<ProgressModeFeatureFlagsParam> {};
25+
26+
TEST_P(ProgressModeFeatureFlagsTest, CreatesContextWithExpectedFeatureFlags) {
27+
auto const context =
28+
rapidsmpf::ucxx::detail::create_context(GetParam().progress_mode);
29+
auto const default_flags = ::ucxx::Context::defaultFeatureFlags;
30+
auto const expected_flags =
31+
GetParam().wakeup_enabled ? default_flags : default_flags & ~UCP_FEATURE_WAKEUP;
32+
33+
EXPECT_EQ(context->getFeatureFlags(), expected_flags);
34+
}
35+
36+
INSTANTIATE_TEST_SUITE_P(
37+
ProgressModes,
38+
ProgressModeFeatureFlagsTest,
39+
::testing::Values(
40+
ProgressModeFeatureFlagsParam{rapidsmpf::ucxx::ProgressMode::Blocking, true},
41+
ProgressModeFeatureFlagsParam{rapidsmpf::ucxx::ProgressMode::Polling, false},
42+
ProgressModeFeatureFlagsParam{
43+
rapidsmpf::ucxx::ProgressMode::ThreadBlocking, true
44+
},
45+
ProgressModeFeatureFlagsParam{rapidsmpf::ucxx::ProgressMode::ThreadPolling, false}
46+
)
47+
);
48+
49+
} // namespace

0 commit comments

Comments
 (0)