68 MPI_Aint extent,
const int *displacements,
Xt_redist redist,
71 MPI_Datatype (*get_MPI_datatype)(
Xt_redist,
int)) {
77 size_t num_messages = (size_t)*nmsgs;
78 int *restrict ranks = NULL;
82 =
xrealloc(*msgs,
sizeof (*p) * (num_messages + num_ranks));
83 for (
size_t i = 0; i < num_ranks; ++i) {
84 MPI_Datatype
datatype = get_MPI_datatype(redist, ranks[i]);
85 MPI_Aint curr_lb, curr_extent;
86 MPI_Datatype datatype_with_extent;
89 xt_mpi_call(MPI_Type_get_extent(datatype, &curr_lb, &curr_extent), comm);
90 xt_mpi_call(MPI_Type_create_resized(datatype, curr_lb, extent,
91 &datatype_with_extent), comm);
93 p[num_messages + i].rank = ranks[i];
94 p[num_messages + i].datatype
96 datatype_with_extent, comm);
97 MPI_Type_free(&datatype_with_extent);
98 MPI_Type_free(&datatype);
102 *nmsgs = (int)(num_messages + num_ranks);
106 MPI_Aint dst_extent,
int num_repetitions,
107 const int src_displacements[num_repetitions],
108 const int dst_displacements[num_repetitions]) {
110 int nsend = 0, nrecv = 0;
116 if (num_repetitions < 1)
117 Xt_abort(comm,
"ERROR: invalid number of repetitions (Xt_redist_repeat)\n",
122 src_displacements, redist, num_repetitions, comm,
126 dst_displacements, redist, num_repetitions, comm,
136 MPI_Aint dst_extent,
int num_repetitions,
137 const int displacements[num_repetitions]) {
140 dst_extent, num_repetitions,
redistribution of data, non-public declarations
add versions of standard API functions not returning on error
MPI_Datatype xt_redist_get_send_MPI_Datatype(Xt_redist redist, int rank)
MPI_Datatype xt_redist_get_recv_MPI_Datatype(Xt_redist redist, int rank)
#define xrealloc(ptr, size)
Xt_redist xt_redist_repeat_new(Xt_redist redist, MPI_Aint src_extent, MPI_Aint dst_extent, int num_repetitions, const int displacements[num_repetitions])
static void generate_msg_infos(struct Xt_redist_msg **msgs, int *nmsgs, MPI_Aint extent, const int *displacements, Xt_redist redist, int num_repetitions, MPI_Comm comm, enum xt_msg_direction direction, MPI_Datatype(*get_MPI_datatype)(Xt_redist, int))
Xt_redist xt_redist_single_array_base_new(int nsend, int nrecv, struct Xt_redist_msg *send_msgs, struct Xt_redist_msg *recv_msgs, MPI_Comm comm)
Xt_redist xt_redist_repeat_asym_new(Xt_redist redist, MPI_Aint src_extent, MPI_Aint dst_extent, int num_repetitions, const int src_displacements[num_repetitions], const int dst_displacements[num_repetitions])
MPI_Datatype xt_mpi_generate_datatype(int const *displacements, int count, MPI_Datatype old_type, MPI_Comm comm)
MPI_Comm xt_mpi_comm_smart_dup(MPI_Comm comm, int *tag_offset)
void xt_mpi_comm_smart_dedup(MPI_Comm *comm, int tag_offset)
int xt_redist_get_msg_ranks(Xt_redist redist, enum xt_msg_direction direction, int **ranks)
#define xt_mpi_call(call, comm)
MPI_Comm xt_redist_get_MPI_Comm(Xt_redist redist)