|
| 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