My Project
programmer's documentation
cs_all_to_all.h
Go to the documentation of this file.
1 #ifndef __CS_ALL_TO_ALL_H__
2 #define __CS_ALL_TO_ALL_H__
3 
4 /*============================================================================
5  * All-to-all parallel data exchange.
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 #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 
53 #define CS_ALL_TO_ALL_USE_DEST_ID (1 << 0)
54 #define CS_ALL_TO_ALL_ORDER_BY_SRC_RANK (1 << 1)
55 
56 #define CS_ALL_TO_ALL_NO_REVERSE (1 << 2)
57 #define CS_ALL_TO_ALL_NEED_SRC_RANK (1 << 3)
58 
59 /*============================================================================
60  * Type definitions
61  *============================================================================*/
62 
63 /* All-to-all algorithm choice */
64 
65 typedef enum {
66 
69 
71 
72 /* Opaque all-to-all distribution structure */
73 
74 #if defined(HAVE_MPI)
75 
76 typedef struct _cs_all_to_all_t cs_all_to_all_t;
77 
78 #endif
79 
80 /*=============================================================================
81  * Public function prototypes
82  *============================================================================*/
83 
84 #if defined(HAVE_MPI)
85 
86 /*----------------------------------------------------------------------------*/
120 /*----------------------------------------------------------------------------*/
121 
123 cs_all_to_all_create(size_t n_elts,
124  int flags,
125  const cs_lnum_t *dest_id,
126  const int dest_rank[],
127  MPI_Comm comm);
128 
129 /*----------------------------------------------------------------------------*/
151 /*----------------------------------------------------------------------------*/
152 
154 cs_all_to_all_create_from_block(size_t n_elts,
155  int flags,
156  const cs_gnum_t *src_gnum,
158  MPI_Comm comm);
159 
160 /*----------------------------------------------------------------------------*/
166 /*----------------------------------------------------------------------------*/
167 
168 void
170 
171 /*----------------------------------------------------------------------------*/
181 /*----------------------------------------------------------------------------*/
182 
183 void
185  int **dest_rank);
186 
187 /*----------------------------------------------------------------------------*/
198 /*----------------------------------------------------------------------------*/
199 
200 void
202  cs_lnum_t **dest_id);
203 
204 /*----------------------------------------------------------------------------*/
217 /*----------------------------------------------------------------------------*/
218 
219 cs_lnum_t
221 
222 /*----------------------------------------------------------------------------*/
249 /*----------------------------------------------------------------------------*/
250 
251 void *
253  cs_datatype_t datatype,
254  int stride,
255  bool reverse,
256  const void *src_data,
257  void *dest_data);
258 
259 /*----------------------------------------------------------------------------*/
283 /*----------------------------------------------------------------------------*/
284 
285 cs_lnum_t *
287  bool reverse,
288  const cs_lnum_t *src_index,
289  cs_lnum_t *dest_index);
290 
291 /*----------------------------------------------------------------------------*/
319 /*----------------------------------------------------------------------------*/
320 
321 void *
323  cs_datatype_t datatype,
324  bool reverse,
325  const cs_lnum_t *src_index,
326  const void *src_data,
327  const cs_lnum_t *dest_index,
328  void *dest_data);
329 
330 /*----------------------------------------------------------------------------*/
353 /*----------------------------------------------------------------------------*/
354 
355 int *
357 
358 #endif /* defined(HAVE_MPI) */
359 
360 /*----------------------------------------------------------------------------*/
366 /*----------------------------------------------------------------------------*/
367 
370 
371 /*----------------------------------------------------------------------------*/
377 /*----------------------------------------------------------------------------*/
378 
379 void
381 
382 /*----------------------------------------------------------------------------*/
387 /*----------------------------------------------------------------------------*/
388 
389 void
391 
392 /*----------------------------------------------------------------------------*/
393 
395 
396 #endif /* __CS_ALL_TO_ALL_H__ */
cs_all_to_all_copy_array
void * cs_all_to_all_copy_array(cs_all_to_all_t *d, cs_datatype_t datatype, int stride, bool reverse, const void *src_data, void *dest_data)
Communicate array data using all-to-all distributor.
Definition: cs_all_to_all.c:1634
cs_defs.h
CS_ALL_TO_ALL_CRYSTAL_ROUTER
Definition: cs_all_to_all.h:68
cs_all_to_all_set_type
void cs_all_to_all_set_type(cs_all_to_all_type_t t)
Set current type of all-to-all distributor algorithm choice.
Definition: cs_all_to_all.c:2114
cs_all_to_all_destroy
void cs_all_to_all_destroy(cs_all_to_all_t **d)
Destroy an all-to-all distributor.
Definition: cs_all_to_all.c:1411
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:468
cs_all_to_all_create_from_block
cs_all_to_all_t * cs_all_to_all_create_from_block(size_t n_elts, int flags, const cs_gnum_t *src_gnum, cs_block_dist_info_t bi, MPI_Comm comm)
Create an all-to-all distributor for elements whose destination rank is determined from global number...
Definition: cs_all_to_all.c:1338
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
cs_all_to_all_t
struct _cs_all_to_all_t cs_all_to_all_t
Definition: cs_all_to_all.h:76
cs_all_to_all_get_src_rank
int * cs_all_to_all_get_src_rank(cs_all_to_all_t *d)
Get array of source element ranks associated with an all-to-all distributor.
Definition: cs_all_to_all.c:2039
cs_all_to_all_get_type
cs_all_to_all_type_t cs_all_to_all_get_type(void)
Get current type of all-to-all distributor algorithm choice.
Definition: cs_all_to_all.c:2100
cs_datatype_t
cs_datatype_t
Definition: cs_defs.h:260
stride
void const cs_int_t const cs_int_t const cs_int_t const cs_int_t * stride
Definition: cs_sat_coupling.h:325
cs_all_to_all_type_t
cs_all_to_all_type_t
All-to-all algorithm selection.
Definition: cs_all_to_all.h:65
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_all_to_all_transfer_dest_id
void cs_all_to_all_transfer_dest_id(cs_all_to_all_t *d, cs_lnum_t **dest_id)
Transfer ownership of destination ids to an all-to-all distributor.
Definition: cs_all_to_all.c:1490
cs_all_to_all_log_finalize
void cs_all_to_all_log_finalize(void)
Log performance information relative to instrumented all-to-all distribution.
Definition: cs_all_to_all.c:2127
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
cs_all_to_all_n_elts_dest
cs_lnum_t cs_all_to_all_n_elts_dest(cs_all_to_all_t *d)
Get number of elements associated with all-to-all distributor.
Definition: cs_all_to_all.c:1523
cs_all_to_all_transfer_dest_rank
void cs_all_to_all_transfer_dest_rank(cs_all_to_all_t *d, int **dest_rank)
Transfer ownership of destination rank to an all-to-all distributor.
Definition: cs_all_to_all.c:1459
t
Definition: cs_field_pointer.h:98
cs_all_to_all_copy_indexed
void * cs_all_to_all_copy_indexed(cs_all_to_all_t *d, cs_datatype_t datatype, bool reverse, const cs_lnum_t *src_index, const void *src_data, const cs_lnum_t *dest_index, void *dest_data)
Communicate local index using all-to-all distributor.
Definition: cs_all_to_all.c:1882
CS_ALL_TO_ALL_MPI_DEFAULT
Definition: cs_all_to_all.h:67
cs_all_to_all_copy_index
cs_lnum_t * cs_all_to_all_copy_index(cs_all_to_all_t *d, bool reverse, const cs_lnum_t *src_index, cs_lnum_t *dest_index)
Communicate local index using all-to-all distributor.
Definition: cs_all_to_all.c:1791
cs_all_to_all_create
cs_all_to_all_t * cs_all_to_all_create(size_t n_elts, int flags, const cs_lnum_t *dest_id, const int dest_rank[], MPI_Comm comm)
Create an all-to-all distributor based on destination rank.
Definition: cs_all_to_all.c:1282
cs_block_dist.h