Public Member Functions | List of all members
rapidsmpf::shuffler::detail::FinishCounter Class Reference

Helper to tally the finish status of a shuffle. More...

#include <finish_counter.hpp>

Public Member Functions

 FinishCounter (Rank nranks, PartID n_local_partitions)
 Construct a finish counter. More...
 
void move_goalpost (Rank src_rank, ChunkID nchunks)
 Move the goalpost for a specific source rank. More...
 
void add_finished_chunk ()
 Add a finished chunk to the global counter. More...
 
bool all_finished () const
 Returns whether all partitions are finished (non-blocking). More...
 
std::string str () const
 Returns a description of this instance. More...
 

Detailed Description

Helper to tally the finish status of a shuffle.

The FinishCounter class tracks the completion of shuffle operations across different ranks. Each rank reports its total chunk count once, and individual chunks are tallied globally. All local partitions finish simultaneously when every rank has reported and all chunks have been received.

Definition at line 38 of file finish_counter.hpp.

Constructor & Destructor Documentation

◆ FinishCounter()

rapidsmpf::shuffler::detail::FinishCounter::FinishCounter ( Rank  nranks,
PartID  n_local_partitions 
)

Construct a finish counter.

Parameters
nranksThe total number of ranks participating in the shuffle.
n_local_partitionsThe number of local partitions owned by this rank.

Member Function Documentation

◆ add_finished_chunk()

void rapidsmpf::shuffler::detail::FinishCounter::add_finished_chunk ( )

Add a finished chunk to the global counter.

This function increments the global finished chunk counter. When all ranks have reported and the number of finished chunks matches the total goal, all partitions are marked as finished.

Exceptions
std::logic_errorIf the total finished chunks exceed the goal.

◆ all_finished()

bool rapidsmpf::shuffler::detail::FinishCounter::all_finished ( ) const

Returns whether all partitions are finished (non-blocking).

Returns
True if all partitions are finished, otherwise False.

◆ move_goalpost()

void rapidsmpf::shuffler::detail::FinishCounter::move_goalpost ( Rank  src_rank,
ChunkID  nchunks 
)

Move the goalpost for a specific source rank.

This function sets the number of chunks that need to be received from a specific rank. It should only be called once per rank.

Parameters
src_rankThe source rank reporting its chunk count.
nchunksThe number of chunks required. (Requires nchunks > 0)
Exceptions
std::logic_errorIf the goalpost is moved more than once for the same rank, or if nchunks is 0.

◆ str()

std::string rapidsmpf::shuffler::detail::FinishCounter::str ( ) const

Returns a description of this instance.

Returns
The description.

The documentation for this class was generated from the following file: