LCOV - code coverage report
Current view: top level - src/dbm - dbm_internal.h Coverage Total Hit
Test: CP2K Regtests (git:1be8651) Lines: 100.0 % 1 1
Test Date: 2026-11-24 01:22:08 Functions: - 0 0

            Line data    Source code
       1              : /*----------------------------------------------------------------------------*/
       2              : /*  CP2K: A general program to perform molecular dynamics simulations         */
       3              : /*  Copyright 2000-2026 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              : #include <stdbool.h>
      11              : #include <stdint.h>
      12              : 
      13              : /*******************************************************************************
      14              :  * \brief Returns the larger of two given integers (missing from the C standard)
      15              :  * \author Ole Schuett
      16              :  ******************************************************************************/
      17      1556089 : static inline int imax(int x, int y) { return (x > y ? x : y); }
      18              : 
      19              : /*******************************************************************************
      20              :  * \brief Internal struct for storing a dbm_block_t plus its norm.
      21              :  * \author Ole Schuett
      22              :  ******************************************************************************/
      23              : typedef struct {
      24              :   int free_index; // Free index in Einstein notation of matrix multiplication.
      25              :   int sum_index;  // Summation index - also called dummy index.
      26              :   int offset;
      27              :   float norm;
      28              : } dbm_pack_block_t;
      29              : 
      30              : /*******************************************************************************
      31              :  * \brief Internal struct for storing a pack - essentially a shard for MPI.
      32              :  * \author Ole Schuett
      33              :  ******************************************************************************/
      34              : typedef struct {
      35              :   int nblocks;
      36              :   int data_size;
      37              :   dbm_pack_block_t *blocks;
      38              :   double *data;
      39              : } dbm_pack_t;
      40              : 
      41              : /*******************************************************************************
      42              :  * \brief Internal struct for storing a task, ie. a single block multiplication.
      43              :  * \author Ole Schuett
      44              :  ******************************************************************************/
      45              : typedef struct {
      46              :   int m;
      47              :   int n;
      48              :   int k;
      49              :   int offset_a;
      50              :   int offset_b;
      51              :   int offset_c;
      52              : } dbm_task_t;
      53              : 
      54              : /*******************************************************************************
      55              :  * \brief Internal struct for storing a batch of tasks along with its shape,
      56              :  *        which is tracked while the batch is generated such that a backend
      57              :  *        needs no pass over the tasks. The batch is homogeneous if
      58              :  *        flops == 2*ntasks*max_m*max_n*max_k, otherwise their ratio is the
      59              :  *        fill of a kernel padded to the maxima.
      60              :  * \author Hans Pabst
      61              :  ******************************************************************************/
      62              : typedef struct {
      63              :   int max_m;
      64              :   int max_n;
      65              :   int max_k;
      66              :   int64_t flops;
      67              :   int ntasks;
      68              :   dbm_task_t *tasks;
      69              : } dbm_batch_t;
      70              : 
      71              : #endif
      72              : 
      73              : // EOF
        

Generated by: LCOV version 2.0-1