63 MPI_Comm newComm,
int new_tag_offset);
66 const void * src_data,
69 const void * src_data,
75 int *restrict *ranks);
110 size_t header_size =
sizeof(*exchanger),
111 body_size = nmsg *
sizeof (exchanger->
msgs[0]);
112 exchanger =
xmalloc(header_size + body_size);
131 Xt_abort(comm,
"ERROR(xt_exchanger_simple_base_new): invalid synchronous "
132 "exchange function pointer", __FILE__, __LINE__);
134 assert((nsend >= 0) & (nrecv >= 0));
135 size_t nmsg = (size_t)nsend + (
size_t)nrecv;
138 exchanger->
comm = comm;
143 exchanger->
msgs, sizeof (exchanger->
msgs[0]),
146 exchanger->
msgs + nsend,
147 sizeof (exchanger->
msgs[0]),
149 exchanger->
s_func = s_func;
150 exchanger->
a_func = a_func;
153 sizeof(exchanger->
msgs[0]),
157 sizeof(exchanger->
msgs[0]),
165 MPI_Comm new_comm,
int new_tag_offset)
169 int nsend = exchanger_sb->
nmsg[
SEND],
171 size_t nmsg = (size_t)nsend + (
size_t)nrecv;
179 *restrict orig_msgs = exchanger_sb->
msgs;
181 new_msgs,
sizeof (*new_msgs),
183 exchanger_copy->
comm = new_comm;
194 size_t nmsg = (size_t)exchanger_sb->
nmsg[
SEND] + (
size_t)exchanger_sb->
nmsg[
RECV];
202 const void * src_data,
208 int nsend = exchanger_sb->
nmsg[
SEND];
209 exchanger_sb->
s_func(src_data, dst_data, nsend,
211 exchanger_sb->
msgs + (
size_t)nsend,
216 const void * src_data,
223 if (exchanger_sb->
a_func == NULL)
224 Xt_abort(exchanger_sb->
comm,
"ERROR(xt_exchanger_simple_base_a_exchange): "
225 "asynchronous exchange function not defined for current exchanger",
228 int nsend = exchanger_sb->
nmsg[
SEND];
229 exchanger_sb->
a_func(src_data, dst_data, nsend,
231 exchanger_sb->
msgs + (
size_t)nsend,
242 size_t nsend = (size_t)exchanger_sb->
nmsg[
SEND],
243 nmsg = (
size_t)exchanger_sb->
nmsg[direction],
244 ofs = direction ==
SEND ? 0 : nsend;
246 MPI_Datatype datatype_copy = MPI_DATATYPE_NULL;
247 for (
size_t i = 0; i < nmsg; ++i)
253 return datatype_copy;
259 int *restrict *ranks)
262 size_t nmsg = (size_t)exchanger_sb->
nmsg[direction];
264 + (direction ==
RECV ? (
size_t)exchanger_sb->
nmsg[
SEND] : 0);
265 int *restrict ranks_ = *ranks =
xmalloc(nmsg *
sizeof (*ranks_));
266 for (
size_t i = 0; i < nmsg; ++i)
267 ranks_[i] = msgs[i].
rank;
add versions of standard API functions not returning on error
xt_simple_a_exchange_func a_func
xt_simple_s_exchange_func s_func
struct Xt_redist_msg msgs[]
const struct xt_exchanger_vtable * vtable
Xt_exchanger(* copy)(Xt_exchanger, MPI_Comm, int)
void xt_exchanger_internal_optimize(size_t n, void *msgs, size_t msg_type_size, MPI_Comm comm)
exchanging of data based on information provided by redist's
static void xt_exchanger_simple_base_a_exchange(Xt_exchanger exchanger, const void *src_data, void *dst_data, Xt_request *request)
static MPI_Datatype xt_exchanger_simple_base_get_MPI_Datatype(Xt_exchanger exchanger, int rank, enum xt_msg_direction direction)
static Xt_exchanger_simple_base xt_exchanger_simple_base_alloc(size_t nmsg)
static int xt_exchanger_simple_base_get_msg_ranks(Xt_exchanger exchanger, enum xt_msg_direction direction, int *restrict *ranks)
static void xt_exchanger_simple_base_delete(Xt_exchanger exchanger)
static Xt_exchanger xt_exchanger_simple_base_copy(Xt_exchanger exchanger, MPI_Comm newComm, int new_tag_offset)
static void xt_exchanger_simple_base_s_exchange(Xt_exchanger exchanger, const void *src_data, void *dst_data)
struct Xt_exchanger_simple_base_ * Xt_exchanger_simple_base
Xt_exchanger xt_exchanger_simple_base_new(int nsend, int nrecv, const struct Xt_redist_msg *send_msgs, const struct Xt_redist_msg *recv_msgs, MPI_Comm comm, int tag_offset, xt_simple_s_exchange_func s_func, xt_simple_a_exchange_func a_func)
static const struct xt_exchanger_vtable exchanger_simple_base_vtable
void(* xt_simple_s_exchange_func)(const void *src_data, void *dst_data, int nsend, int nrecv, const struct Xt_redist_msg *send_msgs, const struct Xt_redist_msg *recv_msgs, int tag_offset, MPI_Comm comm)
void(* xt_simple_a_exchange_func)(const void *src_data, void *dst_data, int nsend, int nrecv, const struct Xt_redist_msg *send_msgs, const struct Xt_redist_msg *recv_msgs, int tag_offset, MPI_Comm comm, Xt_request *request)
#define xt_mpi_call(call, comm)
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)
void xt_redist_msgs_strided_destruct(size_t n, struct Xt_redist_msg *msgs, MPI_Comm comm, size_t ofs_stride)
redistribution of data, non-public declarations