Producer Class Reference
HiCR
|
#include <producer.hpp>

Public Member Functions | |
Producer (CommunicationManager &communicationManager, std::shared_ptr< LocalMemorySlot > sizeInfoBuffer, std::shared_ptr< GlobalMemorySlot > payloadBuffer, std::shared_ptr< GlobalMemorySlot > tokenBuffer, const std::shared_ptr< LocalMemorySlot > &internalCoordinationBufferForCounts, const std::shared_ptr< LocalMemorySlot > &internalCoordinationBufferForPayloads, std::shared_ptr< GlobalMemorySlot > consumerCoordinationBufferForCounts, std::shared_ptr< GlobalMemorySlot > consumerCoordinationBufferForPayloads, const size_t payloadCapacity, const size_t payloadSize, const size_t capacity) | |
__INLINE__ void | updateDepth () |
__INLINE__ void | advancePayloadTail (const size_t n=1) |
__INLINE__ size_t | getPayloadHeadPosition () const noexcept |
__INLINE__ size_t | getPayloadSize () |
__INLINE__ size_t | getPayloadDepth () |
__INLINE__ size_t | getPayloadCapacity () |
__INLINE__ void | push (const std::shared_ptr< LocalMemorySlot > &sourceSlot, const size_t n=1) |
size_t | getDepth () |
bool | isEmpty () |
![]() | |
__INLINE__ size_t | getTokenSize () const noexcept |
__INLINE__ size_t | getDepth () const noexcept |
__INLINE__ bool | isFull () const noexcept |
__INLINE__ bool | isEmpty () const noexcept |
__INLINE__ auto | getCircularBuffer () const noexcept |
Additional Inherited Members | |
![]() | |
static __INLINE__ size_t | getCoordinationBufferSize () noexcept |
static __INLINE__ void | initializeCoordinationBuffer (const std::shared_ptr< LocalMemorySlot > &coordinationBuffer) |
static __INLINE__ size_t | getTokenBufferSize (const size_t tokenSize, const size_t capacity) noexcept |
![]() | |
Base (CommunicationManager &communicationManager, const std::shared_ptr< LocalMemorySlot > &coordinationBufferForCounts, const std::shared_ptr< LocalMemorySlot > &coordinationBufferForPayloads, const size_t capacity, const size_t payloadCapacity) | |
__INLINE__ auto | getCircularBufferForCounts () const |
__INLINE__ auto | getCircularBufferForPayloads () const |
__INLINE__ auto | getCoordinationBufferForCounts () const |
__INLINE__ auto | getCoordinationBufferForPayloads () const |
![]() | |
Base (CommunicationManager &communicationManager, const std::shared_ptr< LocalMemorySlot > &coordinationBuffer, const size_t tokenSize, const size_t capacity) | |
__INLINE__ CommunicationManager * | getCommunicationManager () const |
__INLINE__ auto | getCoordinationBuffer () const |
Detailed Description
Class definition for a HiCR Producer Channel
It exposes the functionality to be expected for a producer channel
Constructor & Destructor Documentation
◆ Producer()
|
inline |
The constructor of the variable-sized producer channel class.
It requires the user to provide the allocated memory slots for the exchange (data) and coordination buffers.
- Parameters
-
[in] communicationManager The backend to facilitate communication between the producer and consumer sides [in] sizeInfoBuffer The local memory slot used to hold the information about the next message size [in] payloadBuffer The global memory slot pertaining to the payload of all messages. The producer will push messages into this buffer, while there is enough space. This buffer should be large enough to hold at least the largest of the variable-size messages. [in] tokenBuffer The memory slot pertaining to the token buffer, which is used to hold message size data. The producer will push message sizes into this buffer, while there is enough space. This buffer should be large enough to hold at least one message size. [in] internalCoordinationBufferForCounts This is a small buffer to hold the internal (local) state of the channel's message counts [in] internalCoordinationBufferForPayloads This is a small buffer to hold the internal (local) state of the channel's payload sizes (in bytes) [in] consumerCoordinationBufferForCounts A global reference of the consumer's own coordination buffer to check for updates on message counts [in] consumerCoordinationBufferForPayloads A global reference of the consumer's own coordination buffer to check for updates on payload sizes (in bytes) [in] payloadCapacity capacity in bytes of the buffer for message payloads [in] payloadSize size in bytes of the datatype used for variable-sized messages [in] capacity The maximum number of tokens that will be held by this channel
Member Function Documentation
◆ advancePayloadTail()
|
inline |
advance payload buffer tail by a number of bytes
- Parameters
-
[in] n bytes to advance payload buffer tail by
◆ getDepth()
|
inline |
Get depth of variable-size producer. Since we have 2 buffers - one for counts, and one for payloads, we need to be careful. Because the current implementation first receives the payload (phase 1) before
receiving the message counts (phase 2), returning this depth should guarantee we already have received the payloads
- Returns
- The number of elements in the variable-size producer channel
◆ getPayloadCapacity()
|
inline |
get payload buffer capacity
- Returns
- payload buffer capacity (in bytes)
◆ getPayloadDepth()
|
inline |
get payload buffer depth
- Returns
- payload buffer depth (in bytes)
◆ getPayloadHeadPosition()
|
inlinenoexcept |
get payload buffer head position
- Returns
- payload buffer head position (in bytes)
◆ getPayloadSize()
|
inline |
get the datatype size used for payload buffer
- Returns
- datatype size (in bytes) for payload buffer
◆ isEmpty()
|
inline |
This function can be used to quickly check whether the channel is empty.
It does not affects the internal state of the channel
- Returns
- true, if both message count and payload buffers are empty
- false, if one of the buffers is not empty
◆ push()
|
inline |
Puts new variable-sized messages unto the channel. The implementation consists of two phases. In phase 1, we copy the payload data. In phase 2, we copy the message size of the data we just copied. The reason we postpone copying the data size is following: The method getDepth is now simply a check for the depth of the sizes buffer, since we guarantee that the copying of the actual payload has already happened (phase 1 before phase 2).
This is a one-sided blocking primitive that need not be made collectively.
- Parameters
-
[in] sourceSlot Source slot (buffer) to copy into buffer [in] n Number of times to copy this sourceSlot
into buffer
This operation will fail with an exception if:
- The source buffer is smaller than required
- The operation would exceed the buffer size
A call to this function throws an exception if:
- the channel at this locality is a consumer.
◆ updateDepth()
|
inline |
Identical to Producer::updateDepth(), but this coordination buffer is larger and contains payload information as well as token metadata
The documentation for this class was generated from the following file:
- /home/runner/work/HiCR/HiCR/include/hicr/frontends/channel/variableSize/spsc/producer.hpp
Generated by