Yet Another eXchange Tool  0.9.0
Enumerations | Functions
xt_xmap_dist_dir.c File Reference
#include <stdbool.h>
#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_idxlist_collection.h"
#include "xt/xt_idxvec.h"
#include "xt/xt_idxstripes.h"
#include "xt/xt_idxempty.h"
#include "xt/xt_xmap.h"
#include "xt/xt_xmap_dist_dir.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_idxlist_internal.h"
#include "instr.h"
#include "xt_xmap_dist_dir_common.h"
Include dependency graph for xt_xmap_dist_dir.c:

Go to the source code of this file.

Enumerations

enum  {
  SEND_SIZE_SRC = 0 , SEND_SIZE_DST = 1 , SEND_NUM_SRC = 2 , SEND_NUM_DST = 3 ,
  SEND_SIZE_ASIZE
}
 

Functions

static Xt_int get_dist_dir_global_interval_size (Xt_idxlist src, Xt_idxlist dst, bool *stripify, MPI_Comm comm, int comm_size)
 
static Xt_int get_min_idxlist_index (Xt_idxlist a, Xt_idxlist b)
 
static Xt_int get_max_idxlist_index (Xt_idxlist a, Xt_idxlist b)
 
static struct bucket_params get_bucket_params (Xt_idxlist src_idxlist, Xt_idxlist dst_idxlist, bool *stripify, MPI_Comm comm, int comm_size)
 
static void rank_no_send (size_t rank, int(*restrict send_size)[SEND_SIZE_ASIZE])
 
static int compute_and_pack_bucket_intersections (struct bucket_params *bucket_params, Xt_idxlist src_idxlist, Xt_idxlist dst_idxlist, int(*send_size)[SEND_SIZE_ASIZE], void **send_buffer_, MPI_Comm comm, int comm_size)
 
static void recv_and_unpack_intersection (struct dist_dir *dist_dir, int recv_size, int recv_count, void *recv_buffer, int tag, MPI_Comm comm)
 
static void send_intersections (void *send_buffer, const int(*send_size)[SEND_SIZE_ASIZE], MPI_Request *dir_init_send_requests, int tag_offset, MPI_Comm comm, int comm_size)
 
static void recv_and_unpack_intersections (int recv_size[SEND_SIZE_ASIZE], struct dist_dir **src_dist_dir, struct dist_dir **dst_dist_dir, int tag_offset, MPI_Comm comm)
 
static size_t buf_size_from_intersections (size_t num_intersections, const struct isect *restrict src_dst_intersections, MPI_Comm comm, int comm_size, int(*restrict send_size)[SEND_SIZE_ASIZE])
 
static int pack_src_dst_dist_dirs (size_t num_intersections, struct isect *restrict src_dst_intersections, int(*send_size)[SEND_SIZE_ASIZE], void **send_buffer_, MPI_Comm comm, int comm_size)
 
static void xt_xmap_dist_dir_reduce_scatter_sizes (int num_sizes, int recv_size[num_sizes], int(*send_size)[num_sizes], MPI_Comm comm)
 wrapper for MPI_Reduce_scatter_block if available or MPI_Reduce_scatter if not More...
 
static void generate_distributed_directories (struct dist_dir **src_dist_dir, struct dist_dir **dst_dist_dir, bool *stripify, Xt_idxlist src_idxlist, Xt_idxlist dst_idxlist, int tag_offset, MPI_Comm comm, int comm_size)
 
static void recv_and_unpack_dist_dir_result (struct dist_dir *dist_dir, int recv_size, void *restrict recv_buffer, int tag, MPI_Comm comm)
 
static void recv_and_unpack_dist_dir_results (int recv_size[SEND_SIZE_ASIZE], struct dist_dir **src_intersections, struct dist_dir **dst_intersections, int *num_send_indices_requests, MPI_Request *send_indices_requests, int tag_offset, MPI_Comm comm)
 
static void exchange_idxlists (struct dist_dir **src_intersections, struct dist_dir **dst_intersections, bool *stripify, Xt_idxlist src_idxlist, Xt_idxlist dst_idxlist, int tag_offset, MPI_Comm comm)
 
Xt_xmap xt_xmap_dist_dir_intracomm_new (Xt_idxlist src_idxlist, Xt_idxlist dst_idxlist, MPI_Comm comm)
 

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_dist_dir.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SEND_SIZE_SRC 
SEND_SIZE_DST 
SEND_NUM_SRC 
SEND_NUM_DST 
SEND_SIZE_ASIZE 

Definition at line 136 of file xt_xmap_dist_dir.c.

Function Documentation

◆ buf_size_from_intersections()

static size_t buf_size_from_intersections ( size_t  num_intersections,
const struct isect *restrict  src_dst_intersections,
MPI_Comm  comm,
int  comm_size,
int(*)  send_size[SEND_SIZE_ASIZE] 
)
static

Definition at line 344 of file xt_xmap_dist_dir.c.

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

◆ compute_and_pack_bucket_intersections()

static int compute_and_pack_bucket_intersections ( struct bucket_params bucket_params,
Xt_idxlist  src_idxlist,
Xt_idxlist  dst_idxlist,
int(*)  send_size[SEND_SIZE_ASIZE],
void **  send_buffer_,
MPI_Comm  comm,
int  comm_size 
)
static

Definition at line 154 of file xt_xmap_dist_dir.c.

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

◆ exchange_idxlists()

static void exchange_idxlists ( struct dist_dir **  src_intersections,
struct dist_dir **  dst_intersections,
bool *  stripify,
Xt_idxlist  src_idxlist,
Xt_idxlist  dst_idxlist,
int  tag_offset,
MPI_Comm  comm 
)
static

