FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
FEAT::MemoryPool Class Reference

Memory management. More...

#include <memory_pool.hpp>

Static Public Member Functions

template<typename DT_ >
static DT_ * allocate_memory (Index count)
 allocate new memory More...
 
static Index allocated_memory ()
 
static Index allocated_size (void *address)
 
template<typename DT1_ , typename DT2_ >
static void convert (DT1_ *dest, const DT2_ *src, const Index count)
 Convert datatype DT2_ from src into DT1_ in dest. More...
 
template<typename DT_ >
static void convert (DT_ *dest, const DT_ *src, const Index count)
 Copy memory area from src to dest. More...
 
template<typename DT_ >
static void copy (DT_ *dest, const DT_ *src, const Index count)
 Copy memory area from src to dest. More...
 
template<typename DT_ >
static void download (DT_ *dest, const DT_ *const src, const Index count)
 download memory chunk to host memory More...
 
static void finalize ()
 Shutdown memory pool and clean up allocated memory pools. More...
 
template<typename DT_ >
static const DT_ & get_element (const DT_ *data, const Index index)
 receive element More...
 
static void increase_memory (void *address)
 increase memory counter More...
 
static void initialize ()
 Setup memory pools. More...
 
static void release_memory (void *address)
 release memory or decrease reference counter More...
 
template<typename DT_ >
static void set_memory (DT_ *address, const DT_ val, const Index count=1)
 set memory to specific value More...
 
template<typename DT_ >
static void set_memory (Random &rng, DT_ min, DT_ max, DT_ *address, const Index count=1)
 set memory to specific value More...
 
static NOINLINE void synchronize ()
 
template<typename DT_ >
static void upload (DT_ *dest, const DT_ *const src, const Index count)
 upload memory chunk from host memory to device memory More...
 

Static Private Attributes

static std::map< void *, Util::Intern::MemoryInfo > _pool
 Map of all memory chunks in use. More...
 

Detailed Description

Memory management.

This class manages the used memory chunks and releases them, if necessary.

Author
Dirk Ribbrock

Definition at line 53 of file memory_pool.hpp.

Member Function Documentation

◆ allocate_memory()

template<typename DT_ >
static DT_ * FEAT::MemoryPool::allocate_memory ( Index  count)
inlinestatic

allocate new memory

Definition at line 82 of file memory_pool.hpp.

References _pool, and XABORTM.

◆ allocated_memory()

static Index FEAT::MemoryPool::allocated_memory ( )
inlinestatic

Definition at line 324 of file memory_pool.hpp.

◆ allocated_size()

static Index FEAT::MemoryPool::allocated_size ( void *  address)
inlinestatic

Definition at line 334 of file memory_pool.hpp.

◆ convert() [1/2]

template<typename DT1_ , typename DT2_ >
static void FEAT::MemoryPool::convert ( DT1_ *  dest,
const DT2_ *  src,
const Index  count 
)
inlinestatic

Convert datatype DT2_ from src into DT1_ in dest.

Definition at line 290 of file memory_pool.hpp.

References FEAT::cuda, FEAT::generic, and FEAT::Backend::get_preferred_backend().

◆ convert() [2/2]

template<typename DT_ >
static void FEAT::MemoryPool::convert ( DT_ *  dest,
const DT_ *  src,
const Index  count 
)
inlinestatic

Copy memory area from src to dest.

Definition at line 272 of file memory_pool.hpp.

Referenced by FEAT::LAFEM::Container< DT_, IT_ >::assign().

◆ copy()

◆ download()

template<typename DT_ >
static void FEAT::MemoryPool::download ( DT_ *  dest,
const DT_ *const  src,
const Index  count 
)
inlinestatic

download memory chunk to host memory

Definition at line 156 of file memory_pool.hpp.

◆ finalize()

static void FEAT::MemoryPool::finalize ( )
inlinestatic

Shutdown memory pool and clean up allocated memory pools.

Definition at line 67 of file memory_pool.hpp.

References _pool.

Referenced by FEAT::Runtime::finalize().

◆ get_element()

template<typename DT_ >
static const DT_ & FEAT::MemoryPool::get_element ( const DT_ *  data,
const Index  index 
)
inlinestatic

receive element

Definition at line 178 of file memory_pool.hpp.

◆ increase_memory()

◆ initialize()

static void FEAT::MemoryPool::initialize ( )
inlinestatic

Setup memory pools.

Definition at line 62 of file memory_pool.hpp.

Referenced by FEAT::Runtime::initialize().

◆ release_memory()

◆ set_memory() [1/2]

◆ set_memory() [2/2]

template<typename DT_ >
static void FEAT::MemoryPool::set_memory ( Random rng,
DT_  min,
DT_  max,
DT_ *  address,
const Index  count = 1 
)
inlinestatic

set memory to specific value

Definition at line 211 of file memory_pool.hpp.

References FEAT::cuda, FEAT::generic, and FEAT::Backend::get_preferred_backend().

◆ synchronize()

static NOINLINE void FEAT::MemoryPool::synchronize ( )
inlinestatic

Definition at line 315 of file memory_pool.hpp.

◆ upload()

template<typename DT_ >
static void FEAT::MemoryPool::upload ( DT_ *  dest,
const DT_ *const  src,
const Index  count 
)
inlinestatic

upload memory chunk from host memory to device memory

Definition at line 167 of file memory_pool.hpp.

Member Data Documentation

◆ _pool

std::map< void *, FEAT::Util::Intern::MemoryInfo > FEAT::MemoryPool::_pool
staticprivate

Map of all memory chunks in use.

Definition at line 57 of file memory_pool.hpp.

Referenced by allocate_memory(), finalize(), increase_memory(), and release_memory().


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