(git:e966546)
Loading...
Searching...
No Matches
offload_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 OFFLOAD_MEMPOOL_H
8#define OFFLOAD_MEMPOOL_H
9
10#include <stddef.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#include <stdint.h>
17
18/*******************************************************************************
19 * \brief Internal routine for allocating host memory from the pool.
20 * \author Ole Schuett
21 ******************************************************************************/
22void *offload_mempool_host_malloc(size_t size);
23
24/*******************************************************************************
25 * \brief Internal routine for allocating device memory from the pool.
26 * \author Ole Schuett
27 ******************************************************************************/
28void *offload_mempool_device_malloc(size_t size);
29
30/*******************************************************************************
31 * \brief Internal routine for releasing memory back to the pool.
32 * \author Ole Schuett
33 ******************************************************************************/
34void offload_mempool_host_free(const void *memory);
35
36/*******************************************************************************
37 * \brief Internal routine for releasing memory back to the pool.
38 * \author Ole Schuett
39 ******************************************************************************/
40void offload_mempool_device_free(const void *memory);
41
42/*******************************************************************************
43 * \brief Internal routine for freeing all memory in the pool.
44 * \author Ole Schuett
45 ******************************************************************************/
46void offload_mempool_clear(void);
47
48/*******************************************************************************
49 * \brief Internal struct for pool statistics.
50 * \author Hans Pabst
51 ******************************************************************************/
53 // Memory used out of consumed.
55 // Memory consumption.
57 // Number of allocations.
60
61/*******************************************************************************
62 * \brief Internal routine to query statistics.
63 * \author Hans Pabst
64 ******************************************************************************/
66
67/*******************************************************************************
68 * \brief Print allocation statistics.
69 * \author Hans Pabst
70 ******************************************************************************/
71void offload_mempool_stats_print(int fortran_comm,
72 void (*print_func)(const char *, int, int),
73 int output_unit);
74
75#ifdef __cplusplus
76}
77#endif
78
79#endif
80
81// EOF
static void print_func(const char *msg, int, int output_unit)
Wrapper for printf, passed to dbm_library_print_stats.
Definition dbm_miniapp.c:29
subroutine, public offload_mempool_stats_print(mpi_comm, output_unit)
Print allocation statistics.
void offload_mempool_host_free(const void *memory)
Internal routine for releasing memory back to the pool.
void offload_mempool_clear(void)
Internal routine for freeing all memory in the pool.
void offload_mempool_device_free(const void *memory)
Internal routine for releasing memory back to the pool.
void offload_mempool_stats_get(offload_mempool_stats_t *memstats)
Internal routine to query statistics.
void * offload_mempool_device_malloc(size_t size)
Internal routine for allocating device memory from the pool.
void * offload_mempool_host_malloc(size_t size)
Internal routine for allocating host memory from the pool.
Internal struct for pool statistics.