Yet Another eXchange Tool 0.11.4
Loading...
Searching...
No Matches
xt_redist_collection.c File Reference
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <mpi.h>
#include "core/core.h"
#include "core/ppm_xfuncs.h"
#include "xt/xt_mpi.h"
#include "xt_mpi_internal.h"
#include "xt/xt_redist_collection.h"
#include "ensure_array_size.h"
#include "xt/xt_redist.h"
#include "xt/xt_request.h"
#include "xt_redist_internal.h"
#include "xt_exchanger.h"
#include "xt_config_internal.h"
Include dependency graph for xt_redist_collection.c:

Go to the source code of this file.

Classes

struct  exchanger_cache
 
struct  Xt_redist_collection_
 

Typedefs

typedef struct Xt_redist_collection_Xt_redist_collection
 

Enumerations

enum  { DEFFAULT_DATATYPE_CACHE_SIZE =16 }
 
enum  { redist_msg_stack_alloc_lim = 16 }
 

Functions

static void redist_collection_delete (Xt_redist redist)
 
static Xt_redist redist_collection_copy (Xt_redist redist)
 
static void redist_collection_s_exchange (Xt_redist redist, int num_src_arrays, const void *const *src_data, void *const *dst_data)
 
static void redist_collection_a_exchange (Xt_redist redist, int num_src_arrays, const void *const *src_data, void *const *dst_data, Xt_request *request)
 
static void redist_collection_s_exchange1 (Xt_redist redist, const void *src_data, void *dst_data)
 
static void redist_collection_a_exchange1 (Xt_redist redist, const void *src_data, void *dst_data, Xt_request *request)
 
static int redist_collection_get_num_msg (Xt_redist redist, enum xt_msg_direction direction)
 
static MPI_Datatype redist_collection_get_MPI_Datatype (Xt_redist redist, int rank, enum xt_msg_direction direction, bool do_dup)
 
static int redist_collection_get_msg_ranks (Xt_redist redist, enum xt_msg_direction direction, int *restrict *ranks)
 
static MPI_Comm redist_collection_get_MPI_Comm (Xt_redist redist)
 
static void align_component_dt (unsigned num_redists, unsigned nmsgs, const Xt_redist *redists, int *restrict in_ranks[num_redists], const size_t num_ranks[num_redists], int *out_ranks, MPI_Datatype *component_dt, enum xt_msg_direction direction)
 
static void init_cache (struct exchanger_cache *cache, size_t cache_size, unsigned num_redists)
 
static void destruct_cache (struct exchanger_cache *cache, size_t cache_size)
 
Xt_redist xt_redist_collection_new (Xt_redist *redists, int num_redists, int cache_size, MPI_Comm comm)
 
static Xt_redist_collection alloc_redist_coll (size_t num_redists, size_t nmsg_send, size_t nmsg_recv, Xt_config config, MPI_Comm comm)
 
Xt_redist xt_redist_collection_custom_new (Xt_redist *redists, int num_redists, int cache_size, MPI_Comm comm, Xt_config config)
 
static void create_all_dt_for_dir (unsigned num_messages, size_t num_redists, const int ranks[num_messages], const MPI_Datatype *component_dt, const MPI_Aint displacements[num_redists], struct Xt_redist_msg redist_msgs[num_messages], struct Xt_mpiddt_list *ddt_list, MPI_Comm comm)
 
static void compute_displ (const void *const *data, unsigned num_redists, MPI_Aint displacements[num_redists])
 
static size_t lookup_cache_index (unsigned num_redists, const MPI_Aint displacements[2][num_redists], const MPI_Aint(*cached_displacements)[2][num_redists], size_t cache_size)
 
static Xt_exchanger create_exchanger (struct Xt_redist_collection_ *redist_coll, size_t num_redists, MPI_Aint displacements[2][num_redists], struct Xt_redist_msg *msgs)
 
static Xt_exchanger get_exchanger (struct Xt_redist_collection_ *redist_coll, const void *const *src_data, const void *const *dst_data, unsigned num_redists)
 
static Xt_redist_collection xrc (void *redist)
 
static void copy_component_dt (size_t num_component_dt, const MPI_Datatype *component_dt_orig, MPI_Datatype *component_dt_copy, MPI_Comm comm)
 
static Xt_redist redist_collection_custom_copy (Xt_redist redist, Xt_config config)
 
static void free_component_dt (size_t num_dt, MPI_Datatype *all_component_dt, MPI_Comm comm)
 
static MPI_Datatype redist_collection_get_MPI_Datatype (Xt_redist redist, int XT_UNUSED(rank), enum xt_msg_direction XT_UNUSED(direction), bool XT_UNUSED(do_dup))
 

Variables

static const char filename [] = "xt_redist_collection.c"
 
static const struct xt_redist_vtable redist_collection_vtable
 

