Line data Source code
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_INTERNAL_H
8 : #define DBM_INTERNAL_H
9 :
10 : /*******************************************************************************
11 : * \brief Returns the larger of two given integers (missing from the C standard)
12 : * \author Ole Schuett
13 : ******************************************************************************/
14 1722660 : static inline int imax(int x, int y) { return (x > y ? x : y); }
15 :
16 : /*******************************************************************************
17 : * \brief Internal struct for storing a dbm_block_t plus its norm.
18 : * \author Ole Schuett
19 : ******************************************************************************/
20 : typedef struct {
21 : int free_index; // Free index in Einstein notation of matrix multiplication.
22 : int sum_index; // Summation index - also called dummy index.
23 : int offset;
24 : float norm;
25 : } dbm_pack_block_t;
26 :
27 : /*******************************************************************************
28 : * \brief Internal struct for storing a pack - essentially a shard for MPI.
29 : * \author Ole Schuett
30 : ******************************************************************************/
31 : typedef struct {
32 : int nblocks;
33 : int data_size;
34 : dbm_pack_block_t *blocks;
35 : double *data;
36 : } dbm_pack_t;
37 :
38 : /*******************************************************************************
39 : * \brief Internal struct for storing a task, ie. a single block multiplication.
40 : * \author Ole Schuett
41 : ******************************************************************************/
42 : typedef struct {
43 : int m;
44 : int n;
45 : int k;
46 : int offset_a;
47 : int offset_b;
48 : int offset_c;
49 : } dbm_task_t;
50 :
51 : #endif
52 :
53 : // EOF
|