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