(git:374b731)
Loading...
Searching...
No Matches
grid_library.h
Go to the documentation of this file.
1/*----------------------------------------------------------------------------*/
2/* CP2K: A general program to perform molecular dynamics simulations */
3/* Copyright 2000-2024 CP2K developers group <https://cp2k.org> */
4/* */
5/* SPDX-License-Identifier: BSD-3-Clause */
6/*----------------------------------------------------------------------------*/
7#ifndef GRID_LIBRARY_H
8#define GRID_LIBRARY_H
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14#include "grid_constants.h"
15#include "grid_sphere_cache.h"
16#include <stdbool.h>
17
18/*******************************************************************************
19 * \brief Initializes the grid library.
20 * \author Ole Schuett
21 ******************************************************************************/
22void grid_library_init(void);
23
24/*******************************************************************************
25 * \brief Finalizes the grid library.
26 * \author Ole Schuett
27 ******************************************************************************/
28void grid_library_finalize(void);
29
30/*******************************************************************************
31 * \brief Configuration of the grid library.
32 * \author Ole Schuett
33 ******************************************************************************/
34typedef struct {
35 enum grid_backend
36 backend; // Selectes the backend to be used by the grid library.
37 bool validate; // When true the reference backend runs in shadow mode.
38 bool apply_cutoff; // only important for the dgemm and gpu backends
40
41/*******************************************************************************
42 * \brief Configures the grid library.
43 * \author Ole Schuett
44 ******************************************************************************/
45void grid_library_set_config(const enum grid_backend backend,
46 const bool validate, const bool apply_cutoff);
47
48/*******************************************************************************
49 * \brief Returns the library config.
50 * \author Ole Schuett
51 ******************************************************************************/
53
54/*******************************************************************************
55 * \brief Prints statistics gathered by the grid library.
56 * \author Ole Schuett
57 ******************************************************************************/
58void grid_library_print_stats(void (*mpi_sum_func)(long *, int), int mpi_comm,
59 void (*print_func)(char *, int), int output_unit);
60
61/*******************************************************************************
62 * \brief Various kernels provided by the grid library.
63 * \author Ole Schuett
64 ******************************************************************************/
71
72/*******************************************************************************
73 * \brief Returns a pointer to the thread local sphere cache.
74 * \author Ole Schuett
75 ******************************************************************************/
77
78/*******************************************************************************
79 * \brief Adds given increment to counter specified by lp, backend, and kernel.
80 * \author Ole Schuett
81 ******************************************************************************/
82void grid_library_counter_add(const int lp, const enum grid_backend backend,
83 const enum grid_library_kernel kern,
84 const int increment);
85
86#ifdef __cplusplus
87}
88#endif
89
90#endif // GRID_LIBRARY_H
91
92// EOF
static void print_func(char *message, int output_unit)
Wrapper for printf, passed to dbm_library_print_stats.
Definition dbm_miniapp.c:28
grid_backend
void apply_cutoff(void *ptr)
void grid_library_print_stats(void(*mpi_sum_func)(long *, int), const int mpi_comm, void(*print_func)(char *, int), const int output_unit)
Prints statistics gathered by the grid library.
void grid_library_set_config(const enum grid_backend backend, const bool validate, const bool apply_cutoff)
Configures the grid library.
void grid_library_finalize(void)
Finalizes the grid library.
void grid_library_counter_add(const int lp, const enum grid_backend backend, const enum grid_library_kernel kern, const int increment)
Adds given increment to counter specified by lp, backend, and kernel.
grid_sphere_cache * grid_library_get_sphere_cache(void)
Returns a pointer to the thread local sphere cache.
grid_library_kernel
Various kernels provided by the grid library.
@ GRID_INTEGRATE_GENERAL
@ GRID_COLLOCATE_ORTHO
@ GRID_COLLOCATE_GENERAL
@ GRID_INTEGRATE_ORTHO
void grid_library_init(void)
Initializes the grid library.
grid_library_config grid_library_get_config(void)
Returns the library config.
void mpi_sum_func(long *number, int mpi_comm)
Configuration of the grid library.
enum grid_backend backend
Struct holding the entire sphere cache, ie. for all grids.