MFEM
v4.4.0
Finite element discretization library
|
#include <mem_manager.hpp>
Public Member Functions | |
MemoryManager () | |
~MemoryManager () | |
void | Init () |
Initialize the memory manager. More... | |
void | Configure (const MemoryType h_mt, const MemoryType d_mt) |
Configure the Memory manager with given default host and device types. This method will be called when configuring a device. More... | |
void | Destroy () |
Free all the device memories. More... | |
bool | IsKnown (const void *h_ptr) |
Return true if the pointer is known by the memory manager. More... | |
bool | IsAlias (const void *h_ptr) |
Return true if the pointer is known by the memory manager as an alias. More... | |
void | RegisterCheck (void *h_ptr) |
Check if the host pointer has been registered in the memory manager. More... | |
int | PrintPtrs (std::ostream &out=mfem::out) |
int | PrintAliases (std::ostream &out=mfem::out) |
Static Public Member Functions | |
static MemoryType | GetDualMemoryType (MemoryType mt) |
Return the dual MemoryType of the given one, mt. More... | |
static void | SetDualMemoryType (MemoryType mt, MemoryType dual_mt) |
Set the dual memory type of mt to be dual_mt. More... | |
static void | SetUmpireHostAllocatorName (const char *h_name) |
Set the host Umpire allocator name used with MemoryType::HOST_UMPIRE. More... | |
static void | SetUmpireDeviceAllocatorName (const char *d_name) |
Set the device Umpire allocator name used with MemoryType::DEVICE_UMPIRE. More... | |
static void | SetUmpireDevice2AllocatorName (const char *d_name) |
Set the device Umpire allocator name used with MemoryType::DEVICE_UMPIRE_2. More... | |
static const char * | GetUmpireHostAllocatorName () |
Get the host Umpire allocator name used with MemoryType::HOST_UMPIRE. More... | |
static const char * | GetUmpireDeviceAllocatorName () |
Get the device Umpire allocator name used with MemoryType::DEVICE_UMPIRE. More... | |
static const char * | GetUmpireDevice2AllocatorName () |
Get the device Umpire allocator name used with MemoryType::DEVICE_UMPIRE_2. More... | |
static MemoryType | GetHostMemoryType () |
static MemoryType | GetDeviceMemoryType () |
Friends | |
template<typename T > | |
class | Memory |
The MFEM memory manager class. Host-side pointers are inserted into this manager which keeps track of the associated device pointer, and where the data currently resides.
Definition at line 556 of file mem_manager.hpp.
mfem::MemoryManager::MemoryManager | ( | ) |
Definition at line 1519 of file mem_manager.cpp.
mfem::MemoryManager::~MemoryManager | ( | ) |
Definition at line 1521 of file mem_manager.cpp.
void mfem::MemoryManager::Configure | ( | const MemoryType | h_mt, |
const MemoryType | d_mt | ||
) |
Configure the Memory manager with given default host and device types. This method will be called when configuring a device.
The host and device MemoryTypes, h_mt and d_mt, are set to be dual to each other.
Definition at line 1554 of file mem_manager.cpp.
void mfem::MemoryManager::Destroy | ( | ) |
Free all the device memories.
Definition at line 1573 of file mem_manager.cpp.
|
inlinestatic |
Definition at line 805 of file mem_manager.hpp.
|
inlinestatic |
Return the dual MemoryType of the given one, mt.
The default dual memory types are:
memory type | dual type |
---|---|
HOST | DEVICE |
HOST_32 | DEVICE |
HOST_64 | DEVICE |
HOST_DEBUG | DEVICE_DEBUG |
HOST_UMPIRE | DEVICE_UMPIRE |
HOST_PINNED | DEVICE |
MANAGED | MANAGED |
DEVICE | HOST |
DEVICE_DEBUG | HOST_DEBUG |
DEVICE_UMPIRE | HOST_UMPIRE |
DEVICE_UMPIRE_2 | HOST_UMPIRE |
The dual types can be modified before device configuration using the method SetDualMemoryType() or by calling Device::SetMemoryTypes().
Definition at line 748 of file mem_manager.hpp.
|
inlinestatic |
Definition at line 804 of file mem_manager.hpp.
|
inlinestatic |
Get the device Umpire allocator name used with MemoryType::DEVICE_UMPIRE_2.
Definition at line 781 of file mem_manager.hpp.
|
inlinestatic |
Get the device Umpire allocator name used with MemoryType::DEVICE_UMPIRE.
Definition at line 779 of file mem_manager.hpp.
|
inlinestatic |
Get the host Umpire allocator name used with MemoryType::HOST_UMPIRE.
Definition at line 777 of file mem_manager.hpp.
void mfem::MemoryManager::Init | ( | ) |
Initialize the memory manager.
Definition at line 1510 of file mem_manager.cpp.
|
inline |
Return true if the pointer is known by the memory manager as an alias.
Definition at line 791 of file mem_manager.hpp.
|
inline |
Return true if the pointer is known by the memory manager.
Definition at line 788 of file mem_manager.hpp.
int mfem::MemoryManager::PrintAliases | ( | std::ostream & | out = mfem::out | ) |
Prints all aliases known by the memory manager returning the number of printed pointers
Definition at line 1634 of file mem_manager.cpp.
int mfem::MemoryManager::PrintPtrs | ( | std::ostream & | out = mfem::out | ) |
Prints all pointers known by the memory manager, returning the number of printed pointers
Definition at line 1619 of file mem_manager.cpp.
void mfem::MemoryManager::RegisterCheck | ( | void * | h_ptr | ) |
Check if the host pointer has been registered in the memory manager.
Definition at line 1608 of file mem_manager.cpp.
|
static |
Set the dual memory type of mt to be dual_mt.
This method can only be called before configuration, i.e. before calling Configure(), which is typically done during Device construction.
One of the types must be a host MemoryType and the other must be a device MemoryType or both types must be the same host memory type. The latter case is only allowed for convenience in setting up pure host execution, so the actual dual is not updated.
Definition at line 1523 of file mem_manager.cpp.
|
inlinestatic |
Set the device Umpire allocator name used with MemoryType::DEVICE_UMPIRE_2.
Definition at line 774 of file mem_manager.hpp.
|
inlinestatic |
Set the device Umpire allocator name used with MemoryType::DEVICE_UMPIRE.
Definition at line 772 of file mem_manager.hpp.
|
inlinestatic |
Set the host Umpire allocator name used with MemoryType::HOST_UMPIRE.
Definition at line 770 of file mem_manager.hpp.
|
friend |
Definition at line 563 of file mem_manager.hpp.