My Project
programmer's documentation
|
Go to the source code of this file.
Macros | |
#define | CS_CRYSTAL_ROUTER_USE_DEST_ID (1 << 0) |
#define | CS_CRYSTAL_ROUTER_ADD_SRC_ID (1 << 1) |
#define | CS_CRYSTAL_ROUTER_ADD_SRC_RANK (1 << 2) |
Typedefs | |
typedef struct _cs_crystal_router_t | cs_crystal_router_t |
Functions | |
cs_crystal_router_t * | cs_crystal_router_create_s (size_t n_elts, int stride, cs_datatype_t datatype, int flags, const void *elt, const cs_lnum_t *dest_id, const int dest_rank[], MPI_Comm comm) |
Create a Crystal Router for strided data. More... | |
cs_crystal_router_t * | cs_crystal_router_create_i (size_t n_elts, cs_datatype_t datatype, int flags, const cs_lnum_t *eld_idx, const void *elt, const cs_lnum_t *dest_id, const int dest_rank[], MPI_Comm comm) |
Create a Crystal Router for indexed data. More... | |
void | cs_crystal_router_destroy (cs_crystal_router_t **cr) |
Destroy a Crystal Router. More... | |
void | cs_crystal_router_exchange (cs_crystal_router_t *cr) |
Exchange data with a Crystal Router. More... | |
cs_lnum_t | cs_crystal_router_n_elts (const cs_crystal_router_t *cr) |
Get number of elements associated with Crystal Router. More... | |
void | cs_crystal_router_get_data (cs_crystal_router_t *cr, int **src_rank, cs_lnum_t **dest_id, cs_lnum_t **src_id, cs_lnum_t **data_index, void **data) |
Get data elements associated with a Crystal Router. More... | |
void | cs_crystal_router_log_finalize (void) |
Log performance information relative to Crystal Router exchange. More... | |
#define CS_CRYSTAL_ROUTER_ADD_SRC_ID (1 << 1) |
#define CS_CRYSTAL_ROUTER_ADD_SRC_RANK (1 << 2) |
#define CS_CRYSTAL_ROUTER_USE_DEST_ID (1 << 0) |
Crystal router ordering and metadata flags.
Opaque Crystal Router distribution structure
Flags are defined as a sum (bitwise or) of constants, which may include CS_CRYSTAL_ROUTER_USE_DEST_ID, CS_CRYSTAL_ROUTER_ADD_SRC_ID, and CS_CRYSTAL_ROUTER_ADD_SRC_RANK.
cs_crystal_router_t* cs_crystal_router_create_i | ( | size_t | n_elts, |
cs_datatype_t | datatype, | ||
int | flags, | ||
const cs_lnum_t * | elt_idx, | ||
const void * | elt, | ||
const cs_lnum_t * | dest_id, | ||
const int | dest_rank[], | ||
MPI_Comm | comm | ||
) |
Create a Crystal Router for indexed data.
If the flags constant contains CS_CRYSTAL_ROUTER_USE_DEST_ID, data exchanged will be ordered by the array passed to the dest_id
argument. For n
total values received on a rank (as given by cs_crystal_router_n_elts), those destination ids must be in the range [0, n
[.
If the flags bit mask matches CS_CRYSTAL_ROUTER_ADD_SRC_ID, source ids are added. If it matches CS_CRYSTAL_ROUTER_ADD_SRC_RANK, source rank metadata is added.
[in] | n_elts | number of elements |
[in] | datatype | type of data considered |
[in] | flags | add destination id ? |
[in] | elt_idx | element values start and past-the-last index |
[in] | elt | element values |
[in] | dest_id | element destination id, or NULL |
[in] | dest_rank | destination rank for each element |
[in] | comm | associated MPI communicator |
cs_crystal_router_t* cs_crystal_router_create_s | ( | size_t | n_elts, |
int | stride, | ||
cs_datatype_t | datatype, | ||
int | flags, | ||
const void * | elt, | ||
const cs_lnum_t * | dest_id, | ||
const int | dest_rank[], | ||
MPI_Comm | comm | ||
) |
Create a Crystal Router for strided data.
If the flags constant contains CS_CRYSTAL_ROUTER_USE_DEST_ID, data exchanged will be ordered by the array passed to the dest_id
argument. For n
total values received on a rank (as given by cs_crystal_router_n_elts), those destination ids must be in the range [0, n
[.
If the flags bit mask matches CS_CRYSTAL_ROUTER_ADD_SRC_ID, source ids are added. If it matches CS_CRYSTAL_ROUTER_ADD_SRC_RANK, source rank metadata is added.
[in] | n_elts | number of elements |
[in] | stride | number of values per entity (interlaced) |
[in] | datatype | type of data considered |
[in] | flags | add destination id ? |
[in] | elt | element values |
[in] | dest_id | element destination id, or NULL |
[in] | dest_rank | destination rank for each element |
[in] | comm | associated MPI communicator |
void cs_crystal_router_destroy | ( | cs_crystal_router_t ** | cr | ) |
Destroy a Crystal Router.
[in,out] | cr | pointer to associated Crystal Router |
void cs_crystal_router_exchange | ( | cs_crystal_router_t * | cr | ) |
Exchange data with a Crystal Router.
Order of data from a same source rank is preserved.
[in,out] | cr | pointer to associated Crystal Router |
void cs_crystal_router_get_data | ( | cs_crystal_router_t * | cr, |
int ** | src_rank, | ||
cs_lnum_t ** | dest_id, | ||
cs_lnum_t ** | src_id, | ||
cs_lnum_t ** | data_index, | ||
void ** | data | ||
) |
Get data elements associated with a Crystal Router.
Depending on the creation options, some elements may be available or not.
For each element type, a pointer to a pointer to a buffer is provided. If the pointer to the buffer is non-null, the buffer must be of sufficient size for the number of elements returned by cs_crystal_router_n_elts.
If no buffer is provided, one is allocated automatically, and transferred to the caller (who is responsible for freeing it when no longer needed).
Note also that if the destination id is provided in the Crystal Router, it will be applied automatically to all extracted arrays, except the dest_id array itself, which is always in receive order. If the Crystal Router does not contain destination id info but the dest_id
argument points to a non-NULL value, the provided id will be used to order extracted data. This allows saving the destination id on the receive side, and not re-sending it (saving bandwidth) for subsequent calls with a similar Crystal Router.
[in] | cr | pointer to associated Crystal Router |
[out] | src_rank | pointer to (pointer to) source rank array, or NULL |
[in,out] | dest_id | pointer to (pointer to) destination id array, or NULL |
[out] | src_id | pointer to (pointer to) source id array, or NULL |
[out] | data_index | pointer to (pointer to) destination index, or NULL |
[out] | data | pointer to (pointer to) destination data, or NULL |
void cs_crystal_router_log_finalize | ( | void | ) |
Log performance information relative to Crystal Router exchange.
Call count is based on Crystal router creation calls, as the number of exchange and data access calls should be identical.
cs_lnum_t cs_crystal_router_n_elts | ( | const cs_crystal_router_t * | cr | ) |
Get number of elements associated with Crystal Router.
The number of elements is the number of elements received after exchange.
[in] | cr | pointer to associated Crystal Router |