QUDA  1.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Functions | Variables
quda::pool Namespace Reference

Functions

void init ()
 Initialize the memory pool allocator. More...
 
void * device_malloc_ (const char *func, const char *file, int line, size_t size)
 Allocate device-memory. If free pre-existing allocation exists reuse this. More...
 
void device_free_ (const char *func, const char *file, int line, void *ptr)
 Virtual free of pinned-memory allocation. More...
 
void * pinned_malloc_ (const char *func, const char *file, int line, size_t size)
 Allocate pinned-memory. If a free pre-existing allocation exists reuse this. More...
 
void pinned_free_ (const char *func, const char *file, int line, void *ptr)
 Virtual free of pinned-memory allocation. More...
 
void flush_device ()
 Free all outstanding device-memory allocations. More...
 
void flush_pinned ()
 Free all outstanding pinned-memory allocations. More...
 

Variables

static std::multimap< size_t, void * > pinnedCache
 
static std::map< void *, size_t > pinnedSize
 
static std::multimap< size_t, void * > deviceCache
 
static std::map< void *, size_t > deviceSize
 
static bool pool_init = false
 
static bool device_memory_pool = true
 
static bool pinned_memory_pool = true
 

Function Documentation

◆ device_free_()

void quda::pool::device_free_ ( const char *  func,
const char *  file,
int  line,
void *  ptr 
)

Virtual free of pinned-memory allocation.

Parameters
ptrPointer to be (virtually) freed

Definition at line 553 of file malloc.cpp.

References quda::device_free_(), and errorQuda.

Here is the call graph for this function:

◆ device_malloc_()

void * quda::pool::device_malloc_ ( const char *  func,
const char *  file,
int  line,
size_t  size 
)

Allocate device-memory. If free pre-existing allocation exists reuse this.

Parameters
sizeSize of allocation
Returns
Pointer to allocated memory

Definition at line 524 of file malloc.cpp.

References quda::device_free_(), quda::device_malloc_(), and quda::it.

Here is the call graph for this function:

◆ flush_device()

void quda::pool::flush_device ( )

Free all outstanding device-memory allocations.

Definition at line 578 of file malloc.cpp.

References device_free, and quda::it.

Referenced by endQuda().

Here is the caller graph for this function:

◆ flush_pinned()

void quda::pool::flush_pinned ( )

Free all outstanding pinned-memory allocations.

Definition at line 566 of file malloc.cpp.

References host_free, and quda::it.

Referenced by endQuda().

Here is the caller graph for this function:

◆ init()

void quda::pool::init ( )

Initialize the memory pool allocator.

Definition at line 457 of file malloc.cpp.

References warningQuda.

Referenced by initQudaMemory().

Here is the caller graph for this function:

◆ pinned_free_()

void quda::pool::pinned_free_ ( const char *  func,
const char *  file,
int  line,
void *  ptr 
)

Virtual free of pinned-memory allocation.

Parameters
ptrPointer to be (virtually) freed

Definition at line 511 of file malloc.cpp.

References errorQuda, and quda::host_free_().

Here is the call graph for this function:

◆ pinned_malloc_()

void * quda::pool::pinned_malloc_ ( const char *  func,
const char *  file,
int  line,
size_t  size 
)

Allocate pinned-memory. If a free pre-existing allocation exists reuse this.

Parameters
sizeSize of allocation
Returns
Pointer to allocated memory

Definition at line 482 of file malloc.cpp.

References host_free, quda::it, and quda::pinned_malloc_().

Here is the call graph for this function:

Variable Documentation

◆ device_memory_pool

bool quda::pool::device_memory_pool = true
static

whether to use a memory pool allocator for device memory

Definition at line 452 of file malloc.cpp.

◆ deviceCache

std::multimap<size_t, void *> quda::pool::deviceCache
static

Cache of inactive device-memory allocations. We cache pinned memory allocations so that fields can reuse these with minimal overhead.

Definition at line 442 of file malloc.cpp.

◆ deviceSize

std::map<void *, size_t> quda::pool::deviceSize
static

Sizes of active device-memory allocations. For convenience, we keep track of the sizes of active allocations (i.e., those not in the cache).

Definition at line 447 of file malloc.cpp.

◆ pinned_memory_pool

bool quda::pool::pinned_memory_pool = true
static

whether to use a memory pool allocator for pinned memory

Definition at line 455 of file malloc.cpp.

◆ pinnedCache

std::multimap<size_t, void *> quda::pool::pinnedCache
static

Cache of inactive pinned-memory allocations. We cache pinned memory allocations so that fields can reuse these with minimal overhead.

Definition at line 432 of file malloc.cpp.

◆ pinnedSize

std::map<void *, size_t> quda::pool::pinnedSize
static

Sizes of active pinned-memory allocations. For convenience, we keep track of the sizes of active allocations (i.e., those not in the cache).

Definition at line 437 of file malloc.cpp.

◆ pool_init

bool quda::pool::pool_init = false
static

Definition at line 449 of file malloc.cpp.