Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
rapidsmpf::Tag Class Reference

A tag used for identifying messages in a communication operation. More...

#include <communicator.hpp>

Public Types

using StorageT = std::int32_t
 The physical data type to store the tag.
 

Public Member Functions

constexpr Tag (OpID const op, StageID const stage)
 Constructs a tag. More...
 
constexpr operator StorageT () const noexcept
 Returns the int32 view of the tag. More...
 
constexpr OpID op () const noexcept
 Extracts the operation ID from the tag. More...
 
constexpr StageID stage () const noexcept
 Extracts the stage ID from the tag. More...
 

Static Public Member Functions

static constexpr std::size_t bit_length () noexcept
 Returns the max number of bits used for the tag. More...
 
static constexpr StorageT max_value () noexcept
 Returns the max value of the tag. More...
 

Static Public Attributes

static constexpr int stage_id_bits {3}
 Number of bits for the stage ID.
 
static constexpr StorageT stage_id_mask {(1 << stage_id_bits) - 1}
 Mask for the stage ID.
 
static constexpr int op_id_bits {20}
 Number of bits for the operation ID.
 
static constexpr StorageT op_id_mask
 Mask for the operation ID. More...
 

Detailed Description

A tag used for identifying messages in a communication operation.

The tag is a 32-bit integer, with the following layout (low bits to high bits left-to-right)

bits | 012 | 34567 01234567 0123456 | 7 01234567
| | |
value | stage (3) | operation (20) | empty (9)
| | |
constexpr StageID stage() const noexcept
Extracts the stage ID from the tag.

{}

The restriction of 23 used bits comes from empirical MPI implementation limits for MPI_TAG_UB. For example, when using UCX as a transport layer, OpenMPI is restricted to 2^23 distinct tags.

All messages in rapidsmpf over the same Communicator are disambiguated by Tags. A message sent with a given Tag can only be matched by a receive with a matching Tag.

In the same way, collective operations over a Communicator are disambiguated by an OpID: two different collectives with different OpIDs will not interfere.

Due to implementation restrictions, we are limited in the number of distinct tags we can use (the Tag constructor checks for overflow but not reuse). In particular, we support at most 2^20 distinct OpIDs, corresponding to 2^20 distinct collectives running simultaneously.

Definition at line 83 of file communicator.hpp.

Constructor & Destructor Documentation

◆ Tag()

constexpr rapidsmpf::Tag::Tag ( OpID const  op,
StageID const  stage 
)
inlineconstexpr

Constructs a tag.

Exceptions
std::overflow_errorIf either the op or stage values are negative or too large.
Parameters
opThe operation ID
stageThe stage ID

Definition at line 114 of file communicator.hpp.

Member Function Documentation

◆ bit_length()

static constexpr std::size_t rapidsmpf::Tag::bit_length ( )
inlinestaticconstexprnoexcept

Returns the max number of bits used for the tag.

Returns
bit length

Definition at line 132 of file communicator.hpp.

◆ max_value()

static constexpr StorageT rapidsmpf::Tag::max_value ( )
inlinestaticconstexprnoexcept

Returns the max value of the tag.

Returns
max value

Definition at line 140 of file communicator.hpp.

◆ op()

constexpr OpID rapidsmpf::Tag::op ( ) const
inlineconstexprnoexcept

Extracts the operation ID from the tag.

Returns
The operation ID

Definition at line 156 of file communicator.hpp.

◆ operator StorageT()

constexpr rapidsmpf::Tag::operator StorageT ( ) const
inlineconstexprnoexcept

Returns the int32 view of the tag.

Returns
int32 view of the tag

Definition at line 148 of file communicator.hpp.

◆ stage()

constexpr StageID rapidsmpf::Tag::stage ( ) const
inlineconstexprnoexcept

Extracts the stage ID from the tag.

Returns
The stage ID

Definition at line 164 of file communicator.hpp.

Member Data Documentation

◆ op_id_mask

constexpr StorageT rapidsmpf::Tag::op_id_mask
staticconstexpr
Initial value:
{
}
static constexpr StorageT stage_id_mask
Mask for the stage ID.
static constexpr int stage_id_bits
Number of bits for the stage ID.
static constexpr int op_id_bits
Number of bits for the operation ID.

Mask for the operation ID.

Definition at line 101 of file communicator.hpp.


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