Definition at line 603 of file xt_xmap_dist_dir.c.

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

◆ generate_distributed_directories()

static void generate_distributed_directories ( struct dist_dir **  src_dist_dir,
struct dist_dir **  dst_dist_dir,
bool *  stripify,
Xt_idxlist  src_idxlist,
Xt_idxlist  dst_idxlist,
int  tag_offset,
MPI_Comm  comm,
int  comm_size 
)
static

Definition at line 449 of file xt_xmap_dist_dir.c.

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

◆ get_bucket_params()

static struct bucket_params get_bucket_params ( Xt_idxlist  src_idxlist,
Xt_idxlist  dst_idxlist,
bool *  stripify,
MPI_Comm  comm,
int  comm_size 
)
static

Definition at line 104 of file xt_xmap_dist_dir.c.

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

◆ get_dist_dir_global_interval_size()

static Xt_int get_dist_dir_global_interval_size ( Xt_idxlist  src,
Xt_idxlist  dst,
bool *  stripify,
MPI_Comm  comm,
int  comm_size 
)
inlinestatic

Definition at line 76 of file xt_xmap_dist_dir.c.

Here is the call graph for this function:

◆ get_max_idxlist_index()

static Xt_int get_max_idxlist_index ( Xt_idxlist  a,
Xt_idxlist  b 
)
inlinestatic

Definition at line 104 of file xt_xmap_dist_dir.c.

◆ get_min_idxlist_index()

static Xt_int get_min_idxlist_index ( Xt_idxlist  a,
Xt_idxlist  b 
)
inlinestatic

Definition at line 94 of file xt_xmap_dist_dir.c.

Here is the call graph for this function:

◆ pack_src_dst_dist_dirs()

static int pack_src_dst_dist_dirs ( size_t  num_intersections,
struct isect *restrict  src_dst_intersections,
int(*)  send_size[SEND_SIZE_ASIZE],
void **  send_buffer_,
MPI_Comm  comm,
int  comm_size 
)
static

Definition at line 380 of file xt_xmap_dist_dir.c.

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

◆ rank_no_send()

static void rank_no_send ( size_t  rank,
int(*)  send_size[SEND_SIZE_ASIZE] 
)
inlinestatic

Definition at line 145 of file xt_xmap_dist_dir.c.

Here is the caller graph for this function:

◆ recv_and_unpack_dist_dir_result()

static void recv_and_unpack_dist_dir_result ( struct dist_dir dist_dir,
int  recv_size,
void *restrict  recv_buffer,
int  tag,
MPI_Comm  comm 
)
static

Definition at line 494 of file xt_xmap_dist_dir.c.

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

◆ recv_and_unpack_dist_dir_results()

static void recv_and_unpack_dist_dir_results ( int  recv_size[SEND_SIZE_ASIZE],
struct dist_dir **  src_intersections,
struct dist_dir **  dst_intersections,
int *  num_send_indices_requests,
MPI_Request *  send_indices_requests,
int  tag_offset,
MPI_Comm  comm 
)
static

Definition at line 540 of file xt_xmap_dist_dir.c.

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

◆ recv_and_unpack_intersection()

static void recv_and_unpack_intersection ( struct dist_dir dist_dir,
int  recv_size,
int  recv_count,
void *  recv_buffer,
int  tag,
MPI_Comm  comm 
)
static

Definition at line 262 of file xt_xmap_dist_dir.c.

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

◆ recv_and_unpack_intersections()

static void recv_and_unpack_intersections ( int  recv_size[SEND_SIZE_ASIZE],
struct dist_dir **  src_dist_dir,
struct dist_dir **  dst_dist_dir,
int  tag_offset,
MPI_Comm  comm 
)
static

Definition at line 315 of file xt_xmap_dist_dir.c.

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

◆ send_intersections()

static void send_intersections ( void *  send_buffer,
const int(*)  send_size[SEND_SIZE_ASIZE],
MPI_Request *  dir_init_send_requests,
int  tag_offset,
MPI_Comm  comm,
int  comm_size 
)
static

Definition at line 294 of file xt_xmap_dist_dir.c.

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

◆ xt_xmap_dist_dir_intracomm_new()

Xt_xmap xt_xmap_dist_dir_intracomm_new ( Xt_idxlist  src_idxlist,
Xt_idxlist  dst_idxlist,
MPI_Comm  comm 
)

Construct an exchange map.
This operation is collective over all processes in comm.
It uses a distributed directory to reduce communication and computation during the initialisation at the cost of some extra latency because more network transfers than for xt_xmap_all2all_new are required.

Parameters
[in]src_idxlistsource index list
[in]dst_idxlistdestination index list
[in]commMPI communicator that contains all processes that take part in the exchange (xt_xmap_dist_dir_new will make its own copy of comm), must be an intracommunicator.

Definition at line 666 of file xt_xmap_dist_dir.c.

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

◆ xt_xmap_dist_dir_reduce_scatter_sizes()

static void xt_xmap_dist_dir_reduce_scatter_sizes ( int  num_sizes,
int  recv_size[num_sizes],
int(*)  send_size[num_sizes],
MPI_Comm  comm 
)
static

wrapper for MPI_Reduce_scatter_block if available or MPI_Reduce_scatter if not

Parameters
num_sizesnumber of size entries to reduce over and to be received via recv_size
recv_sizearray to hold result of reduction
send_sizesizes to sum over, array size must correspond to corresponding size of comm times num_sizes
commMPI communicator to use

Definition at line 426 of file xt_xmap_dist_dir.c.

Here is the caller graph for this function: