My Project
programmer's 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-2019 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 "cs_defs.h"
35 
36 /*----------------------------------------------------------------------------*/
37 
39 
40 /*=============================================================================
41  * Macro definitions
42  *============================================================================*/
43 
44 /*============================================================================
45  * Type definitions
46  *============================================================================*/
47 
48 /* Information structure for block size and entity range */
49 
50 typedef struct {
51 
52  cs_gnum_t gnum_range[2]; /* Start and past-the-end global numbers
53  associated with local block */
54  int n_ranks; /* Number of active ranks */
55  int rank_step; /* Step between active block ranks
56  (1 in basic case, > 1 if we seek to
57  avoid too small buffers and agglomerate
58  blocks on only a few ranks) */
59  cs_lnum_t block_size; /* Basic block size */
60 
62 
63 /*=============================================================================
64  * Public function prototypes
65  *============================================================================*/
66 
67 /*----------------------------------------------------------------------------
68  * Compute block size and rank info for use with a block distribution.
69  *
70  * arguments:
71  * rank_id <-- id of local rank
72  * n_ranks <-- number of associated ranks
73  * min_rank_step <-- minimum rank step between blocks
74  * min_block_size <-- minimum number of entities per block
75  * n_g_ents <-- total number of associated entities
76  *
77  * returns:
78  * block size and range info structure
79  *----------------------------------------------------------------------------*/
80 
82 cs_block_dist_compute_sizes(int rank_id,
83  int n_ranks,
84  int min_rank_step,
85  cs_lnum_t min_block_size,
86  cs_gnum_t n_g_ents);
87 
88 /*----------------------------------------------------------------------------
89  * Compute block size and rank info for use with a block distribution
90  * for a new global number of entities with a given number of active
91  * ranks.
92  *
93  * arguments:
94  * rank_id <-- id of local rank (ignored in serial mode)
95  * n_ranks <-- number of associated ranks
96  * n_block_ranks <-- number of ranks associated with a block
97  * n_g_ents <-- total number of associated entities
98  *
99  * returns:
100  * block size and range info structure
101  *----------------------------------------------------------------------------*/
102 
105  int n_ranks,
106  int n_block_ranks,
107  cs_gnum_t n_g_ents);
108 
109 /*----------------------------------------------------------------------------*/
110 
112 
113 #endif /* __CS_BLOCK_DIST_H__ */
cs_defs.h
cs_block_dist_info_t::block_size
cs_lnum_t block_size
Definition: cs_block_dist.h:59
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
cs_block_dist_info_t::n_ranks
int n_ranks
Definition: cs_block_dist.h:54
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
cs_block_dist_info_t
Definition: cs_block_dist.h:50
cs_gnum_t
unsigned long cs_gnum_t
global mesh entity number
Definition: cs_defs.h:286
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
cs_block_dist_compute_sizes_nr
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.c:196
cs_block_dist_info_t::rank_step
int rank_step
Definition: cs_block_dist.h:55
cs_block_dist_compute_sizes
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.c:91