Yet Another eXchange Tool  0.9.0
Classes | Macros | Typedefs | Enumerations | Functions | Variables
xt_mpi.c File Reference
#include <assert.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <mpi.h>
#include "core/core.h"
#include "core/ppm_xfuncs.h"
#include "xt/xt_core.h"
#include "xt/xt_mpi.h"
#include "xt_mpi_internal.h"
Include dependency graph for xt_mpi.c:

Go to the source code of this file.

Classes

struct  xt_mpi_comm_internal_attr
 

Macros

#define COMPACT_DT
 

Typedefs

typedef unsigned long used_map_elem
 

Enumerations

enum  { used_map_elem_bits = sizeof (used_map_elem) * CHAR_BIT }
 

Functions

static MPI_Datatype xt_mpi_generate_compact_datatype_block (const int *disp, const int *blocklengths, int count, MPI_Datatype old_type)
 
static MPI_Datatype xt_mpi_generate_compact_datatype (int const *disp, int disp_len, MPI_Datatype old_type)
 
void xt_mpi_error (int error_code, MPI_Comm comm)
 
MPI_Datatype xt_mpi_generate_datatype_block (const int *displacements, const int *blocklengths, int count, MPI_Datatype old_type, MPI_Comm comm)
 
MPI_Datatype xt_mpi_generate_datatype (int const *displacements, int count, MPI_Datatype old_type, MPI_Comm comm)
 
static size_t scan_stripe (const int *disp, size_t disp_len, struct Xt_offset_ext *restrict v)
 
static int match_simple_vec (size_t *pstart_, const struct Xt_offset_ext *v, size_t vlen, MPI_Datatype old_type, int *disp, MPI_Datatype *dt)
 
static bool match_block_vec (size_t *pstart_, const struct Xt_offset_ext *v, size_t vlen, MPI_Datatype old_type, int *disp, MPI_Datatype *dt)
 
static bool match_contiguous (size_t *pstart_, const struct Xt_offset_ext *v, size_t vlen, MPI_Datatype old_type, int *restrict disp, MPI_Datatype *dt)
 
static bool match_indexed (size_t *pstart_, const struct Xt_offset_ext *v, size_t vlen, MPI_Datatype old_type, int *disp, MPI_Datatype *dt)
 
static int gen_fallback_type (size_t set_start, size_t set_end, const struct Xt_offset_ext *v, size_t vlen, MPI_Datatype old_type, int *offset, MPI_Datatype *dt)
 
static MPI_Datatype parse_stripe (const struct Xt_offset_ext *v, size_t vlen, MPI_Datatype old_type)
 
MPI_Datatype xt_mpi_generate_datatype_stripe (const struct Xt_offset_ext *v, int count, MPI_Datatype old_type, MPI_Comm XT_UNUSED(comm))
 
static int xt_mpi_comm_internal_keyval_copy (MPI_Comm XT_UNUSED(oldcomm), int XT_UNUSED(keyval), void *XT_UNUSED(extra_state), void *XT_UNUSED(attribute_val_in), void *attribute_val_out, int *flag)
 
static int xt_mpi_comm_internal_keyval_delete (MPI_Comm XT_UNUSED(comm), int XT_UNUSED(comm_keyval), void *attribute_val, void *XT_UNUSED(extra_state))
 
void xt_mpi_init (void)
 
void xt_mpi_finalize (void)
 
static struct xt_mpi_comm_internal_attrxt_mpi_comm_get_internal_attr (MPI_Comm comm)
 
static int ctzl (unsigned long v)
 
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)
 
void xt_mpi_comm_mark_exclusive (MPI_Comm comm)
 
bool xt_mpi_test_some (int *restrict num_req, MPI_Request *restrict req, int *restrict ops_completed, MPI_Comm comm)
 

Variables

int xt_mpi_comm_internal_keyval
 
static int xt_mpi_tag_ub_val
 

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

Macro Definition Documentation

◆ COMPACT_DT

#define COMPACT_DT

