(git:d18deda)
Loading...
Searching...
No Matches
dbm_mempool.h
Go to the documentation of this file.
1/*----------------------------------------------------------------------------*/
2/* CP2K: A general program to perform molecular dynamics simulations */
3/* Copyright 2000-2025 CP2K developers group <https://cp2k.org> */
4/* */
5/* SPDX-License-Identifier: BSD-3-Clause */
6/*----------------------------------------------------------------------------*/
7#ifndef DBM_MEMPOOL_H
8#define DBM_MEMPOOL_H
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14#include <stdint.h>
15
16/*******************************************************************************
17 * \brief Internal routine for allocating host memory from the pool.
18 * \author Ole Schuett
19 ******************************************************************************/
20void *dbm_mempool_host_malloc(size_t size);
21
22/*******************************************************************************
23 * \brief Internal routine for allocating device memory from the pool.
24 * \author Ole Schuett
25 ******************************************************************************/
26void *dbm_mempool_device_malloc(size_t size);
27
28/*******************************************************************************
29 * \brief Internal routine for releasing memory back to the pool.
30 * \author Ole Schuett
31 ******************************************************************************/
32void dbm_mempool_host_free(const void *memory);
33
34/*******************************************************************************
35 * \brief Internal routine for releasing memory back to the pool.
36 * \author Ole Schuett
37 ******************************************************************************/
38void dbm_mempool_device_free(const void *memory);
39
40/*******************************************************************************
41 * \brief Internal routine for freeing all memory in the pool.
42 * \author Ole Schuett
43 ******************************************************************************/
44void dbm_mempool_clear(void);
45
46/*******************************************************************************
47 * \brief Internal struct for pool statistics.
48 * \author Hans Pabst
49 ******************************************************************************/
50typedef struct dbm_memstats_t {
51 // Memory used out of consumed.
53 // Memory consumption.
55 // Number of allocations.
58
59/*******************************************************************************
60 * \brief Internal routine to query statistics.
61 * \author Hans Pabst
62 ******************************************************************************/
64
65#ifdef __cplusplus
66}
67#endif
68
69#endif
70
71// EOF
void dbm_mempool_device_free(const void *memory)
Internal routine for releasing memory back to the pool.
void dbm_mempool_statistics(dbm_memstats_t *memstats)
Internal routine to query statistics.
void dbm_mempool_host_free(const void *memory)
Internal routine for releasing memory back to the pool.
void dbm_mempool_clear(void)
Internal routine for freeing all memory in the pool.
void * dbm_mempool_host_malloc(size_t size)
Internal routine for allocating host memory from the pool.
void * dbm_mempool_device_malloc(size_t size)
Internal routine for allocating device memory from the pool.
Internal struct for pool statistics.
Definition dbm_mempool.h:50
uint64_t host_size
Definition dbm_mempool.h:54
uint64_t device_used
Definition dbm_mempool.h:52
uint64_t host_mallocs
Definition dbm_mempool.h:56
uint64_t host_used
Definition dbm_mempool.h:52
uint64_t device_mallocs
Definition dbm_mempool.h:56
uint64_t device_size
Definition dbm_mempool.h:54