Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7a6bb81
adding distirbuted cudf streaming tests
nirandaperera Jun 12, 2026
4476694
precommit
nirandaperera Jun 12, 2026
eeb68c7
style
nirandaperera Jun 12, 2026
e0cbaec
Merge branch 'main' of github.com:rapidsai/cudf into adding-cudf-stre…
nirandaperera Jun 12, 2026
cef0222
minor fix
nirandaperera Jun 13, 2026
dc213d8
Clarify file structure in Environment class comment
nirandaperera Jun 15, 2026
637eb54
Merge branch 'main' into adding-cudf-streaming-dist-tests
nirandaperera Jun 15, 2026
74a226f
precommit
nirandaperera Jun 15, 2026
02b3979
addressing coderabbit comments
nirandaperera Jun 15, 2026
6507340
Merge branch 'main' of github.com:rapidsai/cudf into adding-cudf-stre…
nirandaperera Jun 15, 2026
7c6544f
Rename functions and variables for consistency
nirandaperera Jun 16, 2026
b851330
Merge branch 'main' into adding-cudf-streaming-dist-tests
nirandaperera Jun 16, 2026
a2703d5
Fix include directory formatting in CMakeLists.txt
nirandaperera Jun 16, 2026
2adc3d8
Update CMakeLists.txt
nirandaperera Jun 16, 2026
64f8918
Fix comment formatting in CMakeLists.txt
nirandaperera Jun 16, 2026
2a5f160
Merge branch 'main' into adding-cudf-streaming-dist-tests
nirandaperera Jun 16, 2026
7e91b73
fix cmake
nirandaperera Jun 16, 2026
fbc93c3
cmake style
nirandaperera Jun 16, 2026
8d8037d
fix cmake
nirandaperera Jun 16, 2026
0aed2dd
Merge branch 'main' into adding-cudf-streaming-dist-tests
nirandaperera Jun 16, 2026
e7e8e5d
Merge branch 'main' of github.com:rapidsai/cudf into adding-cudf-stre…
nirandaperera Jun 16, 2026
934cb95
precommit
nirandaperera Jun 16, 2026
11ead06
percommit
nirandaperera Jun 16, 2026
e6b8717
Merge branch 'main' into adding-cudf-streaming-dist-tests
nirandaperera Jun 22, 2026
e1c7ccb
Merge branch 'main' of github.com:rapidsai/cudf into adding-cudf-stre…
nirandaperera Jun 22, 2026
106cc10
Merge branch 'main' of github.com:rapidsai/cudf into adding-cudf-stre…
nirandaperera Jun 22, 2026
cfe66a8
Trigger Build
nirandaperera Jun 22, 2026
c2f7ecb
attempting to fix numpy lint error
nirandaperera Jun 22, 2026
2171a27
Revert "attempting to fix numpy lint error" & adding pre-commit clean
nirandaperera Jun 22, 2026
41bb34e
run precommit AGAIN!
nirandaperera Jun 22, 2026
a87107f
Merge branch 'main' into adding-cudf-streaming-dist-tests
vyasr Jun 23, 2026
55851a0
Fix conda recipe test: use renamed libcudf_streaming_single_tests binary
vyasr Jun 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set(CUDF_STREAMING_FOUND_UCXX OFF)
set(CUDF_STREAMING_HAVE_MPI OFF)
set(CUDF_STREAMING_HAVE_UCXX OFF)

