programmer's documentation
Typedefs | Enumerations | Functions
cs_all_to_all.h File Reference
#include <mpi.h>
#include "cs_defs.h"
#include "cs_block_dist.h"
Include dependency graph for cs_all_to_all.h:

Go to the source code of this file.

Typedefs

typedef struct _cs_all_to_all_t cs_all_to_all_t
 

Enumerations

enum  cs_all_to_all_type_t { CS_ALL_TO_ALL_MPI_DEFAULT, CS_ALL_TO_ALL_CRYSTAL_ROUTER }
 All-to-all algorithm selection. More...
 

Functions

cs_all_to_all_tcs_all_to_all_create_s (size_t n_elts, int stride, cs_datatype_t datatype, const void *elt, const int dest_rank[], MPI_Comm comm)
 Create an all-to-all distributor for strided data. More...
 
cs_all_to_all_tcs_all_to_all_create_with_ids_s (size_t n_elts, int stride, cs_datatype_t datatype, cs_datatype_t dest_id_datatype, bool add_src_id, const void *elt, const void *dest_id, const int dest_rank[], MPI_Comm comm)
 Create an all-to-all distributor for strided data with additional metadata. More...
 
cs_all_to_all_tcs_all_to_all_create_from_block_s (size_t n_elts, int stride, cs_datatype_t datatype, cs_datatype_t dest_id_datatype, bool add_src_id, const void *elt, const cs_gnum_t *elt_gnum, cs_block_dist_info_t bi, MPI_Comm comm)
 Create an all-to-all distributor for strided data with additional metadata, with destination rank determined from global numbers and block distribution information. More...
 
void cs_all_to_all_destroy (cs_all_to_all_t **d)
 Destroy an all-to-all distributor. More...
 
void cs_all_to_all_exchange (cs_all_to_all_t *d)
 Exchange data with an all-to-all distributor. More...
 
void cs_all_to_all_sort_by_source_rank (cs_all_to_all_t *d)
 Sort stride crystal router data by source rank. More...
 
cs_lnum_t cs_all_to_all_n_elts (const cs_all_to_all_t *d)
 Get number of elements associated with all-to-all distributor. More...
 
void cs_all_to_all_swap_src_dest (cs_all_to_all_t *d)
 Swap source and destination ranks of all-to-all distributor. More...
 
void cs_all_to_all_get_data_pointer (cs_all_to_all_t *d, size_t *data_stride, unsigned char **data)
 Get pointer to data elements associated with an all-to-all distributor. More...
 
void cs_all_to_all_get_rank_pointers (cs_all_to_all_t *d, size_t *rank_stride, int **src_rank, int **dest_rank)
 Get pointer to ranks of elements associated with an all-to-all distributor. More...
 
void cs_all_to_all_get_id_pointers (cs_all_to_all_t *d, size_t *id_stride, cs_lnum_t **dest_id, cs_lnum_t **src_id)
 Get pointer to source or destination rank element ids associated with an all-to-all distributor. More...
 
void cs_all_to_all_get_gnum_pointer (cs_all_to_all_t *d, size_t *gnum_stride, cs_gnum_t **gnum)
 Get pointer to element global numbers associated with an all-to-all distributor. More...
 
cs_all_to_all_type_t cs_all_to_all_get_type (void)
 Get current type of all-to-all distributor algorithm choice. More...
 
void cs_all_to_all_set_type (cs_all_to_all_type_t t)
 Set current type of all-to-all distributor algorithm choice. More...
 
void cs_all_to_all_log_finalize (void)
 Log performance information relative to instrumented all-to-all distribution. More...
 

Typedef Documentation

Opaque all-to-all distribution structure

Enumeration Type Documentation

All-to-all algorithm selection.

Enumerator
CS_ALL_TO_ALL_MPI_DEFAULT 

Use MPI_Alltoall and MPI_Alltoallv sequences

CS_ALL_TO_ALL_CRYSTAL_ROUTER 

Use crystal router algorithm

Function Documentation

cs_all_to_all_t* cs_all_to_all_create_from_block_s ( size_t  n_elts,
int  stride,
cs_datatype_t  datatype,
cs_datatype_t  dest_id_datatype,
bool  add_src_id,
const void *  elt,
const cs_gnum_t elt_gnum,
cs_block_dist_info_t  bi,
MPI_Comm  comm 
)

Create an all-to-all distributor for strided data with additional metadata, with destination rank determined from global numbers and block distribution information.

This variant allows optional tracking of destination ids or global numbers associated with elements, as well as their source ids.

In cases where those arrays are required and already available, this may avoid the need for a specific element values buffer mixing actual data values and numbering metadata. It also makes extraction of the metadata easier using cs_all_to_all_get_id_pointers.

Parameters
[in]n_eltsnumber of elements
[in]stridenumber of values per entity (interlaced)
[in]datatypetype of data considered
[in]dest_id_datatypetype of destination id (CS_GNUM_TYPE, CS_LNUM_TYPE or CS_DATATYPE_NULL depending on elt_id values)
[in]add_src_idadd source id metadata (id in elt array)
[in]eltelement values
[in]elt_gnumglobal element numbers
[in]bidestination block distribution info
[in]commassociated MPI communicator
Returns
pointer to new all-to-all distributor
cs_all_to_all_t* cs_all_to_all_create_s ( size_t  n_elts,
int  stride,
cs_datatype_t  datatype,
const void *  elt,
const int  dest_rank[],
MPI_Comm  comm 
)

Create an all-to-all distributor for strided data.