Detailed Description

Typedef Documentation

◆ Xt_redist_collection

Definition at line 138 of file xt_redist_collection.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DEFFAULT_DATATYPE_CACHE_SIZE 

Definition at line 74 of file xt_redist_collection.c.

◆ anonymous enum

anonymous enum
Enumerator
redist_msg_stack_alloc_lim 

Definition at line 371 of file xt_redist_collection.c.

Function Documentation

◆ align_component_dt()

static void align_component_dt ( unsigned num_redists,
unsigned nmsgs,
const Xt_redist * redists,
int *restrict in_ranks[num_redists],
const size_t num_ranks[num_redists],
int * out_ranks,
MPI_Datatype * component_dt,
enum xt_msg_direction direction )
static

Definition at line 158 of file xt_redist_collection.c.

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

◆ alloc_redist_coll()

static Xt_redist_collection alloc_redist_coll ( size_t num_redists,
size_t nmsg_send,
size_t nmsg_recv,
Xt_config config,
MPI_Comm comm )
static

Definition at line 226 of file xt_redist_collection.c.

Here is the caller graph for this function:

◆ compute_displ()

static void compute_displ ( const void *const * data,
unsigned num_redists,
MPI_Aint displacements[num_redists] )
static

Definition at line 339 of file xt_redist_collection.c.

Here is the caller graph for this function:

◆ copy_component_dt()

static void copy_component_dt ( size_t num_component_dt,
const MPI_Datatype * component_dt_orig,
MPI_Datatype * component_dt_copy,
MPI_Comm comm )
static

Definition at line 502 of file xt_redist_collection.c.

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

◆ create_all_dt_for_dir()

static void create_all_dt_for_dir ( unsigned num_messages,
size_t num_redists,
const int ranks[num_messages],
const MPI_Datatype * component_dt,
const MPI_Aint displacements[num_redists],
struct Xt_redist_msg redist_msgs[num_messages],
struct Xt_mpiddt_list * ddt_list,
MPI_Comm comm )
static

Definition at line 316 of file xt_redist_collection.c.

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

◆ create_exchanger()

static Xt_exchanger create_exchanger ( struct Xt_redist_collection_ * redist_coll,
size_t num_redists,
MPI_Aint displacements[2][num_redists],
struct Xt_redist_msg * msgs )
static

Definition at line 374 of file xt_redist_collection.c.

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

◆ destruct_cache()

static void destruct_cache ( struct exchanger_cache * cache,
size_t cache_size )
inlinestatic

Definition at line 208 of file xt_redist_collection.c.

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

◆ free_component_dt()

static void free_component_dt ( size_t num_dt,
MPI_Datatype * all_component_dt,
MPI_Comm comm )
static

Definition at line 566 of file xt_redist_collection.c.

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

◆ get_exchanger()

static Xt_exchanger get_exchanger ( struct Xt_redist_collection_ * redist_coll,
const void *const * src_data,
const void *const * dst_data,
unsigned num_redists )
static

Definition at line 402 of file xt_redist_collection.c.

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

◆ init_cache()

static void init_cache ( struct exchanger_cache * cache,
size_t cache_size,
unsigned num_redists )
inlinestatic

Definition at line 195 of file xt_redist_collection.c.

Here is the caller graph for this function:

◆ lookup_cache_index()

static size_t lookup_cache_index ( unsigned num_redists,
const MPI_Aint displacements[2][num_redists],
const MPI_Aint(*) cached_displacements[2][num_redists],
size_t cache_size )
static

Definition at line 354 of file xt_redist_collection.c.

Here is the caller graph for this function:

◆ redist_collection_a_exchange()

static void redist_collection_a_exchange ( Xt_redist redist,
int num_src_arrays,
const void *const * src_data,
void *const * dst_data,
Xt_request * request )
static

Definition at line 478 of file xt_redist_collection.c.

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

◆ redist_collection_a_exchange1()

static void redist_collection_a_exchange1 ( Xt_redist redist,
const void * src_data,
void * dst_data,
Xt_request * request )
static

Definition at line 633 of file xt_redist_collection.c.

Here is the call graph for this function:

◆ redist_collection_copy()

static Xt_redist redist_collection_copy ( Xt_redist redist)
static

Definition at line 521 of file xt_redist_collection.c.

Here is the call graph for this function:

◆ redist_collection_custom_copy()

static Xt_redist redist_collection_custom_copy ( Xt_redist redist,
Xt_config config )
static

Definition at line 539 of file xt_redist_collection.c.

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

◆ redist_collection_delete()

static void redist_collection_delete ( Xt_redist redist)
static

Definition at line 574 of file xt_redist_collection.c.

Here is the call graph for this function:

◆ redist_collection_get_MPI_Comm()

