/home/runner/work/HiCR/HiCR/include/hicr/frontends/channel/variableSize/mpsc/locking/producer.hpp Source File
|
HiCR
|
producer.hpp
Go to the documentation of this file.
147 if (n != 1) HICR_THROW_RUNTIME("HiCR currently has no implementation for n != 1 with push(sourceSlot, n) for variable size version.");
152 // Flag to record whether the operation was successful or not (it simplifies code by releasing locks only once)
158 if (coordinationCommunicationManager->acquireGlobalLock(_consumerCoordinationBufferForCounts) == false) return successFlag;
166 if (getCircularBufferForPayloads()->getDepth() + requiredBufferSize > getCircularBufferForPayloads()->getCapacity())
204 if (requiredBufferSize + getCircularBufferForPayloads()->getHeadPosition() > getCircularBufferForPayloads()->getCapacity())
206 size_t first_chunk = getCircularBufferForPayloads()->getCapacity() - getCircularBufferForPayloads()->getHeadPosition();
225 payloadCommunicationManager->memcpy(_payloadBuffer, getCircularBufferForPayloads()->getHeadPosition(), sourceSlot, 0, requiredBufferSize);
234 coordinationCommunicationManager->memcpy(_consumerCoordinationBufferForCounts, 0, getCoordinationBufferForCounts(), 0, sizeof(_HICR_CHANNEL_COORDINATION_BUFFER_ELEMENT_TYPE));
237 _consumerCoordinationBufferForPayloads, 0, getCoordinationBufferForPayloads(), 0, sizeof(_HICR_CHANNEL_COORDINATION_BUFFER_ELEMENT_TYPE));
253 // Because the current implementation first receives the message size in the token buffer, followed
254 // by the message payload, it is possible for the token buffer to have a larged depth (by 1) than the payload buffer.
256 return std::min(getCircularBufferForCounts()->getDepth(), getCircularBufferForPayloads()->getDepth() / getPayloadSize());
267 __INLINE__ bool isEmpty() { return (getCircularBufferForCounts()->getDepth() == 0) && (getCircularBufferForPayloads()->getDepth() == 0); }
Definition communicationManager.hpp:54
__INLINE__ size_t getTokenSize() const noexcept
Definition base.hpp:84
__INLINE__ CommunicationManager * getPayloadCommunicationManager() const
Definition base.hpp:223
__INLINE__ CommunicationManager * getCoordinationCommunicationManager() const
Definition base.hpp:229
Definition base.hpp:41
__INLINE__ auto getCircularBufferForPayloads() const
Definition base.hpp:101
__INLINE__ auto getCoordinationBufferForPayloads() const
Definition base.hpp:113
__INLINE__ auto getCoordinationBufferForCounts() const
Definition base.hpp:107
__INLINE__ auto getCircularBufferForCounts() const
Definition base.hpp:95
Definition producer.hpp:39
__INLINE__ void updateDepth()
Definition producer.hpp:93
size_t getPayloadDepth()
Definition producer.hpp:125
__INLINE__ bool isEmpty()
Definition producer.hpp:267
Producer(CommunicationManager &coordinationCommunicationManager, CommunicationManager &payloadCommunicationManager, 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)
Definition producer.hpp:61
__INLINE__ size_t getDepth()
Definition producer.hpp:251
__INLINE__ bool push(const std::shared_ptr< LocalMemorySlot > &sourceSlot, const size_t n=1)
Definition producer.hpp:145
size_t getPayloadSize()
Definition producer.hpp:119
extends channel::Base into a base enabling var-size messages
Generated by