Parameters
[in]n_eltsnumber of elements
[in]stridenumber of values per entity (interlaced)
[in]datatypetype of data considered
[in]eltelement values
[in]dest_rankdestination rank for each element
[in]commassociated MPI communicator
Returns
pointer to new all-to-all distributor
cs_all_to_all_t* cs_all_to_all_create_with_ids_s ( size_t  n_elts,
int  stride,
cs_datatype_t  datatype,
cs_datatype_t  dest_id_datatype,
bool  add_src_id,
const void *  elt,
const void *  dest_id,
const int  dest_rank[],
MPI_Comm  comm 
)

Create an all-to-all distributor for strided data with additional metadata.

This variant allows optional tracking of destination ids or global numbers associated with elements, as well as their source ids.

In cases where those arrays are required and already available, this may avoid the need for a specific element values buffer mixing actual data values and numbering metadata. It also makes extraction of the metadata easier using cs_all_to_all_get_id_pointers.

Parameters
[in]n_eltsnumber of elements
[in]stridenumber of values per entity (interlaced)
[in]datatypetype of data considered
[in]dest_id_datatypetype of destination id (CS_GNUM_TYPE, CS_LNUM_TYPE or CS_DATATYPE_NULL depending on elt_id values)
[in]add_src_idadd source id metadata (id in elt array)
[in]eltelement values
[in]dest_idelement destination id, global number, or NULL
[in]dest_rankdestination rank for each element
[in]commassociated MPI communicator
Returns
pointer to new all-to-all distributor
void cs_all_to_all_destroy ( cs_all_to_all_t **  d)

Destroy an all-to-all distributor.

Parameters
[in,out]dpointer to associated all-to-all distributor
void cs_all_to_all_exchange ( cs_all_to_all_t d)

Exchange data with an all-to-all distributor.

Order of data from a same source rank is preserved.

Parameters
[in,out]dpointer to associated all-to-all distributor
void cs_all_to_all_get_data_pointer ( cs_all_to_all_t d,
size_t *  data_stride,
unsigned char **  data 
)

Get pointer to data elements associated with an all-to-all distributor.

This allows modification and/or extraction of those elements.

Note that depending on the distributor type used, the rank metadata and data may be interleaved, so the corresponding pointers point to strided, interleaved data.

Parameters
[in]dpointer to associated all-to-all distributor
[out]data_stridestride (in bytes) between data items
[out]datapointer to data items
void cs_all_to_all_get_gnum_pointer ( cs_all_to_all_t d,
size_t *  gnum_stride,
cs_gnum_t **  gnum 
)

Get pointer to element global numbers associated with an all-to-all distributor.

If this data is not available (depending on the all-to-all distributor creation function and options), the matching pointer will be set to NULL.

This allows modification and/or extraction of those numbers.

Note that depending on the distributor type used, the rank metadata and data may be interleaved, so the corresponding pointers point to strided, interleaved data.

Parameters
[in]dpointer to associated all-to-all distributor
[out]gnum_stridestride (in integers) between element global numbers
[out]gnumpointer to global numbers
void cs_all_to_all_get_id_pointers ( cs_all_to_all_t d,
size_t *  id_stride,
cs_lnum_t **  dest_id,
cs_lnum_t **  src_id 
)

Get pointer to source or destination rank element ids associated with an all-to-all distributor.

If a requested type of id is not available (depending on the all-to-all distributor creation function and options), the matching pointer will be set to NULL.

This allows modification and/or extraction of those ids, though it is intended primarily for identification.

Note that depending on the distributor type used, the rank metadata and data may be interleaved, so the corresponding pointers point to strided, interleaved data.

Parameters
[in]dpointer to associated all-to-all distributor
[out]id_stridestride (in integers) between id items
[out]dest_idpointer to destination ids (or NULL)
[out]src_idpointer to source ids (or NULL)
void cs_all_to_all_get_rank_pointers ( cs_all_to_all_t d,
size_t *  rank_stride,
int **  src_rank,
int **  dest_rank 
)

Get pointer to ranks of elements associated with an all-to-all distributor.

This allows modification and/or extraction of those ranks.

Note that depending on the distributor type used, the rank metadata and data may be interleaved, so the corresponding pointers point to strided, interleaved data.

Parameters
[in]dpointer to associated all-to-all distributor
[out]rank_stridestride (in integers) between rank values
[out]src_rankpointer to source rank values (or NULL)
[out]dest_rankpointer to destination rank values (or NULL)
cs_all_to_all_type_t cs_all_to_all_get_type ( void  )

Get current type of all-to-all distributor algorithm choice.

Returns
current type of all-to-all distributor algorithm choice
void cs_all_to_all_log_finalize ( void  )

Log performance information relative to instrumented all-to-all distribution.

cs_lnum_t cs_all_to_all_n_elts ( const cs_all_to_all_t d)

Get number of elements associated with all-to-all distributor.

The number of elements is the number of elements received after exchange.

Parameters
[in]dpointer to associated all-to-all distributor
Returns
number of elements associated with distributor.
void cs_all_to_all_set_type ( cs_all_to_all_type_t  t)

Set current type of all-to-all distributor algorithm choice.

Parameters
ttype of all-to-all distributor algorithm choice to select
void cs_all_to_all_sort_by_source_rank ( cs_all_to_all_t d)

Sort stride crystal router data by source rank.

Parameters
[in,out]dpointer to associated all-to-all distributor
void cs_all_to_all_swap_src_dest ( cs_all_to_all_t d)

Swap source and destination ranks of all-to-all distributor.

Parameters
[in,out]dpointer to associated all-to-all distributor