static MPI_Comm redist_collection_get_MPI_Comm ( Xt_redist redist)
static

Definition at line 669 of file xt_redist_collection.c.

Here is the call graph for this function:

◆ redist_collection_get_MPI_Datatype() [1/2]

static MPI_Datatype redist_collection_get_MPI_Datatype ( Xt_redist redist,
int rank,
enum xt_msg_direction direction,
bool do_dup )
static

◆ redist_collection_get_MPI_Datatype() [2/2]

static MPI_Datatype redist_collection_get_MPI_Datatype ( Xt_redist redist,
int XT_UNUSEDrank,
enum xt_msg_direction XT_UNUSEDdirection,
bool XT_UNUSEDdo_dup )
static

Definition at line 606 of file xt_redist_collection.c.

Here is the call graph for this function:

◆ redist_collection_get_msg_ranks()

static int redist_collection_get_msg_ranks ( Xt_redist redist,
enum xt_msg_direction direction,
int *restrict * ranks )
static

Definition at line 647 of file xt_redist_collection.c.

Here is the call graph for this function:

◆ redist_collection_get_num_msg()

static int redist_collection_get_num_msg ( Xt_redist redist,
enum xt_msg_direction direction )
static

Definition at line 599 of file xt_redist_collection.c.

Here is the call graph for this function:

◆ redist_collection_s_exchange()

static void redist_collection_s_exchange ( Xt_redist redist,
int num_src_arrays,
const void *const * src_data,
void *const * dst_data )
static

Definition at line 455 of file xt_redist_collection.c.

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

◆ redist_collection_s_exchange1()

static void redist_collection_s_exchange1 ( Xt_redist redist,
const void * src_data,
void * dst_data )
static

Definition at line 620 of file xt_redist_collection.c.

Here is the call graph for this function:

◆ xrc()

static Xt_redist_collection xrc ( void * redist)
inlinestatic

Definition at line 449 of file xt_redist_collection.c.

Here is the caller graph for this function:

◆ xt_redist_collection_custom_new()

Xt_redist xt_redist_collection_custom_new ( Xt_redist * redists,
int num_redists,
int cache_size,
MPI_Comm comm,
Xt_config config )

constructor for a redistribution collection that is comprised of multiple other redistributions with custom settings

Parameters
[in]redistsredistributions
[in]num_redistsnumber of redistributions
[in]cache_sizenumber of cached datatypes required for different input array displacements
n = -1 => default cache size
n = 0 => no cache
n > 0 => cache size = n
[in]commMPI communicator
[in]configcustom configuration object
Remarks
all redistributions need to be based on the same MPI communicator
See Also
Correct use of addresses

Definition at line 267 of file xt_redist_collection.c.

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

◆ xt_redist_collection_new()

Xt_redist xt_redist_collection_new ( Xt_redist * redists,
int num_redists,
int cache_size,
MPI_Comm comm )

constructor for a redistribution collection that is comprised of multiple other redistributions with default settings

Parameters
[in]redistsredistributions
[in]num_redistsnumber of redistributions
[in]cache_sizenumber of cached datatypes required for different input array displacements
n = -1 => default cache size
n = 0 => no cache
n > 0 => cache size = n
[in]commMPI communicator
Remarks
all redistributions need to be based on the same MPI communicator
See Also
Correct use of addresses

Definition at line 218 of file xt_redist_collection.c.

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

Variable Documentation

◆ filename

const char filename[] = "xt_redist_collection.c"
static

Definition at line 72 of file xt_redist_collection.c.

◆ redist_collection_vtable

const struct xt_redist_vtable redist_collection_vtable
static
Initial value:
= {
.get_msg_MPI_Datatype = redist_collection_get_MPI_Datatype,
}
static MPI_Comm redist_collection_get_MPI_Comm(Xt_redist redist)
static void redist_collection_a_exchange1(Xt_redist redist, const void *src_data, void *dst_data, Xt_request *request)
static void redist_collection_a_exchange(Xt_redist redist, int num_src_arrays, const void *const *src_data, void *const *dst_data, Xt_request *request)
static Xt_redist redist_collection_copy(Xt_redist redist)
static void redist_collection_s_exchange1(Xt_redist redist, const void *src_data, void *dst_data)
static void redist_collection_delete(Xt_redist redist)
static int redist_collection_get_msg_ranks(Xt_redist redist, enum xt_msg_direction direction, int *restrict *ranks)
static void redist_collection_s_exchange(Xt_redist redist, int num_src_arrays, const void *const *src_data, void *const *dst_data)
static int redist_collection_get_num_msg(Xt_redist redist, enum xt_msg_direction direction)
static MPI_Datatype redist_collection_get_MPI_Datatype(Xt_redist redist, int rank, enum xt_msg_direction direction, bool do_dup)

Definition at line 117 of file xt_redist_collection.c.