9.2
general documentation
cs_block_dist.h
Go to the documentation of this file.
1#ifndef CS_BLOCK_DIST_H
2#define CS_BLOCK_DIST_H
3
4/*============================================================================
5 * Definition of a block distribution.
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2026 EDF S.A.
12
13 This program is free software; you can redistribute it and/or modify it under
14 the terms of the GNU General Public License as published by the Free Software
15 Foundation; either version 2 of the License, or (at your option) any later
16 version.
17
18 This program is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21 details.
22
23 You should have received a copy of the GNU General Public License along with
24 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25 Street, Fifth Floor, Boston, MA 02110-1301, USA.
26*/
27
28/*----------------------------------------------------------------------------*/
29
30/*----------------------------------------------------------------------------
31 * Local headers
32 *----------------------------------------------------------------------------*/
33
34#include "base/cs_defs.h"
35
36/*=============================================================================
37 * Macro definitions
38 *============================================================================*/
39
40/*============================================================================
41 * Type definitions
42 *============================================================================*/
43
44/* Information structure for block size and entity range */
45
46typedef struct {
47
48 cs_gnum_t gnum_range[2]; /* Start and past-the-end global numbers
49 associated with local block */
50 int n_ranks; /* Number of active ranks */
51 int rank_step; /* Step between active block ranks
52 (1 in basic case, > 1 if we seek to
53 avoid too small buffers and agglomerate
54 blocks on only a few ranks) */
55 cs_lnum_t block_size; /* Basic block size */
56
58
59/*=============================================================================
60 * Public function prototypes
61 *============================================================================*/
62
63/*----------------------------------------------------------------------------
64 * Compute block size and rank info for use with a block distribution.
65 *
66 * arguments:
67 * rank_id <-- id of local rank
68 * n_ranks <-- number of associated ranks
69 * min_rank_step <-- minimum rank step between blocks
70 * min_block_size <-- minimum number of entities per block
71 * n_g_ents <-- total number of associated entities
72 *
73 * returns:
74 * block size and range info structure
75 *----------------------------------------------------------------------------*/
76
79 int n_ranks,
80 int min_rank_step,
81 cs_lnum_t min_block_size,
82 cs_gnum_t n_g_ents);
83
84/*----------------------------------------------------------------------------
85 * Compute block size and rank info for use with a block distribution
86 * for a new global number of entities with a given number of active
87 * ranks.
88 *
89 * arguments:
90 * rank_id <-- id of local rank (ignored in serial mode)
91 * n_ranks <-- number of associated ranks
92 * n_block_ranks <-- number of ranks associated with a block
93 * n_g_ents <-- total number of associated entities
94 *
95 * returns:
96 * block size and range info structure
97 *----------------------------------------------------------------------------*/
98
101 int n_ranks,
102 int n_block_ranks,
103 cs_gnum_t n_g_ents);
104
105/*----------------------------------------------------------------------------*/
106
107#endif /* CS_BLOCK_DIST_H */
cs_block_dist_info_t cs_block_dist_compute_sizes(int rank_id, int n_ranks, int min_rank_step, cs_lnum_t min_block_size, cs_gnum_t n_g_ents)
Compute block size and rank info for use with a block distribution.
Definition: cs_block_dist.cpp:89
cs_block_dist_info_t cs_block_dist_compute_sizes_nr(int rank_id, int n_ranks, int n_block_ranks, cs_gnum_t n_g_ents)
Compute block size and rank info for use with a block distribution for a new global number of entitie...
Definition: cs_block_dist.cpp:194
unsigned cs_gnum_t
global mesh entity number
Definition: cs_defs.h:317
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
Definition: cs_block_dist.h:46
int n_ranks
Definition: cs_block_dist.h:50
int rank_step
Definition: cs_block_dist.h:51
cs_lnum_t block_size
Definition: cs_block_dist.h:55