14 #ifndef HTGS_MEMORYDATA_HPP 15 #define HTGS_MEMORYDATA_HPP 68 class MemoryData :
public IData,
public std::enable_shared_from_this<MemoryData<T>> {
120 std::shared_ptr<MemoryData<T>> mPtr = std::enable_shared_from_this<MemoryData<T>>::shared_from_this();
122 mConn->produceData(mPtr);
206 const T &
get(
size_t idx)
const {
207 return *(this->
memory + idx);
216 return *(this->
memory + idx);
226 return *(this->
memory + idx);
236 return *(this->
memory + idx);
307 #endif //HTGS_MEMORY_HPP std::shared_ptr< IMemoryAllocator< T > > allocator
The allocator associated with the memory.
Definition: MemoryData.hpp:303
const T & operator[](size_t idx) const
Gets the value for memory at index.
Definition: MemoryData.hpp:225
MemoryData< T > * copy()
Creates a copy of this MemoryData.
Definition: MemoryData.hpp:267
void memAlloc()
Allocates the memory that this MemoryData is using.
Definition: MemoryData.hpp:193
const std::string & getMemoryManagerName() const
Gets the memory manager name.
Definition: MemoryData.hpp:289
MMType
The memory manager types.
Definition: MMType.hpp:38
MMType type
The type of memory manager.
Definition: MemoryData.hpp:294
T & operator[](size_t idx)
Gets the value for memory at index.
Definition: MemoryData.hpp:235
size_t getPipelineId() const
Gets the pipelineId associated with the MemoryManager that allocated the memory.
Definition: MemoryData.hpp:138
IMemoryReleaseRule * memoryReleaseRule
The memory release rule associated with the memory.
Definition: MemoryData.hpp:302
Provides the Connector class for managing input/output of AbsData between Tasks.
void memoryUsed()
Updates the state of the memory when it is received by the MemoryManager.
Definition: MemoryData.hpp:183
size_t getSize() const
Gets the size of the memory that was allocated.
Definition: MemoryData.hpp:144
Describes memory allocated by a MemoryManager to manage shared memory across multiple ITask...
Definition: ICudaTask.hpp:28
Manages the input/output of IData between Tasks.
Definition: Connector.hpp:62
void memFree()
Frees the memory that this MemoryData is managing.
Definition: MemoryData.hpp:245
virtual bool canReleaseMemory()=0
Pure virtual function to indicate when memory can be released.
Implements the IData class, which is used for all data types entering/leaving a task graph...
Implements a thread-safe PriorityBlockingQueue.
Defines the Memory Manager types MMType.
Abstract class that describes when memory can be released/reused.
Definition: IMemoryReleaseRule.hpp:73
bool canReleaseMemory()
Checks whether the memory can be recycled/released by the MemoryManager.
Definition: MemoryData.hpp:173
void memAlloc(size_t size)
Allocates the memory that this memory data is managed with the specified size.
Definition: MemoryData.hpp:280
size_t pipelineId
The pipelineId associated with where this memory was managed.
Definition: MemoryData.hpp:299
Abstract class that describes how memory is allocated and freed.
Definition: IMemoryAllocator.hpp:67
MMType getType() const
Gets the type of memory that is associated with the memory manager.
Definition: MemoryData.hpp:256
std::weak_ptr< Connector< MemoryData< T > > > memoryManagerConnector
The pointer to the connector that owns this memory.
Definition: MemoryData.hpp:296
T * memory
The memory.
Definition: MemoryData.hpp:300
void releaseMemory()
Gets the address of the memory manager that allocated this memory data.
Definition: MemoryData.hpp:119
Describes how memory is released.
virtual void memoryUsed()=0
Pure virtual function to update the state of when memory has been used.
~MemoryData()
Destructor that releases IMemoryAllocator memory.
Definition: MemoryData.hpp:99
size_t size
The size of the memory (in elements)
Definition: MemoryData.hpp:301
MemoryData(std::shared_ptr< IMemoryAllocator< T >> allocator, std::weak_ptr< Connector< MemoryData< T >>> memoryManagerConnector, std::string memoryManagerName, MMType type)
Creates MemoryData with the specified IMemoryAllocator.
Definition: MemoryData.hpp:77
void setMemoryReleaseRule(IMemoryReleaseRule *rule)
Sets the memory release rule.
Definition: MemoryData.hpp:150
IMemoryReleaseRule * getMemoryReleaseRule() const
Gets the memory release rule associated with the memory data.
Definition: MemoryData.hpp:162
Definition: Bookkeeper.hpp:23
std::string memoryManagerName
The name of the memory manager that allocated the memory.
Definition: MemoryData.hpp:295
void setPipelineId(size_t id)
Sets the pipelineId associated with the MemoryManager that allocated the memory.
Definition: MemoryData.hpp:132
Defines how memory is allocated and freed.