Yet Another eXchange Tool 0.11.2
Loading...
Searching...
No Matches
xt_redist_internal.h
Go to the documentation of this file.
1
16/*
17 * Keywords:
18 * Maintainer: Jörg Behrens <behrens@dkrz.de>
19 * Moritz Hanke <hanke@dkrz.de>
20 * Thomas Jahns <jahns@dkrz.de>
21 * URL: https://dkrz-sw.gitlab-pages.dkrz.de/yaxt/
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions are
25 * met:
26 *
27 * Redistributions of source code must retain the above copyright notice,
28 * this list of conditions and the following disclaimer.
29 *
30 * Redistributions in binary form must reproduce the above copyright
31 * notice, this list of conditions and the following disclaimer in the
32 * documentation and/or other materials provided with the distribution.
33 *
34 * Neither the name of the DKRZ GmbH nor the names of its contributors
35 * may be used to endorse or promote products derived from this software
36 * without specific prior written permission.
37 *
38 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
39 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
40 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
41 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
42 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
43 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
44 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
45 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
46 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
47 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
48 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49 */
50#ifndef XT_REDIST_INTERNAL_H
51#define XT_REDIST_INTERNAL_H
52
53#ifdef HAVE_CONFIG_H
54#include <config.h>
55#endif
56
57#include <stdbool.h>
58#include <stdlib.h>
59#include <mpi.h>
60
61#include "core/ppm_visibility.h"
62#include "xt/xt_redist.h"
63#include "xt/xt_request.h"
64#include "xt/xt_config.h"
65#include "xt_mpi_ddt_cache.h"
66
68
70
72 void (*delete)(Xt_redist);
73 void (*s_exchange)(Xt_redist, int, const void *const *, void *const *);
74 void (*a_exchange)(Xt_redist, int, const void *const *, void *const *,
75 Xt_request *);
76 void (*s_exchange1)(Xt_redist, const void *, void *);
77 void (*a_exchange1)(Xt_redist, const void *, void *, Xt_request *);
79 bool need_dup);
81 int (*get_msg_ranks)(Xt_redist, enum xt_msg_direction, int *restrict *);
83};
84
85struct Xt_redist_ {
86 const struct xt_redist_vtable *vtable;
87};
88
91 const struct Xt_redist_msg *restrict src,
92 size_t src_stride,
93 struct Xt_redist_msg *restrict dst,
94 size_t dst_stride,
95 MPI_Comm comm, bool dt_dup);
96
99 MPI_Comm comm, size_t ofs_stride);
100
101static inline void
102xt_redist_msgs_free(size_t n, struct Xt_redist_msg *msgs, MPI_Comm comm)
103{
104 xt_redist_msgs_strided_destruct(n, msgs, comm, sizeof (*msgs));
105 free(msgs);
106}
107
118xt_redist_check_comms(Xt_redist *redists, int num_redists, MPI_Comm comm);
119
134 int *restrict *ranks);
135
148PPM_DSO_INTERNAL MPI_Datatype
150 enum xt_msg_direction direction, bool do_dup);
151
162PPM_DSO_INTERNAL MPI_Datatype
163xt_create_compound_datatype(size_t count,
164 const MPI_Aint displacements[count],
165 const MPI_Datatype datatypes[count],
166 const int block_lengths[count],
167 struct Xt_mpiddt_list *ddt_list,
168 MPI_Comm comm);
169
185PPM_DSO_INTERNAL unsigned
186xt_redist_agg_msg_count(size_t num_redists, enum xt_msg_direction direction,
187 const Xt_redist redists[num_redists],
188 size_t num_ranks[num_redists],
189 int *restrict ranks[num_redists],
190 Xt_config config);
191
192#endif
193/*
194 * Local Variables:
195 * c-basic-offset: 2
196 * coding: utf-8
197 * indent-tabs-mode: nil
198 * show-trailing-whitespace: t
199 * require-trailing-newline: t
200 * End:
201 */
int MPI_Comm
Definition core.h:64
#define PPM_DSO_INTERNAL
const struct xt_redist_vtable * vtable
MPI_Datatype(* get_msg_MPI_Datatype)(Xt_redist, int, enum xt_msg_direction, bool need_dup)
Xt_redist(* copy)(Xt_redist)
void(* s_exchange1)(Xt_redist, const void *, void *)
void(* a_exchange)(Xt_redist, int, const void *const *, void *const *, Xt_request *)
void(* a_exchange1)(Xt_redist, const void *, void *, Xt_request *)
int(* get_num_msg)(Xt_redist, enum xt_msg_direction)
int(* get_msg_ranks)(Xt_redist, enum xt_msg_direction, int *restrict *)
MPI_Comm(* get_MPI_Comm)(Xt_redist)
void(* s_exchange)(Xt_redist, int, const void *const *, void *const *)
opaque configuration object for settings where the default needs to be overridden
struct Xt_config_ * Xt_config
Definition xt_config.h:58
struct Xt_redist_ * Xt_redist
Definition xt_core.h:86
redistribution of data
static void xt_redist_msgs_free(size_t n, struct Xt_redist_msg *msgs, MPI_Comm comm)
xt_msg_direction
PPM_DSO_INTERNAL void xt_redist_msgs_strided_copy(size_t n, const struct Xt_redist_msg *restrict src, size_t src_stride, struct Xt_redist_msg *restrict dst, size_t dst_stride, MPI_Comm comm, bool dt_dup)
PPM_DSO_INTERNAL void xt_redist_check_comms(Xt_redist *redists, int num_redists, MPI_Comm comm)
Definition xt_redist.c:143
PPM_DSO_INTERNAL MPI_Datatype xt_redist_get_MPI_Datatype(Xt_redist redist, int rank, enum xt_msg_direction direction, bool do_dup)
Definition xt_redist.c:123
PPM_DSO_INTERNAL MPI_Datatype xt_create_compound_datatype(size_t count, const MPI_Aint displacements[count], const MPI_Datatype datatypes[count], const int block_lengths[count], struct Xt_mpiddt_list *ddt_list, MPI_Comm comm)
Definition xt_redist.c:231
PPM_DSO_INTERNAL void xt_redist_msgs_strided_destruct(size_t n, struct Xt_redist_msg *msgs, MPI_Comm comm, size_t ofs_stride)
PPM_DSO_INTERNAL unsigned xt_redist_agg_msg_count(size_t num_redists, enum xt_msg_direction direction, const Xt_redist redists[num_redists], size_t num_ranks[num_redists], int *restrict ranks[num_redists], Xt_config config)
Definition xt_redist.c:191
PPM_DSO_INTERNAL int xt_redist_get_msg_ranks(Xt_redist redist, enum xt_msg_direction direction, int *restrict *ranks)
Definition xt_redist.c:135
struct Xt_request_ * Xt_request
Definition xt_request.h:51