Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
feb5b59
porting code from mads' PR
nirandaperera Nov 3, 2025
6ea737c
WIP
nirandaperera Nov 5, 2025
a7254ba
adding fanout
nirandaperera Nov 5, 2025
8b97e94
Merge branch 'main' of github.com:rapidsai/rapidsmpf into fanout-node
nirandaperera Nov 5, 2025
91bd6c7
working draft
nirandaperera Nov 5, 2025
a4810a1
adding more tests
nirandaperera Nov 6, 2025
0c5e342
adding more tests
nirandaperera Nov 7, 2025
8081332
extending tests
nirandaperera Nov 7, 2025
9217761
Merge branch 'main' of github.com:rapidsai/rapidsmpf into fanout-node
nirandaperera Nov 7, 2025
37ea50d
minor changes
nirandaperera Nov 7, 2025
ff962c7
add python bindings
nirandaperera Nov 7, 2025
0c7d6a3
precommit
nirandaperera Nov 7, 2025
3b124ca
Update cpp/src/streaming/core/fanout.cpp
nirandaperera Nov 9, 2025
ea945ca
adding lower mem types
nirandaperera Nov 10, 2025
6e90bf8
Merge branch 'fanout-node' of github.com:nirandaperera/rapidsmpf into…
nirandaperera Nov 10, 2025
cc92a82
Merge branch 'main' of github.com:rapidsai/rapidsmpf into fanout-node
nirandaperera Nov 10, 2025
d99d7c4
remove size checkl
nirandaperera Nov 10, 2025
dccd9dd
Revert "remove size checkl"
nirandaperera Nov 10, 2025
33eafbc
Revert "adding lower mem types"
nirandaperera Nov 10, 2025
a3752ca
addressing comments
nirandaperera Nov 10, 2025
a7453d6
addressing cpp comments
nirandaperera Nov 12, 2025
969bf5e
addressing python comments
nirandaperera Nov 12, 2025
d46c08d
Merge branch 'main' of github.com:rapidsai/rapidsmpf into fanout-node
nirandaperera Nov 12, 2025
06ec034
minor
nirandaperera Nov 12, 2025
be778fa
Merge branch 'main' of github.com:rapidsai/rapidsmpf into fanout-node
nirandaperera Nov 13, 2025
4936a2b
allowing output chs to shutdown prematurely
nirandaperera Nov 13, 2025
86c1e8c
Merge branch 'main' of github.com:rapidsai/rapidsmpf into fanout-node
nirandaperera Nov 13, 2025
0856d96
working premature shutdown
nirandaperera Nov 13, 2025
f740a74
minor improvements
nirandaperera Nov 14, 2025
8e3e765
cull comments
nirandaperera Nov 14, 2025
0ee662e
adding throwing tests
nirandaperera Nov 14, 2025
26217ba
revert
nirandaperera Nov 14, 2025
da3a9fe
reducing test permutations
nirandaperera Nov 14, 2025
15ba8ed
precommit
nirandaperera Nov 14, 2025
b174ee0
Merge branch 'main' of github.com:rapidsai/rapidsmpf into fanout-node
nirandaperera Nov 14, 2025
5d1a305
minor improvement
nirandaperera Nov 14, 2025
f8833db
Update cpp/src/streaming/core/fanout.cpp
nirandaperera Nov 18, 2025
d4a170c
Merge branch 'main' into fanout-node
nirandaperera Nov 18, 2025
4ad6600
Merge branch 'main' of github.com:rapidsai/rapidsmpf into fanout-node
nirandaperera Nov 18, 2025
dca9378
addressing PR comments
nirandaperera Nov 18, 2025
ff5e3da
Merge branch 'fanout-node' of github.com:nirandaperera/rapidsmpf into…
nirandaperera Nov 18, 2025
16fb189
addressing comments
nirandaperera Nov 19, 2025
1cfa368
minor change
nirandaperera Nov 19, 2025
b03294c
Merge branch 'main' of github.com:rapidsai/rapidsmpf into fanout-node
nirandaperera Nov 19, 2025
9e213db
API changes
nirandaperera Nov 19, 2025
0ad1b44
Update cpp/src/streaming/core/fanout.cpp
nirandaperera Nov 20, 2025
aed249e
Update cpp/src/streaming/core/fanout.cpp
nirandaperera Nov 20, 2025
6147d63
addressing PR comments
nirandaperera Nov 20, 2025
307fe22
Merge branch 'main' of github.com:rapidsai/rapidsmpf into fanout-node
nirandaperera Nov 20, 2025
9a5d907
Merge branch 'fanout-node' of github.com:nirandaperera/rapidsmpf into…
nirandaperera Nov 20, 2025
c7740c8
addressing comments
nirandaperera Nov 20, 2025
0fef621
stashing messages using ref wrappers
nirandaperera Nov 21, 2025
081662e
Merge branch 'main' into fanout-node
nirandaperera Nov 21, 2025
5deca7e
Merge branch 'main' into fanout-node
nirandaperera Nov 21, 2025
6bb0bd8
Update cpp/src/streaming/core/fanout.cpp
nirandaperera Nov 24, 2025
4a66c0f
addressing PR comments
nirandaperera Nov 25, 2025
a315b62
Apply suggestions from code review
nirandaperera Nov 25, 2025
79bfc0a
Apply suggestions from code review
nirandaperera Nov 25, 2025
8068f2e
Addressing PR comments
nirandaperera Nov 25, 2025
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
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ if(RAPIDSMPF_HAVE_STREAMING)
src/streaming/coll/shuffler.cpp
src/streaming/core/channel.cpp
src/streaming/core/context.cpp
src/streaming/core/fanout.cpp
src/streaming/core/leaf_node.cpp
src/streaming/core/node.cpp
src/streaming/core/spillable_messages.cpp
Expand Down
11 changes: 11 additions & 0 deletions cpp/include/rapidsmpf/streaming/core/channel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class Channel {
* @param msg The msg to send.
* @return A coroutine that evaluates to true if the msg was successfully sent or
* false if the channel was shut down.
*
* @throws std::logic_error If the message is empty.
*/
coro::task<bool> send(Message msg);

Expand All @@ -56,6 +58,8 @@ class Channel {
*
* @return A coroutine that evaluates to the message, which will be empty if the
* channel is shut down.
*
* @throws std::logic_error If the received message is empty.
*/
coro::task<Message> receive();

Expand Down Expand Up @@ -85,6 +89,13 @@ class Channel {
*/
[[nodiscard]] bool empty() const noexcept;

/**
* @brief Check whether the channel is shut down.
*
* @return True if the channel is shut down.
*/
[[nodiscard]] bool is_shutdown() const noexcept;

private:
Channel(std::shared_ptr<SpillableMessages> spillable_messages)
: sm_{std::move(spillable_messages)} {}
Expand Down
7 changes: 7 additions & 0 deletions cpp/include/rapidsmpf/streaming/core/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ class Context {
*/
[[nodiscard]] std::shared_ptr<Communicator> comm() const noexcept;

/**
* @brief Returns the logger.
*
* @return Reference to the logger.
*/
[[nodiscard]] Communicator::Logger& logger() const noexcept;

/**
* @brief Returns the progress thread.
*
Expand Down
67 changes: 67 additions & 0 deletions cpp/include/rapidsmpf/streaming/core/fanout.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES.
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <rapidsmpf/streaming/core/channel.hpp>
#include <rapidsmpf/streaming/core/context.hpp>
#include <rapidsmpf/streaming/core/node.hpp>

namespace rapidsmpf::streaming::node {

/**
* @brief Fanout policy controlling how messages are propagated.
*/
enum class FanoutPolicy : uint8_t {
/**
* @brief Process messages as they arrive and immediately forward them.
*
* Messages are forwarded as soon as they are received from the input channel.
* The next message is not processed until all output channels have completed
* sending the current one, ensuring backpressure and synchronized flow.
*/
BOUNDED,

/**
* @brief Forward messages without enforcing backpressure.
*
* In this mode, messages may be accumulated internally before being
* broadcast, or they may be forwarded immediately depending on the
* implementation and downstream consumption rate.
*
* This mode disables coordinated backpressure between outputs, allowing
* consumers to process at independent rates, but can lead to unbounded
* buffering and increased memory usage.
*/
UNBOUNDED,
};

/**
* @brief Broadcast messages from one input channel to multiple output channels.
*
* The node continuously receives messages from the input channel and forwards
* them to all output channels according to the selected fanout policy, see
* ::FanoutPolicy.
*
* Each output channel receives a deep copy of the same message.
*
* @param ctx The node context to use.
* @param ch_in Input channel from which messages are received.
* @param chs_out Output channels to which messages are broadcast. Must be at least 2.
* @param policy The fanout strategy to use (see ::FanoutPolicy).
*
* @return Streaming node representing the fanout operation.
*
* @throws std::invalid_argument If an unknown fanout policy is specified or if the number
* of output channels is less than 2.
*/
Node fanout(
std::shared_ptr<Context> ctx,
std::shared_ptr<Channel> ch_in,
std::vector<std::shared_ptr<Channel>> chs_out,
FanoutPolicy policy
);

} // namespace rapidsmpf::streaming::node
11 changes: 8 additions & 3 deletions cpp/src/streaming/core/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
namespace rapidsmpf::streaming {

coro::task<bool> Channel::send(Message msg) {
RAPIDSMPF_EXPECTS(!msg.empty(), "message cannot be empty");
auto result = co_await rb_.produce(sm_->insert(std::move(msg)));
co_return result == coro::ring_buffer_result::produce::produced;
}

coro::task<Message> Channel::receive() {
auto msg = co_await rb_.consume();
if (msg.has_value()) {
co_return sm_->extract(*msg);
auto msg_id = co_await rb_.consume();
if (msg_id.has_value()) {
co_return sm_->extract(*msg_id);
} else {
co_return Message{};
}
Expand All @@ -34,4 +35,8 @@ bool Channel::empty() const noexcept {
return rb_.empty();
}

bool Channel::is_shutdown() const noexcept {
return rb_.is_shutdown();
}

} // namespace rapidsmpf::streaming
4 changes: 4 additions & 0 deletions cpp/src/streaming/core/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ std::shared_ptr<Communicator> Context::comm() const noexcept {
return comm_;
}

Communicator::Logger& Context::logger() const noexcept {
return comm_->logger();
}

std::shared_ptr<ProgressThread> Context::progress_thread() const noexcept {
return progress_thread_;
}
Expand Down
Loading
Loading