Allocates workspace blocks for host and GPU devices.
More...
#include <Memory.hh>
|
| Memory (size_t block_size) |
| Construct saves block size, but does not allocate any memory.
|
|
| ~Memory () |
| Destructor frees all allocations on host and devices.
|
|
void | addHostBlocks (int64_t num_blocks) |
|
void | addDeviceBlocks (int device, int64_t num_blocks, blas::Queue *queue) |
| Allocates num_blocks in given device's memory and adds them to the pool of free blocks.
|
|
void | clearHostBlocks () |
|
void | clearDeviceBlocks (int device, blas::Queue *queue) |
| Empties the pool of free blocks of given device's memory and frees the allocations.
|
|
void * | alloc (int device, size_t size, blas::Queue *queue) |
|
void | free (void *block, int device) |
| Puts a single block of memory back into the pool of free blocks for the given device, which can be host.
|
|
size_t | available (int device) const |
|
size_t | capacity (int device) const |
|
size_t | allocated (int device) const |
|
|
static struct slate::Memory::StaticConstructor | static_constructor_ |
|
static int | num_devices_ |
|
Allocates workspace blocks for host and GPU devices.
Currently assumes a fixed-size block of block_size bytes, e.g., block_size = sizeof(scalar_t) * mb * nb.
◆ alloc()
void * slate::Memory::alloc |
( |
int |
device, |
|
|
size_t |
size, |
|
|
blas::Queue * |
queue |
|
) |
| |
- Returns
- single block of memory on the given device, which can be host, either from free blocks or by allocating a new block.
◆ allocated()
size_t slate::Memory::allocated |
( |
int |
device | ) |
const |
|
inline |
- Returns
- total number of allocated blocks from device's memory pool, which can be host.
◆ available()
size_t slate::Memory::available |
( |
int |
device | ) |
const |
|
inline |
- Returns
- number of available free blocks in device's memory pool, which can be host.
◆ capacity()
size_t slate::Memory::capacity |
( |
int |
device | ) |
const |
|
inline |
- Returns
- total number of blocks in device's memory pool, which can be host.
The documentation for this class was generated from the following files:
- include/slate/internal/Memory.hh
- src/core/Memory.cc