if(BUILD_BENCHMARKS OR BUILD_EXAMPLES)
if(BUILD_BENCHMARKS OR BUILD_EXAMPLES OR BUILD_TESTS)
rapids_find_package(
MPI QUIET
BUILD_EXPORT_SET cudf_streaming-exports
Expand All @@ -23,7 +23,7 @@ if(BUILD_BENCHMARKS OR BUILD_EXAMPLES)
endif()
endif()

if(BUILD_BENCHMARKS)
if(BUILD_BENCHMARKS OR BUILD_TESTS)
rapids_find_package(
ucxx QUIET
BUILD_EXPORT_SET cudf_streaming-exports
Expand Down
8 changes: 8 additions & 0 deletions cpp/libcudf_streaming/cmake/thirdparty/get_cudf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ set(CUDF_STREAMING_MIN_VERSION
)
find_and_configure_cudf(${CUDF_STREAMING_MIN_VERSION} cudf_streaming-exports)

# The cudf-dependent tests link against cudf::cudftestutil{,_impl}, which live in cudf's optional
# `testing` component. The transitive find_dependency(cudf) triggered by find_and_configure_cudf
# does not request it, so request it explicitly here when building tests. This avoids having to
# build cudf from source: the component is provided by the installed (e.g. conda) cudf package.
if(BUILD_TESTS AND NOT TARGET cudf::cudftestutil)
find_package(cudf ${CUDF_STREAMING_MIN_VERSION} REQUIRED COMPONENTS testing)
Comment thread
nirandaperera marked this conversation as resolved.
Resolved
endif()

if(cudf_REQUIRES_CUDA)
rapids_cuda_init_architectures(CUDF_STREAMING)

Expand Down
91 changes: 91 additions & 0 deletions cpp/libcudf_streaming/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,33 @@ if(NOT EXISTS "${_cudf_streaming_gtests_link}")
file(CREATE_LINK "${CUDF_STREAMING_BINARY_DIR}/gtests" "${_cudf_streaming_gtests_link}" SYMBOLIC)
endif()

# Create a separate test case for each of these n_ranks.
set(nranks_to_run 1 2 5)

# A helper function to create a test case for each parallelism (defined by nranks_to_run).
# TEST_TARGET is the name of the test target (required). This adds len(nranks_to_run) test cases
# identified by <TEST_TARGET>_<n_ranks>. NOTE: When running ctest, the TEST_TARGET executable should
# be located in the ./gtests/ directory relative to the PWD.
function(cudf_streaming_mpirun_test_add)
set(options) # no options
set(one_value TEST_TARGET)
set(multi_value) # no multi_value args
cmake_parse_arguments(_MPIRUN_TEST "${options}" "${one_value}" "${multi_value}" ${ARGN})

if(NOT DEFINED _MPIRUN_TEST_TEST_TARGET)
message(FATAL_ERROR "cudf_streaming_mpirun_test_add called without a test prefix")
endif()

message(STATUS "Adding mpirun test: ${_MPIRUN_TEST_TEST_TARGET} nranks: ${nranks_to_run}")
foreach(np IN ITEMS ${nranks_to_run})
# add the test using the relative path of the target
add_test(
NAME "${_MPIRUN_TEST_TEST_TARGET}_${np}" COMMAND mpirun --map-by node --bind-to none -np
${np} "gtests/${_MPIRUN_TEST_TEST_TARGET}"
)
endforeach(np)
endfunction(cudf_streaming_mpirun_test_add)

add_library(cudf_streaming_test_sources OBJECT)
set_target_properties(
cudf_streaming_test_sources
Expand All @@ -38,6 +65,13 @@ target_link_libraries(
PRIVATE cudf_streaming rapidsmpf::rapidsmpf cudf::cudftestutil cudf::cudftestutil_impl
PUBLIC GTest::gmock GTest::gtest
)
# cudf::cudftestutil_impl injects cudf test-utility .cu sources (via INTERFACE_SOURCES) that are
# compiled into this object library. Those sources use device lambdas, so they require the same CUDA
# flags cudf builds them with (notably --expt-extended-lambda from CUDF_CUDA_FLAGS).
target_compile_options(
cudf_streaming_test_sources
PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:${CUDF_CUDA_FLAGS}>"
)
target_sources(
cudf_streaming_test_sources
PRIVATE streaming/test_table_chunk.cpp
Expand Down Expand Up @@ -81,6 +115,63 @@ rapids_test_add(
INSTALL_COMPONENT_SET testing
)

# ##################################################################################################
# MPI and UCXX based tests -------------------------------------------------------------------------
# These executables reuse cudf_streaming_test_sources but provide a different test environment main
# (main/mpi.cpp / main/ucxx.cpp), and are launched via mpirun for multiple ranks.
if(CUDF_STREAMING_HAVE_MPI)
add_executable(cudf_streaming_mpi_tests main/mpi.cpp)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
add_executable(cudf_streaming_mpi_tests main/mpi.cpp)
add_executable(libcudf_streaming_mpi_tests main/mpi.cpp)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: let's make test names complete and matching the package/library name. This would also match the same prefix being proposed for benchmarks here.

set_target_properties(
cudf_streaming_mpi_tests
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CUDF_STREAMING_BINARY_DIR}/gtests"
INSTALL_RPATH "\$ORIGIN/../../../lib"
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
CUDA_STANDARD 20
CUDA_STANDARD_REQUIRED ON
)
target_include_directories(
cudf_streaming_mpi_tests PRIVATE "${CUDF_STREAMING_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}"
)
target_link_libraries(
cudf_streaming_mpi_tests
PRIVATE cudf_streaming rapidsmpf::rapidsmpf cudf_streaming::optional_communication GTest::gmock
GTest::gtest $<TARGET_NAME_IF_EXISTS:conda_env> cudf_streaming_test_sources
)
cudf_streaming_mpirun_test_add(TEST_TARGET cudf_streaming_mpi_tests)

if(CUDF_STREAMING_HAVE_UCXX)
add_executable(cudf_streaming_ucxx_tests main/ucxx.cpp)
set_target_properties(
cudf_streaming_ucxx_tests
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CUDF_STREAMING_BINARY_DIR}/gtests"
INSTALL_RPATH "\$ORIGIN/../../../lib"
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
CUDA_STANDARD 20
CUDA_STANDARD_REQUIRED ON
)
target_include_directories(
cudf_streaming_ucxx_tests PRIVATE "${CUDF_STREAMING_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}"
)
target_link_libraries(
cudf_streaming_ucxx_tests
PRIVATE cudf_streaming rapidsmpf::rapidsmpf cudf_streaming::optional_communication
GTest::gmock GTest::gtest $<TARGET_NAME_IF_EXISTS:conda_env>
cudf_streaming_test_sources
)
cudf_streaming_mpirun_test_add(TEST_TARGET cudf_streaming_ucxx_tests)
else()
cudf_streaming_skip_optional_target(cudf_streaming_ucxx_tests "UCXX not found")
endif()
else()
cudf_streaming_skip_optional_target(cudf_streaming_mpi_tests "MPI not found")
endif()

rapids_test_install_relocatable(
INSTALL_COMPONENT_SET testing DESTINATION bin/gtests/libcudf_streaming
)
29 changes: 21 additions & 8 deletions cpp/libcudf_streaming/tests/environment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,42 @@

#include <rapidsmpf/communicator/communicator.hpp>

#include <memory>

enum class TestEnvironmentType : int {
MPI,
UCXX,
SINGLE,
};

/**
* Base test environment that exposes a communicator to the test suite. Concrete,
* communicator-specific environments (single/MPI/UCXX) derive from this class and are defined in
* the corresponding `main/*.cpp`, where the communicator-specific state (e.g. the MPI communicator)
* and headers live. Exactly one of them is linked into each test executable.
*/
class Environment : public ::testing::Environment {
public:
Environment(int argc, char** argv);
Environment(int argc, char** argv) : argc_(argc), argv_(argv) {}
~Environment() override = default;

void SetUp() override;
void SetUp() override = 0;

void TearDown() override;
void TearDown() override = 0;

void barrier();
virtual void barrier() = 0;

[[nodiscard]] TestEnvironmentType type() const;
[[nodiscard]] virtual TestEnvironmentType type() const = 0;

constexpr rapidsmpf::config::Options& options() { return options_; }
rapidsmpf::config::Options& options() { return options_; }

std::shared_ptr<rapidsmpf::Communicator> split_comm();
virtual std::shared_ptr<rapidsmpf::Communicator> split_comm() = 0;

std::shared_ptr<rapidsmpf::Communicator> comm_;

private:
protected:
int argc_;
char** argv_;
std::shared_ptr<rapidsmpf::Communicator> split_comm_{nullptr};
rapidsmpf::config::Options options_;
};
Expand Down
82 changes: 82 additions & 0 deletions cpp/libcudf_streaming/tests/main/mpi.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/**
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights
* reserved. SPDX-License-Identifier: Apache-2.0
*/

#include "../environment.hpp"

#include <cudf_test/cudf_gtest.hpp>

#include <mpi.h>
#include <rapidsmpf/communicator/mpi.hpp>
#include <rapidsmpf/config.hpp>
#include <rapidsmpf/progress_thread.hpp>

#include <memory>

namespace {
class MPIEnvironment : public Environment {
public:
using Environment::Environment;

[[nodiscard]] TestEnvironmentType type() const override { return TestEnvironmentType::MPI; }

void SetUp() override
{
rapidsmpf::mpi::init(&argc_, &argv_);

RAPIDSMPF_MPI(MPI_Comm_dup(MPI_COMM_WORLD, &mpi_comm_));

options_ = rapidsmpf::config::Options(rapidsmpf::config::get_environment_variables());

comm_ = std::make_shared<rapidsmpf::MPI>(
mpi_comm_, options_, std::make_shared<rapidsmpf::ProgressThread>());
}

void TearDown() override
{
split_comm_ = nullptr; // Clean up the split communicator.
comm_ = nullptr; // Clean up the communicator.

RAPIDSMPF_MPI(MPI_Comm_free(&mpi_comm_));
RAPIDSMPF_MPI(MPI_Finalize());
}

void barrier() override { RAPIDSMPF_MPI(MPI_Barrier(mpi_comm_)); }

std::shared_ptr<rapidsmpf::Communicator> split_comm() override
{
// Return cached split communicator if it exists
if (split_comm_ != nullptr) { return split_comm_; }

// Initialize configuration options from environment variables.
rapidsmpf::config::Options options{rapidsmpf::config::get_environment_variables()};

// Create the new split communicator
int rank;
RAPIDSMPF_MPI(MPI_Comm_rank(mpi_comm_, &rank));
MPI_Comm split_comm = MPI_COMM_NULL;
RAPIDSMPF_MPI(MPI_Comm_split(mpi_comm_, rank, 0, &split_comm));
return std::shared_ptr<rapidsmpf::MPI>(
new rapidsmpf::MPI(split_comm, options, comm_->progress_thread()),
// Don't leak the split handle.
[comm = split_comm](rapidsmpf::MPI* x) mutable {
delete x;
MPI_Comm_free(&comm);
});
}
Comment thread
nirandaperera marked this conversation as resolved.
Resolved

private:
MPI_Comm mpi_comm_{MPI_COMM_NULL};
};
} // namespace

Environment* GlobalEnvironment = nullptr;

int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
GlobalEnvironment = new MPIEnvironment(argc, argv);
::testing::AddGlobalTestEnvironment(GlobalEnvironment);
return RUN_ALL_TESTS();
}
42 changes: 24 additions & 18 deletions cpp/libcudf_streaming/tests/main/single.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,44 @@
#include <cudf_test/cudf_gtest.hpp>

#include <rapidsmpf/communicator/single.hpp>
#include <rapidsmpf/config.hpp>
#include <rapidsmpf/progress_thread.hpp>

#include <memory>

Environment* GlobalEnvironment = nullptr;
namespace {
class SingleEnvironment : public Environment {
public:
using Environment::Environment;

Environment::Environment(int, char**) {}
[[nodiscard]] TestEnvironmentType type() const override { return TestEnvironmentType::SINGLE; }

TestEnvironmentType Environment::type() const { return TestEnvironmentType::SINGLE; }
void SetUp() override
{
options_ = rapidsmpf::config::Options(rapidsmpf::config::get_environment_variables());
comm_ =
std::make_shared<rapidsmpf::Single>(options_, std::make_shared<rapidsmpf::ProgressThread>());
split_comm_ = comm_;
}

void Environment::SetUp()
{
options_ = rapidsmpf::config::Options(rapidsmpf::config::get_environment_variables());
comm_ =
std::make_shared<rapidsmpf::Single>(options_, std::make_shared<rapidsmpf::ProgressThread>());
split_comm_ = comm_;
}
void TearDown() override
{
split_comm_ = nullptr;
comm_ = nullptr;
}

void Environment::TearDown()
{
split_comm_ = nullptr;
comm_ = nullptr;
}
void barrier() override {}

void Environment::barrier() {}
std::shared_ptr<rapidsmpf::Communicator> split_comm() override { return split_comm_; }
};
} // namespace

std::shared_ptr<rapidsmpf::Communicator> Environment::split_comm() { return split_comm_; }
Environment* GlobalEnvironment = nullptr;

int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
GlobalEnvironment = new Environment(argc, argv);
GlobalEnvironment = new SingleEnvironment(argc, argv);
::testing::AddGlobalTestEnvironment(GlobalEnvironment);
return RUN_ALL_TESTS();
}
Loading
Loading