75static const char filename[] =
"xt_xmap_intersection.c";
79#if __GNUC__ >= 11 && __GNUC__ <= 13 && defined MPICH
80#pragma GCC diagnostic push
81#pragma GCC diagnostic ignored "-Wstringop-overread"
82#pragma GCC diagnostic ignored "-Wstringop-overflow"
114 const int * src_positions,
115 const int * dst_positions);
118 const int src_displacements[num_repetitions],
119 const int dst_displacements[num_repetitions]);
129 .get_num_transfer_pos_ext
137 const struct Xt_xmap_iter_vtable *
vtable;
139 struct exchange_data *
msg;
187 struct exchange_data
msg[];
202 return xmap_intersection->
comm;
210 return xmap_intersection->
n_out;
218 return xmap_intersection->
n_in;
225 = xmap_intersection->
msg + xmap_intersection->
n_in;
226 for (
int i = 0; i < xmap_intersection->
n_out; ++i)
227 ranks[i] = out_msg[i].
rank;
234 for (
int i = 0; i < xmap_intersection->
n_in; ++i)
235 ranks[i] = in_msg[i].
rank;
251 int num_intersections,
252 const struct
Xt_com_list intersections[num_intersections],
255 int *restrict num_indices_to_remove_per_intersection)
258 size_t coverage_size = (size_t)mypart_num_indices;
261 unsigned long *restrict coverage =
xcalloc(coverage_size,
sizeof(*coverage));
264 coverage[coverage_size-1]
267 int new_num_intersections = 0;
268 size_t total_num_indices_to_remove = 0;
269 size_t curr_indices_to_remove_size = 0;
271 int *restrict intersection_pos = NULL;
273 for (
int i = 0; i < num_intersections; ++i) {
275 const Xt_int *restrict intersection_idxvec
277 int max_intersection_size
281 (
size_t)max_intersection_size *
sizeof(*intersection_pos));
287 mypart_idxlist, intersection_idxvec, max_intersection_size,
288 intersection_pos, 1);
294 int intersection_size = 0;
295 int num_indices_to_remove_isect = 0;
299 total_num_indices_to_remove
300 + (
size_t)max_intersection_size);
302 for (
int j = 0; j < max_intersection_size; ++j) {
304 int pos = intersection_pos[j];
314 intersection_pos[intersection_size] = pos;
316 + (size_t)num_indices_to_remove_isect]
317 = intersection_idxvec[j];
318 intersection_size += is_duplicate ^ 1;
319 num_indices_to_remove_isect += is_duplicate;
323 total_num_indices_to_remove += (size_t)num_indices_to_remove_isect;
324 num_indices_to_remove_per_intersection[i] = num_indices_to_remove_isect;
326 if (intersection_size > 0) {
327 resSets[new_num_intersections].transfer_pos = intersection_pos;
328 resSets[new_num_intersections].num_transfer_pos = intersection_size;
329 resSets[new_num_intersections].transfer_pos_ext_cache = NULL;
330 resSets[new_num_intersections].num_transfer_pos_ext
331 = (int)
count_pos_ext((
size_t)intersection_size, intersection_pos);
332 resSets[new_num_intersections].rank = intersections[i].rank;
333 new_num_intersections++;
334 intersection_pos = NULL;
337 free(intersection_pos);
344 unsigned long all_bits_set = ~0UL;
345 for (
size_t i = 0; i < coverage_size; ++i)
346 all_bits_set &= coverage[i];
351 .resCount = new_num_intersections,
352 .all_dst_covered = all_bits_set == ~0UL };
364 intersections[num_intersections],
367 const Xt_int *indices_to_remove,
368 const int *num_indices_to_remove_per_intersection)
370 int new_num_intersections = 0;
373 Xt_int * new_intersection_idxvec = NULL;
374 size_t curr_new_intersection_idxvec_size = 0;
375 int *restrict intersection_pos = NULL;
378 for (
int i = 0; i < num_intersections; ++i) {
380 const Xt_int *restrict intersection_idxvec
382 int intersection_size
384 intersection_pos =
xrealloc(intersection_pos,
385 (
size_t)intersection_size
386 *
sizeof(*intersection_pos));
388 int num_indices_to_remove = num_indices_to_remove_per_intersection[i];
389 if (num_indices_to_remove > 0) {
392 new_intersection_idxvec, curr_new_intersection_idxvec_size,
393 intersection_size - num_indices_to_remove + 1);
394 int new_intersection_size = 0;
396 for (
int j = 0; j < intersection_size; ++j) {
400 Xt_int idx = intersection_idxvec[j];
403 for (
int k = 0; k < num_indices_to_remove; ++k)
404 discard |= (idx == indices_to_remove[offset + k]);
406 new_intersection_idxvec[new_intersection_size] = idx;
407 new_intersection_size += !discard;
410 intersection_idxvec = new_intersection_idxvec;
411 intersection_size = new_intersection_size;
412 offset = offset + num_indices_to_remove;
419 mypart_idxlist, intersection_idxvec, intersection_size,
420 intersection_pos, 0);
423 if (intersection_size > 0) {
424 resSets[new_num_intersections].transfer_pos = intersection_pos;
425 resSets[new_num_intersections].num_transfer_pos = intersection_size;
426 for (
int j = 0; j < intersection_size; ++j)
427 if (intersection_pos[j] > max_pos_) max_pos_ = intersection_pos[j];
428 resSets[new_num_intersections].transfer_pos_ext_cache = NULL;
429 resSets[new_num_intersections].num_transfer_pos_ext
430 = (int)
count_pos_ext((
size_t)intersection_size, intersection_pos);
431 resSets[new_num_intersections].rank = intersections[i].rank;
432 new_num_intersections++;
433 intersection_pos = NULL;
437 free(new_intersection_idxvec);
438 free(intersection_pos);
441 .count = new_num_intersections };
447 src_com[num_src_intersections],
448 int num_dst_intersections,
450 dst_com[num_dst_intersections],
451 int *restrict num_src_indices_to_remove_per_intersection,
452 Xt_int *dst_indices_to_remove,
454 num_dst_indices_to_remove_per_intersection,
458 MPI_Request * requests
459 =
xmalloc((
size_t)(num_src_intersections + 2 * num_dst_intersections) *
461 MPI_Request *send_header_requests = requests,
462 *recv_requests = requests + num_dst_intersections,
463 *send_data_requests = recv_requests + num_src_intersections;
466 for (
int i = 0; i < num_src_intersections; ++i)
468 num_src_indices_to_remove_per_intersection + i, 1, MPI_INT,
471 comm, recv_requests+i), comm);
476 unsigned num_nonempty_dst_intersections = 0;
477 for (
int i = 0; i < num_dst_intersections; ++i) {
480 num_dst_indices_to_remove_per_intersection + i), 1, MPI_INT,
483 comm, send_header_requests + i), comm);
485 if (num_dst_indices_to_remove_per_intersection[i] > 0) {
488 dst_indices_to_remove + offset,
489 num_dst_indices_to_remove_per_intersection[i],
Xt_int_dt,
492 comm, send_data_requests + num_nonempty_dst_intersections),
494 offset += num_dst_indices_to_remove_per_intersection[i];
495 ++num_nonempty_dst_intersections;
500 xt_mpi_call(MPI_Waitall(num_src_intersections + num_dst_intersections,
501 send_header_requests, MPI_STATUSES_IGNORE), comm);
503 size_t total_num_src_indices_to_recv = 0;
505 for (
int i = 0; i < num_src_intersections; ++i)
506 total_num_src_indices_to_recv
507 += (
size_t)num_src_indices_to_remove_per_intersection[i];
509 unsigned num_nonempty_src_intersections = 0;
510 Xt_int *src_indices_to_remove;
511 if (total_num_src_indices_to_recv > 0) {
513 src_indices_to_remove =
xmalloc(total_num_src_indices_to_recv
514 *
sizeof(*src_indices_to_remove));
518 for (
int i = 0; i < num_src_intersections; ++i)
519 if (num_src_indices_to_remove_per_intersection[i] > 0) {
520 ++num_nonempty_src_intersections;
522 src_indices_to_remove + offset,
523 num_src_indices_to_remove_per_intersection[i],
527 send_data_requests - num_nonempty_src_intersections),
530 offset += num_src_indices_to_remove_per_intersection[i];
534 src_indices_to_remove = NULL;
538 xt_mpi_call(MPI_Waitall((
int)num_nonempty_src_intersections
539 + (
int)num_nonempty_dst_intersections,
540 send_data_requests-num_nonempty_src_intersections,
541 MPI_STATUSES_IGNORE), comm);
543 return src_indices_to_remove;
548 int num_src_intersections,
549 const struct Xt_com_list src_com[num_src_intersections],
550 int num_dst_intersections,
551 const struct Xt_com_list dst_com[num_dst_intersections],
556 int *num_src_indices_to_remove_per_intersection =
557 xmalloc(((
size_t)num_src_intersections + (
size_t)num_dst_intersections)
559 *num_dst_indices_to_remove_per_intersection =
560 num_src_indices_to_remove_per_intersection + num_src_intersections;
564 num_dst_intersections, dst_com, dst_idxlist_local, xmap->
msg,
565 num_dst_indices_to_remove_per_intersection);
570 Xt_int *src_indices_to_remove
572 num_src_intersections, src_com, num_dst_intersections, dst_com,
573 num_src_indices_to_remove_per_intersection,
574 dst_indices_to_remove, num_dst_indices_to_remove_per_intersection,
577 free(dst_indices_to_remove);
578 num_src_indices_to_remove_per_intersection
579 =
xrealloc(num_src_indices_to_remove_per_intersection,
580 (
size_t)num_src_intersections *
sizeof(
int));
584 num_src_intersections, src_com, src_idxlist_local, xmap->
msg + xmap->
n_in,
585 src_indices_to_remove, num_src_indices_to_remove_per_intersection);
589 free(src_indices_to_remove);
590 free(num_src_indices_to_remove_per_intersection);
591 return all_dst_covered;
597 src_com[num_src_intersections],
598 int num_dst_intersections,
600 dst_com[num_dst_intersections],
605 num_src_intersections, src_com,
606 num_dst_intersections, dst_com,
612 int num_src_intersections,
613 const struct Xt_com_list src_com[num_src_intersections],
614 int num_dst_intersections,
615 const struct Xt_com_list dst_com[num_dst_intersections],
624 = (size_t)num_dst_intersections + (
size_t)num_src_intersections;
634 num_src_intersections, src_com,
635 num_dst_intersections, dst_com,
636 src_idxlist, dst_idxlist, comm)) {
640 int * found_index_mask =
xcalloc((
size_t)num_dst_indices,
641 sizeof(*found_index_mask));
642 int * index_positions =
xmalloc((
size_t)num_dst_indices
643 *
sizeof(*index_positions));
645 for (
size_t i = 0; i < (size_t)num_dst_intersections; ++i) {
647 num_dst_indices, index_positions, 0);
648 for (
size_t j = 0; j < (size_t)num_dst_indices; ++j)
649 found_index_mask[j] |= index_positions[j] != -1;
652 int first_missing_pos = 0;
653 while ((first_missing_pos < (num_dst_indices - 1)) &&
654 (found_index_mask[first_missing_pos])) ++first_missing_pos;
655 free(found_index_mask);
656 free(index_positions);
661 int n_in = xmap->
n_in, n_out = xmap->
n_out;
662 size_t new_num_isect = (size_t)n_in + (
size_t)n_out;
663 if (new_num_isect != num_isect)
664 xmap =
xrealloc(xmap,
sizeof (*xmap) + (new_num_isect
682 int *pos,
const int *orig_pos,
687 int *pos,
const int *orig_pos,
const void *state)
690 memcpy(pos, orig_pos,
sizeof (*pos) * num_pos);
699 int *max_pos_,
int num_repetitions,
700 Xt_pos_copy pos_copy,
const void *pos_copy_state) {
701 *nmsg_copy = (int)nmsg;
703 for (
size_t i = 0; i < nmsg; ++i) {
704 size_t num_transfer_pos
705 = (size_t)(msg_copy[i].num_transfer_pos
706 = num_repetitions * msg[i].num_transfer_pos);
707 msg_copy[i].rank = msg[i].rank;
708 msg_copy[i].transfer_pos_ext_cache = NULL;
709 size_t size_transfer_pos
710 = num_transfer_pos *
sizeof (*(msg[i].transfer_pos));
711 msg_copy[i].transfer_pos =
xmalloc(size_transfer_pos);
713 = pos_copy(num_transfer_pos,
714 msg_copy[i].transfer_pos, msg[i].transfer_pos,
719 msg_copy[i].num_transfer_pos_ext = msg[i].num_transfer_pos_ext;
721 msg_copy[i].num_transfer_pos_ext =
722 (int)(
count_pos_ext(num_transfer_pos, msg_copy[i].transfer_pos));
735 size_t n_in = (size_t)xmap_intersection->
n_in,
736 n_out = (
size_t)xmap_intersection->
n_out,
737 num_isect = n_in + n_out;
738 xmap_intersection_new
739 =
xmalloc(
sizeof (*xmap_intersection_new)
741 xmap_intersection_new->vtable = xmap_intersection->
vtable;
742 xmap_intersection_new->n_in = (int)n_in;
743 xmap_intersection_new->n_out = (int)n_out;
744 xmap_intersection_new->max_src_pos = xmap_intersection->
max_src_pos;
745 xmap_intersection_new->max_dst_pos = xmap_intersection->
max_dst_pos;
747 &xmap_intersection_new->n_in,
748 xmap_intersection_new->msg,
749 &xmap_intersection_new->max_dst_pos,
751 pos_copy_in, pci_state);
753 &xmap_intersection_new->n_out,
754 xmap_intersection_new->msg+n_in,
755 &xmap_intersection_new->max_src_pos,
757 pos_copy_out, pco_state);
758 xmap_intersection_new->comm
760 &xmap_intersection_new->tag_offset);
761 return (
Xt_xmap)xmap_intersection_new;
774 for (
int i = 0; i < nmsg; ++i) {
775 free(msg[i].transfer_pos_ext_cache);
776 free(msg[i].transfer_pos);
784 int num_isect = xmap_intersection->
n_in + xmap_intersection->
n_out;
788 free(xmap_intersection);
795 if (xmap_intersection->
n_in == 0)
801 iter->
msg = xmap_intersection->
msg;
811 if (xmap_intersection->
n_out == 0)
817 iter->
msg = xmap_intersection->
msg + xmap_intersection->
n_in;
828static inline struct a2abuf
831 size_t buffer_size = 0;
832 for (
int i = 0; i < n; ++i)
833 buffer_size += (
size_t)msgs[i].num_transfer_pos;
835 int *restrict
counts =
xmalloc((2 * (
size_t)comm_size + buffer_size)
839 for (
int i = 0; i < comm_size; ++i)
842 for (
int i = 0; i < n; ++i)
843 counts[msgs[i].rank] = msgs[i].num_transfer_pos;
845 for (
int i = 0, accu = 0; i < comm_size; ++i) {
857 xt_mpi_call(MPI_Comm_size(comm, &comm_size), comm);
864 for (
int i = 0; i < n_out; ++i) {
878 in.buffer, in.counts, in.displs, MPI_INT,
881 void (*sort_int_permutation)(
int a[],
size_t n,
int permutation[])
883 for (
int i = 0; i < n_in; ++i) {
889 sort_int_permutation(
890 in.buffer + in.displs[curr_msg->
rank], (
size_t)count,
897 for (
int i = 0; i < n_out; ++i) {
904 for (
int i = 0; i < n_in; ++i) {
920 int n_out = xmap_intersection_new->
n_out,
921 n_in = xmap_intersection_new->
n_in;
923 *out_msg = in_msg+n_in;
936 Xt_abort(comm,
"ERROR(xmap_intersection_reorder):invalid reorder type",
940 return (
Xt_xmap)xmap_intersection_new;
945 int *restrict pos,
const int *restrict orig_pos,
946 const void *new_pos_)
948 const int *restrict new_pos = new_pos_;
950 for (
size_t i = 0; i < num_pos; ++i) {
951 int np = new_pos[orig_pos[i]];
961 const int *src_positions,
962 const int *dst_positions) {
977 const int *restrict orig_pos,
const void *state)
986 for (
size_t j = 0; j < num_pos; ++j, ++k) {
987 int np = orig_pos[j] + curr_disp;
1006 .displacements = src_displacements },
1010 .displacements = dst_displacements });
1016 size_t num_pos, const int *restrict pos,
1017 int *restrict pos_copy)
1019 size_t i = 0, j = 1;
1021 int start = pos_copy[0] = pos[0];
1025 && (pos_copy[j] = pos[j]) ==
start + (~
direction & (
int)(j - i)) +
1027 pos_copy[j] = pos[j];
1039 int *restrict pos_copy)
1041 size_t i = 0, num_pos_ext = 0;
1042 while (i < num_pos) {
1046 if (max_of_run > max_pos) max_pos = max_of_run;
1049 return (
struct pos_count_max){ .count = (int)num_pos_ext, .max_pos = max_pos };
1054 const struct Xt_com_pos *restrict com,
int *max_pos) {
1057 for (
int i = 0; i < count; ++i) {
1058 int num_transfer_pos = com[i].num_transfer_pos;
1059 int *restrict transfer_pos =
1060 xmalloc((
size_t)num_transfer_pos *
sizeof(*transfer_pos));
1061 msgs[i].transfer_pos = transfer_pos;
1062 msgs[i].transfer_pos_ext_cache = NULL;
1063 msgs[i].num_transfer_pos = num_transfer_pos;
1064 msgs[i].rank = com[i].rank;
1067 com[i].transfer_pos, transfer_pos);
1068 msgs[i].num_transfer_pos_ext = max_count.
count;
1076 int num_src_msg,
const struct Xt_com_pos src_com[num_src_msg],
1077 int num_dst_msg,
const struct Xt_com_pos dst_com[num_dst_msg],
1083 size_t num_msg = (size_t)num_src_msg + (
size_t)num_dst_msg;
1088 xmap->
n_in = num_dst_msg;
1089 xmap->
n_out = num_src_msg;
1094 num_src_msg, xmap->
msg + num_dst_msg, src_com, &xmap->
max_src_pos);
1103 if (iter_intersection == NULL || iter_intersection->
msgs_left == 0)
1106 iter_intersection->
msg++;
1114 assert(iter != NULL);
1121 assert(iter != NULL);
1128 assert(iter != NULL);
1129 if (!
xmii(iter)->msg->transfer_pos_ext_cache) {
1130 size_t num_transfer_pos_ext = (size_t)((
size_t)
xmii(iter)->msg->num_transfer_pos_ext);
1133 xmalloc(num_transfer_pos_ext *
sizeof(*transfer_pos_ext)));
1135 xmii(iter)->msg->transfer_pos,
1136 num_transfer_pos_ext, transfer_pos_ext);
1143 assert(iter != NULL);
1150 assert(iter != NULL);
#define ENSURE_ARRAY_SIZE(arrayp, curr_array_size, req_size)
add versions of standard API functions not returning on error
#define xrealloc(ptr, size)
#define xcalloc(nmemb, size)
const struct Xt_sort_algo_funcptr * sort_funcs
void(* sort_int)(int *a, size_t n)
void(* sort_int_permutation)(int a[], size_t n, int permutation[])
const struct Xt_xmap_vtable * vtable
struct exchange_data msg[]
const struct Xt_xmap_iter_vtable * vtable
struct exchange_data * msg
struct Xt_pos_ext * transfer_pos_ext_cache
const int *restrict displacements
Xt_int * indices_to_remove
static int isign_mask(int x)
static const char filename[]
struct Xt_config_ xt_default_config
struct Xt_config_ * Xt_config
implementation of configuration object
struct Xt_xmap_ * Xt_xmap
struct Xt_idxlist_ * Xt_idxlist
int xt_idxlist_get_positions_of_indices(Xt_idxlist idxlist, const Xt_int *indices, int num_indices, int *positions, int single_match_only)
const Xt_int * xt_idxlist_get_indices_const(Xt_idxlist idxlist)
Provide non-public declarations common to all index lists.
#define xt_idxlist_get_num_indices(idxlist)
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)
#define xt_mpi_call(call, comm)
@ xt_mpi_tag_xmap_intersection_data_exchange
@ xt_mpi_tag_xmap_intersection_header_exchange
exchange map declarations
struct Xt_xmap_iter_ * Xt_xmap_iter
@ XT_REORDER_RECV_UP
optimise data access on receiver side
@ XT_REORDER_NONE
no reordering
@ XT_REORDER_SEND_UP
optimise data access on sender side
contains declaration for the exchange map data structure
static const struct Xt_xmap_vtable xmap_intersection_vtable
static struct pos_count_max max_count_pos_ext_and_copy(int max_pos, size_t num_pos, const int *restrict pos, int *restrict pos_copy)
static Xt_xmap xmap_intersection_update_positions(Xt_xmap xmap, const int *src_positions, const int *dst_positions)
static Xt_xmap xmap_intersection_copy_(Xt_xmap xmap, int num_repetitions, Xt_pos_copy pos_copy_in, const void *pci_state, Xt_pos_copy pos_copy_out, const void *pco_state)
static Xt_int * exchange_points_to_remove(int num_src_intersections, const struct Xt_com_list src_com[num_src_intersections], int num_dst_intersections, const struct Xt_com_list dst_com[num_dst_intersections], int *restrict num_src_indices_to_remove_per_intersection, Xt_int *dst_indices_to_remove, const int *restrict num_dst_indices_to_remove_per_intersection, int tag_offset, MPI_Comm comm)
static Xt_xmap_iter xmap_intersection_get_in_iterator(Xt_xmap xmap)
struct Xt_xmap_iter_intersection_ * Xt_xmap_iter_intersection
static Xt_xmap xmap_intersection_spread(Xt_xmap xmap, int num_repetitions, const int src_displacements[num_repetitions], const int dst_displacements[num_repetitions])
static const struct Xt_xmap_iter_vtable xmap_iterator_intersection_vtable
static int xmap_intersection_iterator_get_rank(Xt_xmap_iter iter)
static struct a2abuf setup_buffer(int comm_size, int n, const struct exchange_data *msgs)
static Xt_xmap_intersection xmi(void *xmap)
static void xmap_intersection_msg_delete(int nmsg, struct exchange_data *msg)
struct Xt_xmap_intersection_ * Xt_xmap_intersection
static int pos_copy_verbatim(size_t num_pos, int *pos, const int *orig_pos, const void *state)
static void xmap_intersection_get_source_ranks(Xt_xmap xmap, int *ranks)
static void init_exchange_data_from_com_pos(int count, struct exchange_data *restrict msgs, const struct Xt_com_pos *restrict com, int *max_pos)
static int xmap_intersection_get_max_dst_pos(Xt_xmap xmap)
static void xmap_intersection_get_destination_ranks(Xt_xmap xmap, int *ranks)
Xt_xmap xt_xmap_intersection_pos_new(int num_src_msg, const struct Xt_com_pos src_com[num_src_msg], int num_dst_msg, const struct Xt_com_pos dst_com[num_dst_msg], MPI_Comm comm)
static int xmap_intersection_get_num_sources(Xt_xmap xmap)
Xt_xmap xt_xmap_intersection_new(int num_src_intersections, const struct Xt_com_list src_com[num_src_intersections], int num_dst_intersections, const struct Xt_com_list dst_com[num_dst_intersections], Xt_idxlist src_idxlist, Xt_idxlist dst_idxlist, MPI_Comm comm)
static Xt_xmap xmap_intersection_copy(Xt_xmap xmap)
static int pos_copy_spread(size_t num_pos, int *restrict pos, const int *restrict orig_pos, const void *state)
static void reorder_transfer_pos(int n_out, int n_in, struct exchange_data *out_msg, struct exchange_data *in_msg, MPI_Comm comm, Xt_config config)
static MPI_Comm xmap_intersection_get_communicator(Xt_xmap xmap)
static void xmap_intersection_delete(Xt_xmap xmap)
static void xmap_intersection_msg_copy(size_t nmsg, const struct exchange_data *restrict msg, int *nmsg_copy, struct exchange_data *restrict msg_copy, int *max_pos_, int num_repetitions, Xt_pos_copy pos_copy, const void *pos_copy_state)
static struct pos_count_max generate_dir_transfer_pos_src(int num_intersections, const struct Xt_com_list intersections[num_intersections], Xt_idxlist mypart_idxlist, struct exchange_data *restrict resSets, const Xt_int *indices_to_remove, const int *num_indices_to_remove_per_intersection)
static void xmap_intersection_iterator_delete(Xt_xmap_iter iter)
static Xt_xmap_iter_intersection xmii(void *iter)
static int subst_positions(size_t num_pos, int *restrict pos, const int *restrict orig_pos, const void *new_pos_)
static struct pos_run copy_get_pos_run_len(size_t num_pos, const int *restrict pos, int *restrict pos_copy)
static int xmap_intersection_iterator_next(Xt_xmap_iter iter)
static Xt_xmap_iter xmap_intersection_get_out_iterator(Xt_xmap xmap)
static int const * xmap_intersection_iterator_get_transfer_pos(Xt_xmap_iter iter)
static int xmap_intersection_iterator_get_num_transfer_pos_ext(Xt_xmap_iter iter)
static int xmap_intersection_get_num_destinations(Xt_xmap xmap)
static const struct Xt_pos_ext * xmap_intersection_iterator_get_transfer_pos_ext(Xt_xmap_iter iter)
static int xmap_intersection_iterator_get_num_transfer_pos(Xt_xmap_iter iter)
static int xmap_intersection_get_max_src_pos(Xt_xmap xmap)
static struct tpd_result generate_dir_transfer_pos_dst(int num_intersections, const struct Xt_com_list intersections[num_intersections], Xt_idxlist mypart_idxlist, struct exchange_data *restrict resSets, int *restrict num_indices_to_remove_per_intersection)
static Xt_xmap xmap_intersection_reorder(Xt_xmap xmap, enum xt_reorder_type type, Xt_config config)
Xt_xmap xt_xmap_intersection_custom_new(int num_src_intersections, const struct Xt_com_list src_com[num_src_intersections], int num_dst_intersections, const struct Xt_com_list dst_com[num_dst_intersections], Xt_idxlist src_idxlist, Xt_idxlist dst_idxlist, MPI_Comm comm, Xt_config XT_UNUSED(config))
int(* Xt_pos_copy)(size_t num_pos, int *pos, const int *orig_pos, const void *state)
static int generate_transfer_pos(struct Xt_xmap_intersection_ *xmap, int num_src_intersections, const struct Xt_com_list src_com[num_src_intersections], int num_dst_intersections, const struct Xt_com_list dst_com[num_dst_intersections], Xt_idxlist src_idxlist_local, Xt_idxlist dst_idxlist_local, MPI_Comm comm)
Utility functions shared by xt_xmap_intersection and xt_xmap_intersection_ext.
static void print_miss_msg(Xt_idxlist dst_idxlist, int missing_pos, MPI_Comm comm, const char *source, int line) __attribute__((noreturn))
static size_t count_pos_ext(size_t num_pos, const int *restrict pos)
static void generate_pos_ext(size_t num_pos, const int *restrict pos, size_t num_pos_ext, struct Xt_pos_ext *restrict pos_ext)