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

Public Member Functions | |
Producer (CommunicationManager &communicationManager, std::shared_ptr< GlobalMemorySlot > tokenBuffer, const std::shared_ptr< LocalMemorySlot > &internalCoordinationBuffer, std::shared_ptr< GlobalMemorySlot > consumerCoordinationBuffer, const size_t tokenSize, const size_t capacity) | |
__INLINE__ void | push (const std::shared_ptr< LocalMemorySlot > &sourceSlot, const size_t n=1) |
__INLINE__ void | updateDepth () |
![]() | |
__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 > &coordinationBuffer, const size_t tokenSize, const size_t capacity) | |
![]() | |
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 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] tokenBuffer The memory slot pertaining to the token buffer. The producer will push new tokens into this buffer, while there is enough space. This buffer should be big enough to hold at least one token. [in] internalCoordinationBuffer This is a small buffer to hold the internal (loca) state of the channel's circular buffer [in] consumerCoordinationBuffer A global reference to the consumer's coordination buffer in order to push tokens and update their head index produced by the remote consumer [in] tokenSize The size of each token. [in] capacity The maximum number of tokens that will be held by this channel
Member Function Documentation
◆ push()
|
inline |
Puts new token(s) unto the channel.
This is a one-sided blocking primitive that need not be made collectively.
- Parameters
-
[in] sourceSlot Source slot (buffer) from whence to read the token(s) [in] n Number of tokens to read from the 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.
Because it is possible that head advance (by producer) and tail advance (signalled by consumer) overlap, we allow for temporary illegal (tail > head) by using the cached depth when advancing the head
◆ updateDepth()
|
inline |
This function updates the internal value of the channel depth
The documentation for this class was generated from the following file:
- /home/runner/work/HiCR/HiCR/include/hicr/frontends/channel/fixedSize/spsc/producer.hpp
Generated by