Datatypes

Located in file: MEL.hpp

Datatype MEL::TypeCreateContiguous(const Datatype &datatype, const int length)

Create a derived type representing a contiguous block of an elementary type.

See
MPI_Type_contiguous, MPI_Type_commit
Return
Returns a new type
Parameters
  • datatype -

    The base type to use

  • length -

    The number of elements in the new type

Datatype MEL::TypeCreateStruct(const int num, const Datatype *datatypes, const int *blockLengths, const Aint *offsets)

Create a derived type representing a struct.

See
MPI_Type_create_struct, MPI_Type_commit
Return
Returns a new type
Parameters
  • num -

    The number of members within the struct

  • datatypes -

    Pointer to an array of datatypes

  • blockLengths -

    Pointer to an array of block lengths

  • offsets -

    Pointer to an array of offsets

Datatype MEL::TypeCreateStruct(const std::vector<TypeStruct_Block> &blocks)

Create a derived type representing a struct.

Return
Returns a new type
Parameters
  • blocks -

    A std::vector of triples representing the size of the current member block

Datatype MEL::TypeCreateSubArray(const Datatype &datatype, const int num, const int *starts, const int *subSizes, const int *sizes)

Create a derived type representing a sub array.

See
MPI_Type_create_subarray, MPI_Type_commit
Return
Returns a new type
Parameters
  • datatype -

    The datatype of the parent array

  • num -

    The number of dimensions of the data

  • starts -

    Pointer to an array of start indices

  • subSizes -

    Pointer to an array of sub sizes

  • sizes -

    Pointer to an array of sizes of the parent array

Datatype MEL::TypeCreateSubArray(const Datatype &datatype, const std::vector<TypeSubArray_Dim> &dims)

Create a derived type representing a sub array.

Return
Returns a new type
Parameters
  • datatype -

    The datatype of the parent array

  • dims -

    A std::vector of triples representing the start, sub size, and parent size of each dimension of the data

Datatype MEL::TypeCreateSubArray1D(const Datatype &datatype, const int x, const int sx, const int dx)

Create a derived type representing a 1D sub array.

See
MPI_Type_create_subarray, MPI_Type_commit
Return
Returns a new type
Parameters
  • datatype -

    The datatype of the parent array

  • x -

    The start index in the x dimension

  • sx -

    The sub size in the x dimension

  • dx -

    The parent size in the x dimension

Datatype MEL::TypeCreateSubArray2D(const Datatype &datatype, const int x, const int y, const int sx, const int sy, const int dx, const int dy)

Create a derived type representing a 2D sub array.

See
MPI_Type_create_subarray, MPI_Type_commit
Return
Returns a new type
Parameters
  • datatype -

    The datatype of the parent array

  • x -

    The start index in the x dimension

  • y -

    The start index in the y dimension

  • sx -

    The sub size in the x dimension

  • sy -

    The sub size in the y dimension

  • dx -

    The parent size in the x dimension

  • dy -

    The parent size in the y dimension

Datatype MEL::TypeCreateSubArray3D(const Datatype &datatype, const int x, const int y, const int z, const int sx, const int sy, const int sz, const int dx, const int dy, const int dz)

Create a derived type representing a 3D sub array.

See
MPI_Type_create_subarray, MPI_Type_commit
Return
Returns a new type
Parameters
  • datatype -

    The datatype of the parent array

  • x -

    The start index in the x dimension

  • y -

    The start index in the y dimension

  • z -

    The start index in the z dimension

  • sx -

    The sub size in the x dimension

  • sy -

    The sub size in the y dimension

  • sz -

    The sub size in the z dimension

  • dx -

    The parent size in the x dimension

  • dy -

    The parent size in the y dimension

  • dz -

    The parent size in the z dimension

Datatype MEL::TypeCreateSubArray4D(const Datatype &datatype, const int x, const int y, const int z, const int w, const int sx, const int sy, const int sz, const int sw, const int dx, const int dy, const int dz, const int dw)

Create a derived type representing a 4D sub array.

See
MPI_Type_create_subarray, MPI_Type_commit
Return
Returns a new type
Parameters
  • datatype -

    The datatype of the parent array

  • x -

    The start index in the x dimension

  • y -

    The start index in the y dimension

  • z -

    The start index in the z dimension

  • w -

    The start index in the w dimension

  • sx -

    The sub size in the x dimension

  • sy -

    The sub size in the y dimension

  • sz -

    The sub size in the z dimension

  • sw -

    The sub size in the w dimension

  • dx -

    The parent size in the x dimension

  • dy -

    The parent size in the y dimension

  • dz -

    The parent size in the z dimension

  • dw -

    The parent size in the w dimension

Datatype MEL::TypeCreateIndexed(const Datatype &datatype, const int num, const int *lengths, const int *displs)

