8.3
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-2024 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
55typedef enum {
56
60
62
63#if defined(HAVE_MPI)
64
65/* Rank neighbors structure */
66
67typedef struct {
68
69 int size;
70 int *rank;
73
74#endif
75
76/*=============================================================================
77 * Global variables
78 *============================================================================*/
79
80extern const char *cs_rank_neighbors_exchange_name[];
81
82/*=============================================================================
83 * Public function prototypes
84 *============================================================================*/
85
86#if defined(HAVE_MPI)
87
88/*----------------------------------------------------------------------------*/
97/*----------------------------------------------------------------------------*/
98
100cs_rank_neighbors_create(size_t n_elts,
101 const int elt_rank[]);
102
103/*----------------------------------------------------------------------------*/
109/*----------------------------------------------------------------------------*/
110
111void
113
114/*----------------------------------------------------------------------------*/
128/*----------------------------------------------------------------------------*/
129
130void
132 size_t n_elts,
133 const int elt_rank[],
134 int *elt_rank_index);
135
136/*----------------------------------------------------------------------------*/
146/*----------------------------------------------------------------------------*/
147
148void
150 MPI_Comm comm);
151
152/*----------------------------------------------------------------------------*/
164/*----------------------------------------------------------------------------*/
165
166void
168 size_t n_elts,
169 const int *elt_rank_index,
170 cs_lnum_t *elt_rank_count);
171
172/*----------------------------------------------------------------------------*/
185/*----------------------------------------------------------------------------*/
186
187void
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
211void
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
240void
242
243/*----------------------------------------------------------------------------*/
244
246
247#endif /* __CS_RANK_NEIGHBORS_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
#define END_C_DECLS
Definition: cs_defs.h:543
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
@ t
Definition: cs_field_pointer.h:94
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.cpp:1025
void cs_rank_neighbors_destroy(cs_rank_neighbors_t **n)
Destroy a rank neighborhood structure.
Definition: cs_rank_neighbors.cpp:389
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.cpp:425
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.cpp:792
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.cpp:344
void cs_rank_neighbors_symmetrize(cs_rank_neighbors_t *n, MPI_Comm comm)
Symmetrize a rank neighborhood structure.
Definition: cs_rank_neighbors.cpp:511
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.cpp:717
const char * cs_rank_neighbors_exchange_name[]
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.cpp:1011
cs_rank_neighbors_exchange_t
Definition: cs_rank_neighbors.h:55
@ CS_RANK_NEIGHBORS_PEX
Definition: cs_rank_neighbors.h:57
@ CS_RANK_NEIGHBORS_NBX
Definition: cs_rank_neighbors.h:58
@ CS_RANK_NEIGHBORS_CRYSTAL_ROUTER
Definition: cs_rank_neighbors.h:59
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.cpp:760
Definition: cs_rank_neighbors.h:67
int size
Definition: cs_rank_neighbors.h:69
int * rank
Definition: cs_rank_neighbors.h:70