63 MPI_Comm newComm,
int new_tag_offset);
66 const void * src_data,
100 static Xt_exchanger_simple_base
103 Xt_exchanger_simple_base exchanger;
104 size_t header_size =
sizeof(*exchanger),
105 body_size = nmsg *
sizeof (exchanger->
msgs[0]);
106 exchanger =
xmalloc(header_size + body_size);
119 Xt_abort(comm,
"ERROR(xt_exchanger_simple_base_new): invalid exchange " 120 "function pointer", __FILE__, __LINE__);
122 assert((nsend >= 0) & (nrecv >= 0));
123 size_t nmsg = (size_t)nsend + (
size_t)
nrecv;
124 Xt_exchanger_simple_base exchanger
129 exchanger->
msgs, sizeof (exchanger->
msgs[0]),
133 exchanger->
msgs + nsend,
134 sizeof (exchanger->
msgs[0]),
139 sizeof(exchanger->
msgs[0]),
143 sizeof(exchanger->
msgs[0]),
151 MPI_Comm new_comm,
int new_tag_offset)
153 Xt_exchanger_simple_base exchanger_sb =
157 size_t nmsg = (size_t)nsend + (
size_t)
nrecv;
158 Xt_exchanger_simple_base exchanger_copy
162 exchanger_copy->
func = exchanger_sb->
func;
164 *restrict orig_msgs = exchanger_sb->
msgs;
166 new_msgs,
sizeof (*new_msgs),
168 exchanger_copy->
comm = new_comm;
176 Xt_exchanger_simple_base exchanger_sb =
179 size_t nmsg = (size_t)exchanger_sb->
nsend + (
size_t)exchanger_sb->
nrecv;
187 const void * src_data,
190 Xt_exchanger_simple_base exchanger_sb =
194 exchanger_sb->
func(src_data, dst_data, nsend,
196 exchanger_sb->
msgs + (
size_t)nsend,
205 Xt_exchanger_simple_base exchanger_sb =
212 MPI_Datatype datatype_copy = MPI_DATATYPE_NULL;
213 for (
size_t i = 0; i < nmsg; ++i)
214 if (msgs[i].rank == rank) {
219 return datatype_copy;
230 if (direction ==
SEND) {
231 nmsg = (size_t)exchanger_sb->
nsend;
232 msgs = exchanger_sb->
msgs;
234 nmsg = (size_t)exchanger_sb->
nrecv;
235 msgs = exchanger_sb->
msgs + (
size_t)exchanger_sb->
nsend;
237 int *restrict ranks_ = *ranks =
xmalloc(nmsg *
sizeof (*ranks_));
238 for (
size_t i = 0; i < nmsg; ++i)
239 ranks_[i] = msgs[i].
rank;
xt_simple_exchange_func func
static void xt_exchanger_simple_base_s_exchange(Xt_exchanger exchanger, const void *src_data, void *dst_data)
const struct xt_exchanger_vtable * vtable
static int xt_exchanger_simple_base_get_msg_ranks(Xt_exchanger exchanger, enum xt_msg_direction direction, int **ranks)
redistribution of data, non-public declarations
Xt_exchanger xt_exchanger_simple_base_new(int nsend, int nrecv, struct Xt_redist_msg *send_msgs, struct Xt_redist_msg *recv_msgs, MPI_Comm comm, int tag_offset, xt_simple_exchange_func func)
add versions of standard API functions not returning on error
struct Xt_redist_msg msgs[]
static MPI_Datatype xt_exchanger_simple_base_get_MPI_Datatype(Xt_exchanger exchanger, int rank, enum xt_msg_direction direction)
void(* xt_simple_exchange_func)(const void *src_data, void *dst_data, int nsend, int nrecv, struct Xt_redist_msg *send_msgs, struct Xt_redist_msg *recv_msgs, int tag_offset, MPI_Comm comm)
static Xt_exchanger xt_exchanger_simple_base_copy(Xt_exchanger exchanger, MPI_Comm newComm, int new_tag_offset)
Xt_exchanger(* copy)(Xt_exchanger, MPI_Comm, int)
static void xt_exchanger_simple_base_delete(Xt_exchanger exchanger)
static Xt_exchanger_simple_base xt_exchanger_simple_base_alloc(size_t nmsg)
static const struct xt_exchanger_vtable exchanger_simple_base_vtable
void xt_exchanger_internal_optimize(size_t n, void *msgs, size_t msg_type_size, MPI_Comm comm)
void xt_redist_msgs_strided_destruct(size_t n, struct Xt_redist_msg *msgs, MPI_Comm comm, size_t ofs_stride)
struct Xt_exchanger_simple_base_ * Xt_exchanger_simple_base
exchanging of data based on information provided by redist's
#define xt_mpi_call(call, comm)
void xt_redist_msgs_strided_copy(size_t n, struct Xt_redist_msg *restrict src, size_t src_stride, struct Xt_redist_msg *restrict dst, size_t dst_stride, MPI_Comm comm)