Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::MemoryResourceMng Class Reference

Memory resource management for CPUs and accelerators. More...

#include </__w/arcaneframework.github.io/arcaneframework.github.io/framework/arccore/src/common/arccore/common/internal/MemoryResourceMng.h>

Inheritance diagram for Arcane::MemoryResourceMng:
Collaboration diagram for Arcane::MemoryResourceMng:

Public Member Functions

IMemoryAllocatorgetAllocator (eMemoryResource r) override
 Memory allocator for resource r.
IMemoryAllocatorgetAllocator (eMemoryResource r, bool throw_if_not_found) override
 Memory allocator for resource r.
IMemoryPoolgetMemoryPoolOrNull (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< IMemoryCopierm_default_memory_copier
IMemoryCopierm_copier = nullptr
bool m_is_accelerator = false

Detailed Description

Memory resource management for CPUs and accelerators.

Definition at line 37 of file MemoryResourceMng.h.

Constructor & Destructor Documentation

◆ MemoryResourceMng()

Arcane::MemoryResourceMng::MemoryResourceMng ( )

Definition at line 76 of file MemoryResourceMng.cc.

Member Function Documentation

◆ _checkValidResource()

int Arcane::MemoryResourceMng::_checkValidResource ( eMemoryResource r)
inlineprivate

Definition at line 90 of file MemoryResourceMng.cc.

◆ _internal()

IMemoryResourceMngInternal * Arcane::MemoryResourceMng::_internal ( )
inlineoverridevirtual

Internal interface.

Implements Arcane::IMemoryResourceMng.

Definition at line 66 of file MemoryResourceMng.h.

◆ copy()

void Arcane::MemoryResourceMng::copy ( ConstMemoryView from,
eMemoryResource from_mem,
MutableMemoryView to,
eMemoryResource to_mem,
const RunQueue * queue )
overridevirtual

Implements Arcane::IMemoryResourceMngInternal.

Definition at line 167 of file MemoryResourceMng.cc.

◆ genericCopy()

void Arcane::MemoryResourceMng::genericCopy ( ConstMemoryView from,
MutableMemoryView to )
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAllocator() [1/2]

IMemoryAllocator * Arcane::MemoryResourceMng::getAllocator ( eMemoryResource r)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAllocator() [2/2]

IMemoryAllocator * Arcane::MemoryResourceMng::getAllocator ( eMemoryResource r,
bool throw_if_not_found )
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.

Here is the call graph for this function:

◆ getMemoryPoolOrNull()

IMemoryPool * Arcane::MemoryResourceMng::getMemoryPoolOrNull ( eMemoryResource r)
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.

◆ setAllocator()

void Arcane::MemoryResourceMng::setAllocator ( eMemoryResource r,
IMemoryAllocator * allocator )
overridevirtual

Sets the allocator for resource r.

Implements Arcane::IMemoryResourceMngInternal.

Definition at line 147 of file MemoryResourceMng.cc.

References m_allocators.

◆ setCopier()

void Arcane::MemoryResourceMng::setCopier ( IMemoryCopier * copier)
inlineoverridevirtual

Sets the copying instance.

Implements Arcane::IMemoryResourceMngInternal.

Definition at line 60 of file MemoryResourceMng.h.

◆ setIsAccelerator()

void Arcane::MemoryResourceMng::setIsAccelerator ( bool v)
inlineoverridevirtual

Indicates if an accelerator is available.

Implements Arcane::IMemoryResourceMngInternal.

Definition at line 61 of file MemoryResourceMng.h.

◆ setMemoryPool()

void Arcane::MemoryResourceMng::setMemoryPool ( eMemoryResource r,
IMemoryPool * pool )
overridevirtual

Sets the memory pool for resource r.

Implements Arcane::IMemoryResourceMngInternal.

Definition at line 157 of file MemoryResourceMng.cc.

References m_memory_pools.

Member Data Documentation

◆ m_allocators

FixedArray<IMemoryAllocator*, ARCCORE_NB_MEMORY_RESOURCE> Arcane::MemoryResourceMng::m_allocators
private

List of allocators.

Definition at line 76 of file MemoryResourceMng.h.

Referenced by getAllocator(), and setAllocator().

◆ m_copier

IMemoryCopier* Arcane::MemoryResourceMng::m_copier = nullptr
private

Definition at line 80 of file MemoryResourceMng.h.

◆ m_default_memory_copier

std::unique_ptr<IMemoryCopier> Arcane::MemoryResourceMng::m_default_memory_copier
private

Definition at line 79 of file MemoryResourceMng.h.

◆ m_is_accelerator

bool Arcane::MemoryResourceMng::m_is_accelerator = false
private

Definition at line 81 of file MemoryResourceMng.h.

◆ m_memory_pools

FixedArray<IMemoryPool*, ARCCORE_NB_MEMORY_RESOURCE> Arcane::MemoryResourceMng::m_memory_pools
private

List of memory pools.

Definition at line 78 of file MemoryResourceMng.h.

Referenced by getMemoryPoolOrNull(), and setMemoryPool().


The documentation for this class was generated from the following files: