Yet Another eXchange Tool  0.9.0
Classes | Typedefs | Enumerations | Functions | Variables
xt_xmap_intersection.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
#include <mpi.h>
#include "xt/xt_idxlist.h"
#include "xt/xt_idxvec.h"
#include "xt/xt_xmap.h"
#include "xt_xmap_internal.h"
#include "xt/xt_mpi.h"
#include "xt_mpi_internal.h"
#include "core/core.h"
#include "core/ppm_xfuncs.h"
#include "xt/xt_xmap_intersection.h"
#include "xt_xmap_intersection_common.h"
#include "ensure_array_size.h"
#include "xt_arithmetic_util.h"
#include "xt/quicksort.h"
Include dependency graph for xt_xmap_intersection.c:

Go to the source code of this file.

Classes

struct  Xt_xmap_iter_intersection_
 
struct  exchange_data
 
struct  Xt_xmap_intersection_
 
struct  tpd_result
 
struct  tps_result
 
struct  a2abuf
 
struct  spread_state
 

Typedefs

typedef struct Xt_xmap_iter_intersection_Xt_xmap_iter_intersection
 
typedef struct Xt_xmap_intersection_Xt_xmap_intersection
 
typedef int(* Xt_pos_copy) (size_t num_pos, int *pos, const int *orig_pos, void *state)
 
typedef void(* Xt_pos_ncopy) (size_t num_pos, int *pos, const int *orig_pos, void *state, int num_repetitions, const int displacements[num_repetitions])
 

Enumerations

enum  { bitsPerCoverageElement = sizeof (unsigned long) * CHAR_BIT }
 

Functions

static MPI_Comm xmap_intersection_get_communicator (Xt_xmap xmap)
 
static int xmap_intersection_get_num_destinations (Xt_xmap xmap)
 
static int xmap_intersection_get_num_sources (Xt_xmap xmap)
 
static void xmap_intersection_get_destination_ranks (Xt_xmap xmap, int *ranks)
 
static void xmap_intersection_get_source_ranks (Xt_xmap xmap, int *ranks)
 
static Xt_xmap_iter xmap_intersection_get_in_iterator (Xt_xmap xmap)
 
static Xt_xmap_iter xmap_intersection_get_out_iterator (Xt_xmap xmap)
 
static Xt_xmap xmap_intersection_copy (Xt_xmap xmap)
 
static void xmap_intersection_delete (Xt_xmap xmap)
 
static int xmap_intersection_iterator_next (Xt_xmap_iter iter)
 
static int xmap_intersection_iterator_get_rank (Xt_xmap_iter iter)
 
static int const * xmap_intersection_iterator_get_transfer_pos (Xt_xmap_iter iter)
 
static int xmap_intersection_iterator_get_num_transfer_pos (Xt_xmap_iter iter)
 
static const struct Xt_pos_extxmap_intersection_iterator_get_transfer_pos_ext (Xt_xmap_iter iter)
 
static int xmap_intersection_iterator_get_num_transfer_pos_ext (Xt_xmap_iter iter)
 
static void xmap_intersection_iterator_delete (Xt_xmap_iter iter)
 
static int xmap_intersection_get_max_src_pos (Xt_xmap xmap)
 
static int xmap_intersection_get_max_dst_pos (Xt_xmap xmap)
 
static Xt_xmap xmap_intersection_reorder (Xt_xmap xmap, enum xt_reorder_type type)
 
static Xt_xmap xmap_intersection_update_positions (Xt_xmap xmap, const int *src_positions, const int *dst_positions)
 
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 Xt_xmap_iter_intersection xmii (void *iter)
 
static Xt_xmap_intersection xmi (void *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 struct tps_result 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 Xt_intexchange_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 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)
 
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 int pos_copy_verbatim (size_t num_pos, int *pos, const int *orig_pos, void *state)
 
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, void *pos_copy_state)
 
static Xt_xmap xmap_intersection_copy_ (Xt_xmap xmap, int num_repetitions, Xt_pos_copy pos_copy_in, void *pci_state, Xt_pos_copy pos_copy_out, void *pco_state)
 
static void xmap_intersection_msg_delete (int nmsg, struct exchange_data *msg)
 
static struct a2abuf setup_buffer (int comm_size, int n, const struct exchange_data *msgs)
 
static void reorder_transfer_pos (int n_out, int n_in, struct exchange_data *out_msg, struct exchange_data *in_msg, MPI_Comm comm)
 
static int subst_positions (size_t num_pos, int *restrict pos, const int *restrict orig_pos, void *new_pos_)
 
static int pos_copy_spread (size_t num_pos, int *restrict pos, const int *restrict orig_pos, void *state)
 
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)
 
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)
 

Variables

static const struct Xt_xmap_iter_vtable xmap_iterator_intersection_vtable
 
static const struct Xt_xmap_vtable xmap_intersection_vtable
 

Detailed Description

Author
Jörg Behrens behre.nosp@m.ns@d.nosp@m.krz.d.nosp@m.e Moritz Hanke hanke.nosp@m.@dkr.nosp@m.z.de Thomas Jahns jahns.nosp@m.@dkr.nosp@m.z.de

Definition in file xt_xmap_intersection.c.

Typedef Documentation

◆ Xt_pos_copy

typedef int(* Xt_pos_copy) (size_t num_pos, int *pos, const int *orig_pos, void *state)

Definition at line 651 of file xt_xmap_intersection.c.

◆ Xt_pos_ncopy

typedef void(* Xt_pos_ncopy) (size_t num_pos, int *pos, const int *orig_pos, void *state, int num_repetitions, const int displacements[num_repetitions])

Definition at line 664 of file xt_xmap_intersection.c.

◆ Xt_xmap_intersection

Definition at line 176 of file xt_xmap_intersection.c.

◆ Xt_xmap_iter_intersection

Definition at line 119 of file xt_xmap_intersection.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
bitsPerCoverageElement 

Definition at line 224 of file xt_xmap_intersection.c.

Function Documentation

◆ exchange_points_to_remove()

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

Definition at line 431 of file xt_xmap_intersection.c.

Here is the caller graph for this function:

◆ generate_dir_transfer_pos_dst()

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

Definition at line 216 of file xt_xmap_intersection.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_dir_transfer_pos_src()

static struct tps_result 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

Definition at line 216 of file xt_xmap_intersection.c.

Here is the caller graph for this function:

◆ generate_transfer_pos()

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 
)
static

Definition at line 533 of file xt_xmap_intersection.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_exchange_data_from_com_pos()

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

Definition at line 978 of file xt_xmap_intersection.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pos_copy_spread()

static int pos_copy_spread ( size_t  num_pos,
int *restrict  pos,
const int *restrict  orig_pos,
void *  state 
)
static

Definition at line 941 of file xt_xmap_intersection.c.

Here is the caller graph for this function:

◆ pos_copy_verbatim()

static int pos_copy_verbatim ( size_t  num_pos,
int *  pos,
const int *  orig_pos,
void *  state 
)
static

Definition at line 656 of file xt_xmap_intersection.c.

Here is the caller graph for this function:

◆ reorder_transfer_pos()

static void reorder_transfer_pos ( int  n_out,
int  n_in,
struct exchange_data out_msg,
struct exchange_data in_msg,
MPI_Comm  comm 
)
static

Definition at line 826 of file xt_xmap_intersection.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_buffer()

static struct a2abuf setup_buffer ( int  comm_size,
int  n,
const struct exchange_data msgs 
)
inlinestatic

Definition at line 781 of file xt_xmap_intersection.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ subst_positions()

static int subst_positions ( size_t  num_pos,
int *restrict  pos,
const int *restrict  orig_pos,
void *  new_pos_ 
)
static

Definition at line 910 of file xt_xmap_intersection.c.

Here is the caller graph for this function:

◆ xmap_intersection_copy()

static Xt_xmap xmap_intersection_copy ( Xt_xmap  xmap)
static

Definition at line 739 of file xt_xmap_intersection.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xmap_intersection_copy_()

static Xt_xmap xmap_intersection_copy_ ( Xt_xmap  xmap,
int  num_repetitions,
Xt_pos_copy  pos_copy_in,
void *  pci_state,
Xt_pos_copy  pos_copy_out,
void *  pco_state 
)
static

Definition at line 703 of file xt_xmap_intersection.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xmap_intersection_delete()

static void xmap_intersection_delete ( Xt_xmap  xmap)
static

Definition at line 754 of file xt_xmap_intersection.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xmap_intersection_get_communicator()

static MPI_Comm xmap_intersection_get_communicator ( Xt_xmap  xmap)
static

Definition at line 184 of file xt_xmap_intersection.c.

Here is the call graph for this function:

◆ xmap_intersection_get_destination_ranks()

static void xmap_intersection_get_destination_ranks ( Xt_xmap  xmap,
int *  ranks 
)
static

Definition at line 207 of file xt_xmap_intersection.c.

Here is the call graph for this function:

◆ xmap_intersection_get_in_iterator()

static Xt_xmap_iter xmap_intersection_get_in_iterator ( Xt_xmap  xmap)
static

Definition at line 765 of file xt_xmap_intersection.c.

Here is the call graph for this function:

◆ xmap_intersection_get_max_dst_pos()

static int xmap_intersection_get_max_dst_pos ( Xt_xmap  xmap)
static

Definition at line 646 of file xt_xmap_intersection.c.

Here is the call graph for this function:

◆ xmap_intersection_get_max_src_pos()

static int xmap_intersection_get_max_src_pos ( Xt_xmap  xmap)
static

Definition at line 642 of file xt_xmap_intersection.c.

Here is the call graph for this function:

◆ xmap_intersection_get_num_destinations()

static int xmap_intersection_get_num_destinations ( Xt_xmap  xmap)
static

Definition at line 191 of file xt_xmap_intersection.c.

Here is the call graph for this function:

◆ xmap_intersection_get_num_sources()

static int xmap_intersection_get_num_sources ( Xt_xmap  xmap)
static

Definition at line 199 of file xt_xmap_intersection.c.

Here is the call graph for this function:

◆ xmap_intersection_get_out_iterator()

static Xt_xmap_iter xmap_intersection_get_out_iterator ( Xt_xmap  xmap)
static

Definition at line 781 of file xt_xmap_intersection.c.

◆ xmap_intersection_get_source_ranks()

static void xmap_intersection_get_source_ranks ( Xt_xmap  xmap,
int *  ranks 
)
static

Definition at line 216 of file xt_xmap_intersection.c.

◆ xmap_intersection_iterator_delete()

static void xmap_intersection_iterator_delete ( Xt_xmap_iter  iter)
static

Definition at line 1083 of file xt_xmap_intersection.c.

◆ xmap_intersection_iterator_get_num_transfer_pos()

static int xmap_intersection_iterator_get_num_transfer_pos ( Xt_xmap_iter  iter)
static

Definition at line 1077 of file xt_xmap_intersection.c.

Here is the call graph for this function:

◆ xmap_intersection_iterator_get_num_transfer_pos_ext()

static int xmap_intersection_iterator_get_num_transfer_pos_ext ( Xt_xmap_iter  iter)
static

Definition at line 1071 of file xt_xmap_intersection.c.

Here is the call graph for this function:

◆ xmap_intersection_iterator_get_rank()

static int xmap_intersection_iterator_get_rank ( Xt_xmap_iter  iter)
static

Definition at line 1041 of file xt_xmap_intersection.c.

Here is the call graph for this function:

◆ xmap_intersection_iterator_get_transfer_pos()

static int const * xmap_intersection_iterator_get_transfer_pos ( Xt_xmap_iter  iter)
static

Definition at line 1048 of file xt_xmap_intersection.c.

Here is the call graph for this function:

◆ xmap_intersection_iterator_get_transfer_pos_ext()

static const struct Xt_pos_ext * xmap_intersection_iterator_get_transfer_pos_ext ( Xt_xmap_iter  iter)
static

Definition at line 1055 of file xt_xmap_intersection.c.

Here is the call graph for this function:

◆ xmap_intersection_iterator_next()

static int xmap_intersection_iterator_next ( Xt_xmap_iter  iter)
static

Definition at line 1028 of file xt_xmap_intersection.c.

Here is the call graph for this function:

◆ xmap_intersection_msg_copy()

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,
void *  pos_copy_state 
)
static

Definition at line 669 of file xt_xmap_intersection.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xmap_intersection_msg_delete()

static void xmap_intersection_msg_delete ( int  nmsg,
struct exchange_data msg 
)
static

Definition at line 747 of file xt_xmap_intersection.c.

Here is the caller graph for this function:

◆ xmap_intersection_reorder()

static Xt_xmap xmap_intersection_reorder ( Xt_xmap  xmap,
enum xt_reorder_type  type 
)
static

Definition at line 881 of file xt_xmap_intersection.c.

Here is the call graph for this function:

◆ xmap_intersection_spread()

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

Definition at line 963 of file xt_xmap_intersection.c.

Here is the call graph for this function:

◆ xmap_intersection_update_positions()

static Xt_xmap xmap_intersection_update_positions ( Xt_xmap  xmap,
const int *  src_positions,
const int *  dst_positions 
)
static

Definition at line 925 of file xt_xmap_intersection.c.

Here is the call graph for this function:

◆ xmi()

static Xt_xmap_intersection xmi ( void *  xmap)
inlinestatic

Definition at line 179 of file xt_xmap_intersection.c.

Here is the caller graph for this function:

◆ xmii()

static Xt_xmap_iter_intersection xmii ( void *  iter)
inlinestatic

Definition at line 130 of file xt_xmap_intersection.c.

Here is the caller graph for this function:

◆ xt_xmap_intersection_new()

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 
)

constructor for an exchange map
this operation is collective over all processes in comm
it uses the provided intersection information to generate the exchange map

Parameters
[in]num_src_intersectionsnumber of source intersections
[in]src_comarray containing the source intersections with the other processes and their rank
[in]num_dst_intersectionsnumber of destination intersections
[in]dst_comarray containing the destination intersections with the other processes and their rank
[in]src_idxlistsource index list
[in]dst_idxlistdestination index list
[in]commMPI communicator that contains all processes that part in the exchange

Definition at line 581 of file xt_xmap_intersection.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xt_xmap_intersection_pos_new()

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 
)

constructor for an exchange map
this operation is collective over all processes in comm
it uses the provided intersection information to generate the exchange map

Parameters
[in]num_src_msgnumber of source messages
[in]src_comarray containing relative positions for all source messages and the destination rank
[in]num_dst_msgnumber of destination messages
[in]dst_comarray containing relative positions for all destination messages and the source rank
[in]commMPI communicator that contains all processes that part in the exchange

Definition at line 1004 of file xt_xmap_intersection.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ xmap_intersection_vtable

const struct Xt_xmap_vtable xmap_intersection_vtable
static
Initial value:
= {
.get_num_destinations = xmap_intersection_get_num_destinations,
.get_destination_ranks = xmap_intersection_get_destination_ranks,
static Xt_xmap xmap_intersection_update_positions(Xt_xmap xmap, const int *src_positions, const int *dst_positions)
static Xt_xmap_iter xmap_intersection_get_in_iterator(Xt_xmap xmap)
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 void xmap_intersection_get_source_ranks(Xt_xmap xmap, int *ranks)
static int xmap_intersection_get_max_dst_pos(Xt_xmap xmap)
static void xmap_intersection_get_destination_ranks(Xt_xmap xmap, int *ranks)
static int xmap_intersection_get_num_sources(Xt_xmap xmap)
static Xt_xmap xmap_intersection_copy(Xt_xmap xmap)
static MPI_Comm xmap_intersection_get_communicator(Xt_xmap xmap)
static void xmap_intersection_delete(Xt_xmap xmap)
static Xt_xmap_iter xmap_intersection_get_out_iterator(Xt_xmap xmap)
static int xmap_intersection_get_num_destinations(Xt_xmap xmap)
static int xmap_intersection_get_max_src_pos(Xt_xmap xmap)
static Xt_xmap xmap_intersection_reorder(Xt_xmap xmap, enum xt_reorder_type type)

Definition at line 130 of file xt_xmap_intersection.c.

◆ xmap_iterator_intersection_vtable

const struct Xt_xmap_iter_vtable xmap_iterator_intersection_vtable
static
Initial value:
= {
.get_num_transfer_pos_ext
static int xmap_intersection_iterator_get_rank(Xt_xmap_iter iter)
static void xmap_intersection_iterator_delete(Xt_xmap_iter iter)
static int xmap_intersection_iterator_next(Xt_xmap_iter iter)
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 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)

Definition at line 103 of file xt_xmap_intersection.c.