COMPACT_DT enables the anlysis of displacements in order to give a more compact description to the datatype generators of MPI. For strong enough MPI implementations this not required. Then you can undefine COMPACT_DT and save some prcessing time within yaxt without losing communication performance.

Definition at line 69 of file xt_mpi.c.

Typedef Documentation

◆ used_map_elem

typedef unsigned long used_map_elem

Definition at line 690 of file xt_mpi.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
used_map_elem_bits 

Definition at line 692 of file xt_mpi.c.

Function Documentation

◆ ctzl()

static int ctzl ( unsigned long  v)
inlinestatic

Definition at line 784 of file xt_mpi.c.

Here is the caller graph for this function:

◆ gen_fallback_type()

static int gen_fallback_type ( size_t  set_start,
size_t  set_end,
const struct Xt_offset_ext v,
size_t  vlen,
MPI_Datatype  old_type,
int *  offset,
MPI_Datatype *  dt 
)
static

Definition at line 528 of file xt_mpi.c.

Here is the caller graph for this function:

◆ match_block_vec()

static bool match_block_vec ( size_t *  pstart_,
const struct Xt_offset_ext v,
size_t  vlen,
MPI_Datatype  old_type,
int *  disp,
MPI_Datatype *  dt 
)
static
Returns
true if matched, false if not matched

Definition at line 421 of file xt_mpi.c.

Here is the caller graph for this function:

◆ match_contiguous()

static bool match_contiguous ( size_t *  pstart_,
const struct Xt_offset_ext v,
size_t  vlen,
MPI_Datatype  old_type,
int *restrict  disp,
MPI_Datatype *  dt 
)
static

Definition at line 468 of file xt_mpi.c.

Here is the caller graph for this function:

◆ match_indexed()

static bool match_indexed ( size_t *  pstart_,
const struct Xt_offset_ext v,
size_t  vlen,
MPI_Datatype  old_type,
int *  disp,
MPI_Datatype *  dt 
)
static

Definition at line 486 of file xt_mpi.c.

Here is the caller graph for this function:

◆ match_simple_vec()

static int match_simple_vec ( size_t *  pstart_,
const struct Xt_offset_ext v,
size_t  vlen,
MPI_Datatype  old_type,
int *  disp,
MPI_Datatype *  dt 
)
static

Definition at line 377 of file xt_mpi.c.

Here is the caller graph for this function:

◆ parse_stripe()

static MPI_Datatype parse_stripe ( const struct Xt_offset_ext v,
size_t  vlen,
MPI_Datatype  old_type 
)
static

Definition at line 581 of file xt_mpi.c.

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

◆ scan_stripe()

static size_t scan_stripe ( const int *  disp,
size_t  disp_len,
struct Xt_offset_ext *restrict  v 
)
static

Definition at line 323 of file xt_mpi.c.

Here is the caller graph for this function:

◆ xt_mpi_comm_get_internal_attr()

static struct xt_mpi_comm_internal_attr* xt_mpi_comm_get_internal_attr ( MPI_Comm  comm)
static

Definition at line 759 of file xt_mpi.c.

Here is the caller graph for this function:

◆ xt_mpi_comm_internal_keyval_copy()

static int xt_mpi_comm_internal_keyval_copy ( MPI_Comm   XT_UNUSEDoldcomm,
int   XT_UNUSEDkeyval,
void *  XT_UNUSEDextra_state,
void *  XT_UNUSEDattribute_val_in,
void *  attribute_val_out,
int *  flag 
)
static

Definition at line 703 of file xt_mpi.c.

Here is the caller graph for this function:

◆ xt_mpi_comm_internal_keyval_delete()

static int xt_mpi_comm_internal_keyval_delete ( MPI_Comm   XT_UNUSEDcomm,
int   XT_UNUSEDcomm_keyval,
void *  attribute_val,
void *  XT_UNUSEDextra_state 
)
static

Definition at line 728 of file xt_mpi.c.

Here is the caller graph for this function:

◆ xt_mpi_comm_mark_exclusive()

void xt_mpi_comm_mark_exclusive ( MPI_Comm  comm)

Annotate communicator that is for exclusive use by YAXT.

