8.3
general documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
cs_crystal_router.h
Go to the documentation of this file.
1#ifndef __CS_CRYSTAL_ROUTER_H__
2#define __CS_CRYSTAL_ROUTER_H__
3
4/*============================================================================
5 * Crystal Router parallel exchange algorithm based operations.
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
53#define CS_CRYSTAL_ROUTER_USE_DEST_ID (1 << 0)
54
55#define CS_CRYSTAL_ROUTER_ADD_SRC_ID (1 << 1)
56#define CS_CRYSTAL_ROUTER_ADD_SRC_RANK (1 << 2)
57
58/*============================================================================
59 * Type definitions
60 *============================================================================*/
61
62/* Opaque crystal router structure */
63
64#if defined(HAVE_MPI)
65
66typedef struct _cs_crystal_router_t cs_crystal_router_t;
67
68#endif
69
70/*=============================================================================
71 * Public function prototypes
72 *============================================================================*/
73
74#if defined(HAVE_MPI)
75
76/*----------------------------------------------------------------------------*/
103/*----------------------------------------------------------------------------*/
104
106cs_crystal_router_create_s(size_t n_elts,
107 int stride,
108 cs_datatype_t datatype,
109 int flags,
110 const void *elt,
111 const cs_lnum_t *src_id,
112 const cs_lnum_t *dest_id,
113 const int dest_rank[],
114 MPI_Comm comm);
115
116/*----------------------------------------------------------------------------*/
143/*----------------------------------------------------------------------------*/
144
146cs_crystal_router_create_i(size_t n_elts,
147 cs_datatype_t datatype,
148 int flags,
149 const cs_lnum_t *eld_idx,
150 const void *elt,
151 const cs_lnum_t *src_id,
152 const cs_lnum_t *dest_id,
153 const int dest_rank[],
154 MPI_Comm comm);
155
156/*----------------------------------------------------------------------------*/
162/*----------------------------------------------------------------------------*/
163
164void
166
167/*----------------------------------------------------------------------------*/
175/*----------------------------------------------------------------------------*/
176
177void
179
180/*----------------------------------------------------------------------------*/
190/*----------------------------------------------------------------------------*/
191
194
195/*----------------------------------------------------------------------------*/
210/*----------------------------------------------------------------------------*/
211
214
215/*----------------------------------------------------------------------------*/
259/*----------------------------------------------------------------------------*/
260
261void
263 int **src_rank,
264 cs_lnum_t **dest_id,
265 cs_lnum_t **src_id,
266 cs_lnum_t **data_index,
267 void **data);
268
269/*----------------------------------------------------------------------------*/
281/*----------------------------------------------------------------------------*/
282
283size_t
285 size_t *max_sizes);
286
287#endif /* defined(HAVE_MPI) */
288
289/*----------------------------------------------------------------------------*/
296/*----------------------------------------------------------------------------*/
297
298void
300
301/*----------------------------------------------------------------------------*/
302
304
305#endif /* __CS_CRYSTAL_ROUTER_H__ */
cs_crystal_router_t * cs_crystal_router_create_i(size_t n_elts, cs_datatype_t datatype, int flags, const cs_lnum_t *eld_idx, const void *elt, const cs_lnum_t *src_id, const cs_lnum_t *dest_id, const int dest_rank[], MPI_Comm comm)
Create a Crystal Router for indexed data.
Definition: cs_crystal_router.cpp:1645
size_t cs_crystal_router_get_max_sizes(cs_crystal_router_t *cr, size_t *max_sizes)
Query maximum buffer sizes reached by a Crystal Router.
Definition: cs_crystal_router.cpp:2184
void cs_crystal_router_exchange(cs_crystal_router_t *cr)
Exchange data with a Crystal Router.
Definition: cs_crystal_router.cpp:1831
void cs_crystal_router_destroy(cs_crystal_router_t **cr)
Destroy a Crystal Router.
Definition: cs_crystal_router.cpp:1800
cs_crystal_router_t * cs_crystal_router_create_s(size_t n_elts, int stride, cs_datatype_t datatype, int flags, const void *elt, const cs_lnum_t *src_id, const cs_lnum_t *dest_id, const int dest_rank[], MPI_Comm comm)
Create a Crystal Router for strided data.
Definition: cs_crystal_router.cpp:1535
cs_lnum_t cs_crystal_router_n_elts(const cs_crystal_router_t *cr)
Get number of elements associated with Crystal Router.
Definition: cs_crystal_router.cpp:1929
void cs_crystal_router_get_data(cs_crystal_router_t *cr, int **src_rank, cs_lnum_t **dest_id, cs_lnum_t **src_id, cs_lnum_t **data_index, void **data)
Get data elements associated with a Crystal Router.
Definition: cs_crystal_router.cpp:2055
void cs_crystal_router_log_finalize(void)
Log performance information relative to Crystal Router exchange.
Definition: cs_crystal_router.cpp:2209
cs_lnum_t cs_crystal_router_n_recv_elts(const cs_crystal_router_t *cr)
Get number of elements received with Crystal Router.
Definition: cs_crystal_router.cpp:1998
struct _cs_crystal_router_t cs_crystal_router_t
Definition: cs_crystal_router.h:66
cs_datatype_t
Definition: cs_defs.h:300
#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