Create a derived type representing a set of contiguous blocks at different offsets.

See
MPI_Type_indexed, MPI_Type_commit
Return
Returns a new type
Parameters
  • datatype -

    The datatype of the elements

  • num -

    The number of blocks

  • lengths -

    Pointer to an array of block lengths

  • displs -

    Pointer to an array of block displacements

Datatype MEL::TypeCreateIndexed(const Datatype &datatype, const std::vector<TypeIndexed_Block> &blocks)

Create a derived type representing a set of contiguous blocks at different offsets.

Return
Returns a new type
Parameters
  • datatype -

    The datatype of the elements

  • blocks -

    A std::vector of pairs representing the length and displacement of the blocks

Datatype MEL::TypeCreateHIndexed(const Datatype &datatype, const int num, const int *lengths, const Aint *displs)

Create a derived type representing a set of contiguous blocks at different offsets, using byte offsets.

See
MPI_Type_create_hindexed, MPI_Type_commit
Return
Returns a new type
Parameters
  • datatype -

    The datatype of the elements

  • num -

    The number of blocks

  • lengths -

    Pointer to an array of block lengths

  • displs -

    Pointer to an array of block displacements

Datatype MEL::TypeCreateHIndexed(const Datatype &datatype, const std::vector<TypeHIndexed_Block> &blocks)

Create a derived type representing a set of contiguous blocks at different offsets, using byte offsets.

Return
Returns a new type
Parameters
  • datatype -

    The datatype of the elements

  • blocks -

    A std::vector of pairs representing the length and displacement of the blocks

Datatype MEL::TypeCreateIndexedBlock(const Datatype &datatype, const int num, const int length, const int *displs)

Create a derived type representing a set of contiguous blocks of the same length at different offsets.

See
MPI_Type_create_indexed_block, MPI_Type_commit
Return
Returns a new type
Parameters
  • datatype -

    The datatype of the elements

  • num -

    The number of blocks

  • length -

    The common block length

  • displs -

    Pointer to an array of block displacements

Datatype MEL::TypeCreateIndexedBlock(const Datatype &datatype, const int length, const std::vector<int> &displs)

Create a derived type representing a set of contiguous blocks of the same length at different offsets.

Return
Returns a new type
Parameters
  • datatype -

    The datatype of the elements

  • length -

    The common block length

  • displs -

    A std::vector representing the displacement of the blocks

Datatype MEL::TypeCreateVector(const Datatype &datatype, const int num, const int length, const int stride)

Create a derived type representing a strided sub array of a parent array.

See
MPI_Type_vector, MPI_Type_commit
Return
Returns a new type
Parameters
  • datatype -

    The datatype of the elements

  • num -

    The number of strided regions

  • length -

    The common block length of the strided regions

  • stride -

    The number of elements between each region

Datatype MEL::TypeCreateHVector(const Datatype &datatype, const int num, const int length, const Aint stride)

Create a derived type representing a strided sub array of a parent array, using byte offsets.

See
MPI_Type_create_hvector, MPI_Type_commit
Return
Returns a new type
Parameters
  • datatype -

    The datatype of the elements

  • num -

    The number of strided regions

  • length -

    The common block length of the strided regions

  • stride -

    The number of bytes between each region

Datatype MEL::TypeDuplicate(const Datatype &datatype)

Duplicate a derived type so it can be managed independently.

See
MPI_Type_dup
Return
Returns a new type
Parameters
  • datatype -

    The datatype to duplicate

int MEL::TypeSize(const Datatype &datatype)

Compute the contiguous packed size of a datatype.

See
MPI_Type_size
Return
Returns the contiguous size of the datatype in bytes
Parameters
  • datatype -

    The datatype to size

std::pair<Aint, Aint> MEL::TypeExtent(const Datatype &datatype)

Compute the extent of a datatype.

See
MPI_Type_get_extent
Return
Returns a std::pair of the datatype extent and lower bound
Parameters
  • datatype -

    The datatype to get the extent of

Aint MEL::TypeGetExtent(const Datatype &datatype)

Compute the extent of a datatype and discard the lower bound.

See
MPI_Type_get_extent
Return
Returns the datatype extent
Parameters
  • datatype -

    The datatype to get the extent of

void MEL::TypeFree(Datatype &datatype)

Free a derived datatype.

See
MPI_Type_free
Parameters
  • datatype -

    The datatype to free

void MEL::TypeFree(std::vector<Datatype> &datatypes)

Free a vector datatypes.

Parameters
  • datatypes -

    A std::vector of derived datatypes

template <typename T0, typename T1, typename... Args>
void MEL::TypeFree(T0 &d0, T1 &d1, Args&&... args)

Free the varadic set of datatypes provided.

Parameters
  • d0 -

    The first datatype to free

  • d1 -

    The second datatype to free

  • args -

    The varadic set of remaining datatypes to free