Yet Another eXchange Tool 0.11.1
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 **, void **);
74 void (*a_exchange)(Xt_redist, int, const void **, void **, Xt_request *);
75 void (*s_exchange1)(Xt_redist, const void *, void *);
76 void (*a_exchange1)(Xt_redist, const void *, void *, Xt_request *);
78 bool need_dup);
80 int (*get_msg_ranks)(Xt_redist, enum xt_msg_direction, int *restrict *);
82};
83
84struct Xt_redist_ {
85 const struct xt_redist_vtable *vtable;
86};
87
90 const struct Xt_redist_msg *restrict src,
91 size_t src_stride,
92 struct Xt_redist_msg *restrict dst,
93 size_t dst_stride,
94 MPI_Comm comm, bool dt_dup);
95
98 MPI_Comm comm, size_t ofs_stride);
99
100static inline void
101xt_redist_msgs_free(size_t n, struct Xt_redist_msg *msgs, MPI_Comm comm)
102{
103 xt_redist_msgs_strided_destruct(n, msgs, comm, sizeof (*msgs));
104 free(msgs);
105}
106
117xt_redist_check_comms(Xt_redist *redists, int num_redists, MPI_Comm comm);
118
133 int *restrict *ranks);
134
147PPM_DSO_INTERNAL MPI_Datatype
149 enum xt_msg_direction direction, bool do_dup);
150
161PPM_DSO_INTERNAL MPI_Datatype
162xt_create_compound_datatype(size_t count,
163 const MPI_Aint displacements[count],
164 const MPI_Datatype datatypes[count],
165 const int block_lengths[count],
166 struct Xt_mpiddt_list *ddt_list,
167 MPI_Comm comm);
168
183PPM_DSO_INTERNAL unsigned
184xt_redist_agg_msg_count(size_t num_redists, enum xt_msg_direction direction,
185 const Xt_redist redists[num_redists],
186 size_t num_ranks[num_redists],
187 int *restrict ranks[num_redists],
188 Xt_config config);
189
190#endif
191/*
192 * Local Variables:
193 * c-basic-offset: 2
194 * coding: utf-8
195 * indent-tabs-mode: nil
196 * show-trailing-whitespace: t
197 * require-trailing-newline: t
198 * End:
199 */
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(* a_exchange)(Xt_redist, int, const void **, void **, Xt_request *)
void(* s_exchange1)(Xt_redist, const void *, void *)
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 *)
void(* s_exchange)(Xt_redist, int, const void **, void **)
MPI_Comm(* get_MPI_Comm)(Xt_redist)
opaque configuration object for settings where the default needs to be overridden
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:142
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:122
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:229
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:190
PPM_DSO_INTERNAL int xt_redist_get_msg_ranks(Xt_redist redist, enum xt_msg_direction direction, int *restrict *ranks)
Definition xt_redist.c:134