Memory resource management for CPUs and accelerators. More...
Public Member Functions | |
| IMemoryAllocator * | getAllocator (eMemoryResource r) override |
| Memory allocator for resource r. | |
| IMemoryAllocator * | getAllocator (eMemoryResource r, bool throw_if_not_found) override |
| Memory allocator for resource r. | |
| IMemoryPool * | getMemoryPoolOrNull (eMemoryResource r) override |
| Memory pool for resource r. | |
| void | copy (ConstMemoryView from, eMemoryResource from_mem, MutableMemoryView to, eMemoryResource to_mem, const RunQueue *queue) override |
| void | setAllocator (eMemoryResource r, IMemoryAllocator *allocator) override |
| Sets the allocator for resource r. | |
| void | setMemoryPool (eMemoryResource r, IMemoryPool *pool) override |
| Sets the memory pool for resource r. | |
| void | setCopier (IMemoryCopier *copier) override |
| Sets the copying instance. | |
| void | setIsAccelerator (bool v) override |
| Indicates if an accelerator is available. | |
| IMemoryResourceMngInternal * | _internal () override |
| Internal interface. | |
Static Public Member Functions | |
| static void | genericCopy (ConstMemoryView from, MutableMemoryView to) |
| Generic copy using platform::getDataMemoryRessourceMng(). | |
Private Member Functions | |
| int | _checkValidResource (eMemoryResource r) |
Private Attributes | |
| FixedArray< IMemoryAllocator *, ARCCORE_NB_MEMORY_RESOURCE > | m_allocators |
| List of allocators. | |
| FixedArray< IMemoryPool *, ARCCORE_NB_MEMORY_RESOURCE > | m_memory_pools |
| List of memory pools. | |
| std::unique_ptr< IMemoryCopier > | m_default_memory_copier |
| IMemoryCopier * | m_copier = nullptr |
| bool | m_is_accelerator = false |
Memory resource management for CPUs and accelerators.
Definition at line 37 of file MemoryResourceMng.h.
| Arcane::MemoryResourceMng::MemoryResourceMng | ( | ) |
Definition at line 76 of file MemoryResourceMng.cc.
|
inlineprivate |
Definition at line 90 of file MemoryResourceMng.cc.
|
inlineoverridevirtual |
Internal interface.
Implements Arcane::IMemoryResourceMng.
Definition at line 66 of file MemoryResourceMng.h.
|
overridevirtual |
Implements Arcane::IMemoryResourceMngInternal.
Definition at line 167 of file MemoryResourceMng.cc.
|
static |
Generic copy using platform::getDataMemoryRessourceMng().
Definition at line 182 of file MemoryResourceMng.cc.
References Arcane::IMemoryResourceMng::_internal(), Arcane::MemoryUtils::getDataMemoryResourceMng(), and Arcane::Unknown.
Referenced by Arcane::MessagePassing::SharedMemoryMessageRequest::copyFromSender().
|
overridevirtual |
Memory allocator for resource r.
Throws an exception if no allocator for resource v exists.
Implements Arcane::IMemoryResourceMng.
Definition at line 128 of file MemoryResourceMng.cc.
References getAllocator().
Referenced by getAllocator().
|
overridevirtual |
Memory allocator for resource r.
If no allocator for resource v exists, throws an exception if throw_if_not_found is true or returns nullptr if throw_if_not_found is false.
Implements Arcane::IMemoryResourceMng.
Definition at line 102 of file MemoryResourceMng.cc.
References ARCCORE_FATAL, Arcane::MemoryUtils::getDefaultDataMemoryResource(), Arcane::Host, Arcane::HostPinned, m_allocators, and Arcane::UnifiedMemory.
|
overridevirtual |
Memory pool for resource r.
Returns the memory pool associated with resource v or nullptr if there is none.
Implements Arcane::IMemoryResourceMng.
Definition at line 137 of file MemoryResourceMng.cc.
References m_memory_pools.
|
overridevirtual |
Sets the allocator for resource r.
Implements Arcane::IMemoryResourceMngInternal.
Definition at line 147 of file MemoryResourceMng.cc.
References m_allocators.
|
inlineoverridevirtual |
Sets the copying instance.
Implements Arcane::IMemoryResourceMngInternal.
Definition at line 60 of file MemoryResourceMng.h.
|
inlineoverridevirtual |
Indicates if an accelerator is available.
Implements Arcane::IMemoryResourceMngInternal.
Definition at line 61 of file MemoryResourceMng.h.
|
overridevirtual |
Sets the memory pool for resource r.
Implements Arcane::IMemoryResourceMngInternal.
Definition at line 157 of file MemoryResourceMng.cc.
References m_memory_pools.
|
private |
List of allocators.
Definition at line 76 of file MemoryResourceMng.h.
Referenced by getAllocator(), and setAllocator().
|
private |
Definition at line 80 of file MemoryResourceMng.h.
|
private |
Definition at line 79 of file MemoryResourceMng.h.
|
private |
Definition at line 81 of file MemoryResourceMng.h.
|
private |
List of memory pools.
Definition at line 78 of file MemoryResourceMng.h.
Referenced by getMemoryPoolOrNull(), and setMemoryPool().