Yet Another eXchange Tool 0.11.3
Loading...
Searching...
No Matches
xt_xmap.c
Go to the documentation of this file.
1
12/*
13 * Keywords:
14 * Maintainer: Jörg Behrens <behrens@dkrz.de>
15 * Moritz Hanke <hanke@dkrz.de>
16 * Thomas Jahns <jahns@dkrz.de>
17 * URL: https://dkrz-sw.gitlab-pages.dkrz.de/yaxt/
18 *
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions are
21 * met:
22 *
23 * Redistributions of source code must retain the above copyright notice,
24 * this list of conditions and the following disclaimer.
25 *
26 * Redistributions in binary form must reproduce the above copyright
27 * notice, this list of conditions and the following disclaimer in the
28 * documentation and/or other materials provided with the distribution.
29 *
30 * Neither the name of the DKRZ GmbH nor the names of its contributors
31 * may be used to endorse or promote products derived from this software
32 * without specific prior written permission.
33 *
34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
35 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
36 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
37 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
38 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
39 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
40 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
41 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
42 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
43 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
44 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45 */
46#ifdef HAVE_CONFIG_H
47#include <config.h>
48#endif
49
50#include <mpi.h>
51
52#include "xt/xt_xmap.h"
53#include "xt_xmap_internal.h"
54#include "xt_config_internal.h"
55
57
58 return xmap->vtable->get_communicator(xmap);
59}
60
62
63 return xmap->vtable->get_num_destinations(xmap);
64}
65
67
68 return xmap->vtable->get_num_sources(xmap);
69}
70
71void xt_xmap_get_destination_ranks(Xt_xmap xmap, int * ranks) {
72
73 xmap->vtable->get_destination_ranks(xmap, ranks);
74}
75
76void xt_xmap_get_source_ranks(Xt_xmap xmap, int * ranks) {
77
78 xmap->vtable->get_source_ranks(xmap, ranks);
79}
80
82
83 return xmap->vtable->copy(xmap);
84}
85
87
88 xmap->vtable->delete(xmap);
89}
90
92
93 return xmap->vtable->get_in_iterator(xmap);
94}
95
100
102
103 return iter->vtable->next(iter);
104}
105
107
108 return iter->vtable->get_rank(iter);
109}
110
112
113 return iter->vtable->get_transfer_pos(iter);
114}
115
120
121const struct Xt_pos_ext *
125
129
131
132 iter->vtable->delete(iter);
133}
134
136 return xmap->vtable->get_max_src_pos(xmap);
137}
138
140 return xmap->vtable->get_max_dst_pos(xmap);
141}
142
144 return xmap->vtable->reorder(xmap, type, &xt_default_config);
145}
146
149 Xt_config config)
150{
151 return xmap->vtable->reorder(xmap, type, config);
152}
153
155 Xt_xmap xmap, const int * src_positions, const int * dst_positions) {
156 return xmap->vtable->update_pos(xmap, src_positions, dst_positions);
157}
158
159Xt_xmap xt_xmap_spread(Xt_xmap xmap, int num_repetitions,
160 const int src_displacements[num_repetitions],
161 const int dst_displacements[num_repetitions]) {
162 return
163 xmap->vtable->spread(
164 xmap, num_repetitions, src_displacements, dst_displacements);
165}
166
167/*
168 * Local Variables:
169 * c-basic-offset: 2
170 * coding: utf-8
171 * indent-tabs-mode: nil
172 * show-trailing-whitespace: t
173 * require-trailing-newline: t
174 * End:
175 */
int MPI_Comm
Definition core.h:64
const struct Xt_xmap_vtable * vtable
const struct Xt_xmap_iter_vtable * vtable
int(* get_num_transfer_pos)(Xt_xmap_iter iter)
int(* next)(Xt_xmap_iter iter)
int const *(* get_transfer_pos)(Xt_xmap_iter iter)
int(* get_rank)(Xt_xmap_iter iter)
int(* get_num_transfer_pos_ext)(Xt_xmap_iter iter)
void(* delete)(Xt_xmap_iter iter)
const struct Xt_pos_ext *(* get_transfer_pos_ext)(Xt_xmap_iter iter)
Xt_xmap(* update_pos)(Xt_xmap xmap, const int *src_positions, const int *dst_positions)
int(* get_num_destinations)(Xt_xmap)
void(* delete)(Xt_xmap)
MPI_Comm(* get_communicator)(Xt_xmap)
int(* get_max_dst_pos)(Xt_xmap)
Xt_xmap_iter(* get_out_iterator)(Xt_xmap)
Xt_xmap_iter(* get_in_iterator)(Xt_xmap)
void(* get_source_ranks)(Xt_xmap, int *)
Xt_xmap(* spread)(Xt_xmap xmap, int num_repetitions, const int src_displacements[num_repetitions], const int dst_displacements[num_repetitions])
int(* get_max_src_pos)(Xt_xmap)
Xt_xmap(* reorder)(Xt_xmap xmap, enum xt_reorder_type type, Xt_config config)
Xt_xmap(* copy)(Xt_xmap)
int(* get_num_sources)(Xt_xmap)
void(* get_destination_ranks)(Xt_xmap, int *)
struct Xt_config_ xt_default_config
Definition xt_config.c:204
struct Xt_config_ * Xt_config
Definition xt_config.h:58
implementation of configuration object
struct Xt_xmap_ * Xt_xmap
Definition xt_core.h:85
Xt_xmap xt_xmap_update_positions(Xt_xmap xmap, const int *src_positions, const int *dst_positions)
Definition xt_xmap.c:154
int xt_xmap_iterator_next(Xt_xmap_iter iter)
Definition xt_xmap.c:101
Xt_xmap xt_xmap_reorder(Xt_xmap xmap, enum xt_reorder_type type)
Definition xt_xmap.c:143
void xt_xmap_delete(Xt_xmap xmap)
Definition xt_xmap.c:86
Xt_xmap_iter xt_xmap_get_out_iterator(Xt_xmap xmap)
Definition xt_xmap.c:96
int xt_xmap_iterator_get_num_transfer_pos_ext(Xt_xmap_iter iter)
Definition xt_xmap.c:126
Xt_xmap xt_xmap_spread(Xt_xmap xmap, int num_repetitions, const int src_displacements[num_repetitions], const int dst_displacements[num_repetitions])
Definition xt_xmap.c:159
void xt_xmap_iterator_delete(Xt_xmap_iter iter)
Definition xt_xmap.c:130
int xt_xmap_get_num_destinations(Xt_xmap xmap)
Definition xt_xmap.c:61
Xt_xmap xt_xmap_copy(Xt_xmap xmap)
Definition xt_xmap.c:81
int xt_xmap_iterator_get_rank(Xt_xmap_iter iter)
Definition xt_xmap.c:106
int xt_xmap_get_max_dst_pos(Xt_xmap xmap)
Definition xt_xmap.c:139
int xt_xmap_get_num_sources(Xt_xmap xmap)
Definition xt_xmap.c:66
const struct Xt_pos_ext * xt_xmap_iterator_get_transfer_pos_ext(Xt_xmap_iter iter)
Definition xt_xmap.c:122
void xt_xmap_get_source_ranks(Xt_xmap xmap, int *ranks)
Definition xt_xmap.c:76
Xt_xmap xt_xmap_reorder_custom(Xt_xmap xmap, enum xt_reorder_type type, Xt_config config)
Definition xt_xmap.c:148
Xt_xmap_iter xt_xmap_get_in_iterator(Xt_xmap xmap)
Definition xt_xmap.c:91
void xt_xmap_get_destination_ranks(Xt_xmap xmap, int *ranks)
Definition xt_xmap.c:71
MPI_Comm xt_xmap_get_communicator(Xt_xmap xmap)
Definition xt_xmap.c:56
int const * xt_xmap_iterator_get_transfer_pos(Xt_xmap_iter iter)
Definition xt_xmap.c:111
int xt_xmap_get_max_src_pos(Xt_xmap xmap)
Definition xt_xmap.c:135
int xt_xmap_iterator_get_num_transfer_pos(Xt_xmap_iter iter)
Definition xt_xmap.c:116
exchange map declarations
struct Xt_xmap_iter_ * Xt_xmap_iter
Definition xt_xmap.h:73
xt_reorder_type
Definition xt_xmap.h:240
contains declaration for the exchange map data structure