(git:374b731)
Loading...
Searching...
No Matches
dbm_distribution.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
8#ifndef DBM_DISTRIBUTION_H
9#define DBM_DISTRIBUTION_H
10
11#include "dbm_mpi.h"
12
13/*******************************************************************************
14 * \brief Internal struct for storing a one dimensional distribution.
15 * \author Ole Schuett
16 ******************************************************************************/
17typedef struct {
18 int length; // global number of rows/cols
19 int *index2coord; // maps row/col indicies to cart coordinate
21 int *local_indicies; // list of row/col indicies that reside locally.
22 dbm_mpi_comm_t comm; // 1D communicator
23 int nranks;
25 int nshards; // Number of shards for distributing blocks across threads.
27
28/*******************************************************************************
29 * \brief Internal struct for storing a two dimensional distribution.
30 * \author Ole Schuett
31 ******************************************************************************/
40
41/*******************************************************************************
42 * \brief Creates a new two dimensional distribution.
43 * \author Ole Schuett
44 ******************************************************************************/
45void dbm_distribution_new(dbm_distribution_t **dist_out, const int fortran_comm,
46 const int nrows, const int ncols,
47 const int row_dist[nrows], const int col_dist[ncols]);
48
49/*******************************************************************************
50 * \brief Increases the reference counter of the given distribution.
51 * \author Ole Schuett
52 ******************************************************************************/
53void dbm_distribution_hold(dbm_distribution_t *dist);
54
55/*******************************************************************************
56 * \brief Decreases the reference counter of the given distribution.
57 * \author Ole Schuett
58 ******************************************************************************/
59void dbm_distribution_release(dbm_distribution_t *dist);
60
61/*******************************************************************************
62 * \brief Returns the rows of the given distribution.
63 * \author Ole Schuett
64 ******************************************************************************/
65void dbm_distribution_row_dist(const dbm_distribution_t *dist, int *nrows,
66 const int **row_dist);
67
68/*******************************************************************************
69 * \brief Returns the columns of the given distribution.
70 * \author Ole Schuett
71 ******************************************************************************/
72void dbm_distribution_col_dist(const dbm_distribution_t *dist, int *ncols,
73 const int **col_dist);
74
75/*******************************************************************************
76 * \brief Returns the MPI rank on which the given block should be stored.
77 * \author Ole Schuett
78 ******************************************************************************/
80 const int row, const int col);
81
82#endif
83
84// EOF
int dbm_distribution_stored_coords(const dbm_distribution_t *dist, const int row, const int col)
Returns the MPI rank on which the given block should be stored.
int dbm_mpi_comm_t
Definition dbm_mpi.h:18
Internal struct for storing a one dimensional distribution.
dbm_mpi_comm_t comm
Internal struct for storing a two dimensional distribution.
dbm_mpi_comm_t comm