#include <base.hpp >
Base class definition for a HiCR Multiple-Producer Single-Consumer Channel
◆ Base()
HiCR::channel::Base::Base
(
CommunicationManager &
communicationManager ,
const std::shared_ptr< LocalMemorySlot > &
coordinationBuffer ,
const size_t
tokenSize ,
const size_t
capacity
)
inline protected
The constructor of the base Channel class.
It requires the user to provide the allocated memory slots for the exchange (data) and coordination buffers.
Parameters
[in] communicationManager The backend's memory manager to facilitate communication between the producer and consumer sides
[in] coordinationBuffer This is a small buffer that needs to be allocated at the producer side. enables the consumer to signal how many tokens it has popped. It may also be used for other coordination signals.
[in] tokenSize The size of each token.
[in] capacity The maximum number of tokens that will be held by this channel
◆ getCircularBuffer()
__INLINE__ auto HiCR::channel::Base::getCircularBuffer
(
)
const
inline noexcept
A function to obtain the low-level circular buffer where tokens are stored
Returns The internal circular buffer
◆ getCommunicationManager()
Get the internal communication buffer assigned to this channel
Returns The internal communication buffer assigned to this channel
◆ getCoordinationBuffer()
__INLINE__ auto HiCR::channel::Base::getCoordinationBuffer
(
)
const
inline protected
Get the internal coordination buffer assigned to this channel
Returns The internal coordination buffer assigned to this channel
◆ getCoordinationBufferSize()
static __INLINE__ size_t HiCR::channel::Base::getCoordinationBufferSize
(
)
inline static noexcept
This function can be used to check the size of the coordination buffer that needs to be provided in the creation of the producer channel
Returns Size (bytes) of the coordination buffer
◆ getDepth()
__INLINE__ size_t HiCR::channel::Base::getDepth
(
)
const
inline noexcept
Returns the current channel depth.
If the current channel is a consumer, it corresponds to how many tokens may yet be consumed. If the current channel is a producer, it corresponds the channel capacity minus the returned value equals how many tokens may still be pushed.
Note This is not a thread-safe call
This is a getter function that should complete in time.
Returns The number of tokens in this channel.
This function when called on a valid channel instance will never fail.
◆ getTokenBufferSize()
static __INLINE__ size_t HiCR::channel::Base::getTokenBufferSize
(
const size_t
tokenSize ,
const size_t
capacity
)
inline static noexcept
This function can be used to check the minimum size of the token buffer that needs to be provided to the consumer channel.
Parameters
[in] tokenSize The expected size of the tokens to use in the channel
[in] capacity The expected capacity (in token count) to use in the channel
Returns Minimum size (bytes) required of the token buffer
◆ getTokenSize()
__INLINE__ size_t HiCR::channel::Base::getTokenSize
(
)
const
inline noexcept
Returns The size of the tokens in this channel.
Returns simply the size per token. All tokens have the same size.
This is a one-sided blocking call that need not be made collectively.
This is a getter function that should complete in time.
This function when called on a valid channel instance will never fail.
◆ initializeCoordinationBuffer()
static __INLINE__ void HiCR::channel::Base::initializeCoordinationBuffer
(
const std::shared_ptr< LocalMemorySlot > &
coordinationBuffer )
inline static
This function can be used to check the size of the coordination buffer that needs to be provided in the creation of the producer channel
Parameters
[in] coordinationBuffer Memory slot corresponding to the coordination buffer
◆ isEmpty()
__INLINE__ bool HiCR::channel::Base::isEmpty
(
)
const
inline noexcept
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 the buffer is empty
false, if the buffer is not empty
◆ isFull()
__INLINE__ bool HiCR::channel::Base::isFull
(
)
const
inline noexcept
This function can be used to quickly check whether the channel is full.
It affects the internal state of the channel because it detects any updates in the internal state of the buffers
Returns true, if the buffer is full
false, if the buffer is not full
The documentation for this class was generated from the following file:
/home/runner/work/HiCR/HiCR/include/hicr/frontends/channel/base.hpp