![]() |
(git:419edc0)
|
#include <assert.h>
#include <omp.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../offload/offload_library.h"
#include "../offload/offload_runtime.h"
#include "dbm_hyperparams.h"
#include "dbm_mempool.h"
#include "dbm_mpi.h"
Go to the source code of this file.
Data Structures | |
struct | dbm_memchunk |
Private struct for storing a chunk of memory. More... | |
Macros | |
#define | DBM_MEMPOOL_OFFLOAD_ENABLED 0 |
#define | DBM_MEMPOOL_DEVICE_ENABLED (DBM_MEMPOOL_DEVICE && DBM_MEMPOOL_OFFLOAD_ENABLED) |
#define | DBM_MEMPOOL_HOST_ENABLED |
Typedefs | |
typedef struct dbm_memchunk | dbm_memchunk_t |
Private struct for storing a chunk of memory. | |
Functions | |
static void * | actual_malloc (size_t size, bool on_device) |
Private routine for actually allocating system memory. | |
static void | actual_free (const void *memory, bool on_device) |
Private routine for actually freeing system memory. | |
void * | dbm_mempool_host_malloc (size_t size) |
Private routine for allocating host or device memory from the pool. | |
void * | dbm_mempool_device_malloc (size_t size) |
Internal routine for allocating device memory from the pool. | |
void | dbm_mempool_host_free (const void *memory) |
Private routine for releasing memory back to the pool. | |
void | dbm_mempool_device_free (const void *memory) |
Internal routine for releasing memory back to the pool. | |
void | dbm_mempool_clear (void) |
Private routine for freeing all memory in the pool. | |
void | dbm_mempool_statistics (dbm_memstats_t *memstats) |
Internal routine to query statistics. | |
Variables | |
static dbm_memstats_t | mempool_stats = {0} |
Private single-linked lists of memory chunks available and allocated. | |
#define DBM_MEMPOOL_OFFLOAD_ENABLED 0 |
Definition at line 25 of file dbm_mempool.c.
#define DBM_MEMPOOL_DEVICE_ENABLED (DBM_MEMPOOL_DEVICE && DBM_MEMPOOL_OFFLOAD_ENABLED) |
Definition at line 27 of file dbm_mempool.c.
#define DBM_MEMPOOL_HOST_ENABLED |
Definition at line 29 of file dbm_mempool.c.
typedef struct dbm_memchunk dbm_memchunk_t |
Private struct for storing a chunk of memory.
|
static |
Private routine for actually allocating system memory.
Definition at line 71 of file dbm_mempool.c.
|
static |
Private routine for actually freeing system memory.
Definition at line 109 of file dbm_mempool.c.
void * dbm_mempool_host_malloc | ( | size_t | size | ) |
Private routine for allocating host or device memory from the pool.
Internal routine for allocating host memory from the pool.
Internal routine for allocating host memory from the pool.
Definition at line 204 of file dbm_mempool.c.
void * dbm_mempool_device_malloc | ( | size_t | size | ) |
Internal routine for allocating device memory from the pool.
Definition at line 217 of file dbm_mempool.c.
void dbm_mempool_host_free | ( | const void * | memory | ) |
Private routine for releasing memory back to the pool.
Internal routine for releasing memory back to the pool.
Internal routine for releasing memory back to the pool.
Definition at line 261 of file dbm_mempool.c.
void dbm_mempool_device_free | ( | const void * | memory | ) |
Internal routine for releasing memory back to the pool.
Definition at line 274 of file dbm_mempool.c.
void dbm_mempool_clear | ( | void | ) |
Private routine for freeing all memory in the pool.
Internal routine for freeing all memory in the pool.
Internal routine for freeing all memory in the pool.
Definition at line 314 of file dbm_mempool.c.
void dbm_mempool_statistics | ( | dbm_memstats_t * | memstats | ) |
Internal routine to query statistics.
Definition at line 332 of file dbm_mempool.c.
|
static |
Private single-linked lists of memory chunks available and allocated.
Private single-linked lists of memory chunks available and allocated.
Private statistics.
Definition at line 65 of file dbm_mempool.c.