7.1
general documentation
cs_rank_neighbors.h
Go to the documentation of this file.
1 #ifndef __CS_RANK_NEIGHBORS_H__
2 #define __CS_RANK_NEIGHBORS_H__
3 
4 /*============================================================================
5  * Management of parallel rank neighbors.
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2021 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 #if defined(HAVE_MPI)
31 #include <mpi.h>
32 #endif
33 
34 /*----------------------------------------------------------------------------
35  * Local headers
36  *----------------------------------------------------------------------------*/
37 
38 #include "cs_defs.h"
39 #include "cs_block_dist.h"
40 
41 /*----------------------------------------------------------------------------*/
42 
44 
45 /*=============================================================================
46  * Macro definitions
47  *============================================================================*/
48 
49 /*============================================================================
50  * Type definitions
51  *============================================================================*/
52 
53 /* Exchange algorithm choice */
54 
55 typedef enum {
56 
60 
62 
63 #if defined(HAVE_MPI)
64 
65 /* Rank neighbors structure */
66 
67 typedef struct {
68 
69  int size;
70  int *rank;
73 
74 #endif
75 
76 /*=============================================================================
77  * Global variables
78  *============================================================================*/
79 
80 extern const char *cs_rank_neighbors_exchange_name[];
81 
82 /*=============================================================================
83  * Public function prototypes
84  *============================================================================*/
85 
86 #if defined(HAVE_MPI)
87 
88 /*----------------------------------------------------------------------------*/
97 /*----------------------------------------------------------------------------*/
98 
100 cs_rank_neighbors_create(size_t n_elts,
101  const int elt_rank[]);
102 
103 /*----------------------------------------------------------------------------*/
109 /*----------------------------------------------------------------------------*/
110 
111 void
113 
114 /*----------------------------------------------------------------------------*/
128 /*----------------------------------------------------------------------------*/
129 
130 void
132  size_t n_elts,
133  const int elt_rank[],
134  int *elt_rank_index);
135 
136 /*----------------------------------------------------------------------------*/
146 /*----------------------------------------------------------------------------*/
147 
148 void
150  MPI_Comm comm);
151 
152 /*----------------------------------------------------------------------------*/
164 /*----------------------------------------------------------------------------*/
165 
166 void
168  size_t n_elts,
169  const int *elt_rank_index,
170  cs_lnum_t *elt_rank_count);
171 
172 /*----------------------------------------------------------------------------*/
185 /*----------------------------------------------------------------------------*/
186 
187 void
189  cs_rank_neighbors_t **n_recv,
190  const cs_lnum_t *send_count,
191  cs_lnum_t **recv_count,
192  MPI_Comm comm);
193 
194 /*----------------------------------------------------------------------------*/
209 /*----------------------------------------------------------------------------*/
210 
211 void
213  cs_rank_neighbors_t **n_recv,
214  const cs_lnum_t *send_count,
215  cs_lnum_t **recv_count,
216  cs_rank_neighbors_exchange_t exchange_type,
217  MPI_Comm comm);
218 
219 #endif /* defined(HAVE_MPI) */
220 
221 /*----------------------------------------------------------------------------*/
227 /*----------------------------------------------------------------------------*/
228 
231 
232 /*----------------------------------------------------------------------------*/
238 /*----------------------------------------------------------------------------*/
239 
240 void
242 
243 /*----------------------------------------------------------------------------*/
244 
246 
247 #endif /* __CS_RANK_NEIGHBORS_H__ */
Definition: cs_rank_neighbors.h:57
int size
Definition: cs_rank_neighbors.h:69
#define BEGIN_C_DECLS
Definition: cs_defs.h:510
void cs_rank_neighbors_to_index(const cs_rank_neighbors_t *n, size_t n_elts, const int elt_rank[], int *elt_rank_index)
Given a list of element ranks, determine the associated element rank indexes in a rank neighborhood s...
Definition: cs_rank_neighbors.c:425
cs_rank_neighbors_t * cs_rank_neighbors_create(size_t n_elts, const int elt_rank[])
Create a rank neighbors structure base on a list of element ranks.
Definition: cs_rank_neighbors.c:344
void cs_rank_neighbors_destroy(cs_rank_neighbors_t **n)
Destroy a rank neighborhood structure.
Definition: cs_rank_neighbors.c:389
void cs_rank_neighbors_set_exchange_type(cs_rank_neighbors_exchange_t t)
Set current type of rank neighbors collective algorithm choice.
Definition: cs_rank_neighbors.c:1025
void cs_rank_neighbors_symmetrize(cs_rank_neighbors_t *n, MPI_Comm comm)
Symmetrize a rank neighborhood structure.
Definition: cs_rank_neighbors.c:511
Definition: cs_rank_neighbors.h:67
void cs_rank_neighbors_sync_count_m(const cs_rank_neighbors_t *n_send, cs_rank_neighbors_t **n_recv, const cs_lnum_t *send_count, cs_lnum_t **recv_count, cs_rank_neighbors_exchange_t exchange_type, MPI_Comm comm)
Exchange send and receive counts for rank neighborhoods, using a given method.
Definition: cs_rank_neighbors.c:792
int * rank
Definition: cs_rank_neighbors.h:70
cs_rank_neighbors_exchange_t
Definition: cs_rank_neighbors.h:55
Definition: cs_rank_neighbors.h:59
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:316
const char * cs_rank_neighbors_exchange_name[]
#define END_C_DECLS
Definition: cs_defs.h:511
Definition: cs_field_pointer.h:92
void cs_rank_neighbors_sync_count(const cs_rank_neighbors_t *n_send, cs_rank_neighbors_t **n_recv, const cs_lnum_t *send_count, cs_lnum_t **recv_count, MPI_Comm comm)
Exchange send and receive counts for rank neighborhoods.
Definition: cs_rank_neighbors.c:760
void cs_rank_neighbors_count(const cs_rank_neighbors_t *n, size_t n_elts, const int *elt_rank_index, cs_lnum_t *elt_rank_count)
Given a list of element rank indexes, count occurences for a rank neighborhood structure.
Definition: cs_rank_neighbors.c:717
Definition: cs_rank_neighbors.h:58
cs_rank_neighbors_exchange_t cs_rank_neighbors_get_exchange_type(void)
Get current type of rank neighbors collective algorithm choice.
Definition: cs_rank_neighbors.c:1011