YAXT will trust communicators marked this way to not have active communications other than those initiated by YAXT functions. This is useful to prevent unnecessary MPI_Comm_dup() calls.

Parameters
[in,out]commcommunicator that will not be used by application code

Definition at line 881 of file xt_mpi.c.

Here is the caller graph for this function:

◆ xt_mpi_comm_smart_dedup()

void xt_mpi_comm_smart_dedup ( MPI_Comm comm,
int  tag_offset 
)
Examples
test_mpi_smartdedup.c.

Definition at line 864 of file xt_mpi.c.

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

◆ xt_mpi_comm_smart_dup()

MPI_Comm xt_mpi_comm_smart_dup ( MPI_Comm  comm,
int *  tag_offset 
)
Examples
test_mpi_smartdedup.c.

Definition at line 813 of file xt_mpi.c.

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

◆ xt_mpi_error()

void xt_mpi_error ( int  error_code,
MPI_Comm  comm 
)

report error return of MPI call

Parameters
[in]error_codereturn code of an MPI call
[in]commcommunicator which was used for the respective MPI call

Definition at line 80 of file xt_mpi.c.

◆ xt_mpi_finalize()

void xt_mpi_finalize ( void  )

Definition at line 753 of file xt_mpi.c.

Here is the caller graph for this function:

◆ xt_mpi_generate_compact_datatype()

static MPI_Datatype xt_mpi_generate_compact_datatype ( int const *  disp,
int  disp_len,
MPI_Datatype  old_type 
)
static

Definition at line 675 of file xt_mpi.c.

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

◆ xt_mpi_generate_compact_datatype_block()

static MPI_Datatype xt_mpi_generate_compact_datatype_block ( const int *  disp,
const int *  blocklengths,
int  count,
MPI_Datatype  old_type 
)
static

Definition at line 659 of file xt_mpi.c.

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

◆ xt_mpi_generate_datatype()

MPI_Datatype xt_mpi_generate_datatype ( int const *  displacements,
int  count,
MPI_Datatype  old_type,
MPI_Comm  comm 
)

generates an MPI datatype

Parameters
[in]displacementsarray of displacements
[in]countnumber of elements
[in]old_typebase MPI datatype of all elements
[in]commMPI communicator
Returns
MPI datatype for the given data layout
Remarks
the returned datatype needs to be freed by the user (MPI_Type_free)

Definition at line 264 of file xt_mpi.c.

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

◆ xt_mpi_generate_datatype_block()

MPI_Datatype xt_mpi_generate_datatype_block ( const int *  displacements,
const int *  blocklengths,
int  count,
MPI_Datatype  old_type,
MPI_Comm  comm 
)

generates an MPI datatype

Parameters
[in]displacementsarray of displacements
[in]blocklengthsarray of block sizes
[in]countnumber of blocks
[in]old_typebase MPI datatype of all elements
[in]commMPI communicator
Returns
MPI datatype for the given data layout
Remarks
the returned datatype needs to be freed by the user (MPI_Type_free)

Definition at line 227 of file xt_mpi.c.

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

◆ xt_mpi_generate_datatype_stripe()

MPI_Datatype xt_mpi_generate_datatype_stripe ( const struct Xt_offset_ext v,
int  count,
MPI_Datatype  old_type,
MPI_Comm   XT_UNUSEDcomm 
)

Definition at line 647 of file xt_mpi.c.

Here is the call graph for this function:

◆ xt_mpi_init()

void xt_mpi_init ( void  )

Definition at line 739 of file xt_mpi.c.

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

◆ xt_mpi_test_some()

bool xt_mpi_test_some ( int *restrict  num_req,
MPI_Request *restrict  req,
int *restrict  ops_completed,
MPI_Comm  comm 
)

Definition at line 892 of file xt_mpi.c.

Here is the caller graph for this function:

Variable Documentation

◆ xt_mpi_comm_internal_keyval

int xt_mpi_comm_internal_keyval

Definition at line 688 of file xt_mpi.c.

◆ xt_mpi_tag_ub_val

int xt_mpi_tag_ub_val
static

Definition at line 736 of file xt_mpi.c.