MeDiPack  1.3.0
A Message Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
medi::MpiStructType Class Referencefinal

Handling for costum MPI_Datatypes crated by the user. More...

#include <constructedDatatypes.hpp>

Inheritance diagram for medi::MpiStructType:

Public Types

typedef void AdjointType
 
typedef void IndexType
 
typedef void ModifiedType
 
typedef void PrimalType
 
typedef void Type
 
- Public Types inherited from medi::MpiTypeInterface
typedef void AdjointType
 
typedef void IndexType
 The type of the identifiers for the AD tool.
 
typedef void ModifiedType
 The type of the modified buffer data which is send over the network.
 
typedef void PrimalType
 The type of the floating point values which are handled by the AD tool.
 
typedef void Type
 The type of the user data which is represented by this interface.
 

Public Member Functions

void clearIndices (void *buf, size_t bufOffset, int elements) const
 Clear the AD types in the buffer such that they can be overwritten.
 
MpiStructTypeclone () const
 Creates a clone of the mpi type also calling MPI_Type_dub.
 
int computeActiveElements (const int count) const
 Get the number of active elements that are contained in count versions of the type.
 
const void * computeBufferPointer (const void *buf, size_t offset) const
 
void * computeBufferPointer (void *buf, size_t offset) const
 
int computeBufOffset (size_t element) const
 
int computeModOffset (size_t element) const
 
void copy (void *from, size_t fromOffset, void *to, size_t toOffset, int count) const
 Copy the elements of one buffer into the other.
 
void copyFromModifiedBuffer (void *buf, size_t bufOffset, const void *bufMod, size_t bufModOffset, int elements) const
 Copy all data from the modified buffer and perform the special handling for the AD type.
 
void copyIntoModifiedBuffer (const void *buf, size_t bufOffset, void *bufMod, size_t bufModOffset, int elements) const
 Copy all data into the modified buffer and perform the special handling for the AD type.
 
void createIndices (void *buf, size_t bufOffset, void *indices, size_t bufModOffset, int elements) const
 Create indices for a reciving buffer if necessary.
 
void createModifiedTypeBuffer (void *&buf, size_t size) const
 Create a temporary buffer of the modified type that this interface represents.
 
void createTypeBuffer (void *&buf, size_t size) const
 Create a temporary buffer of the type that this interface represents.
 
void deleteModifiedTypeBuffer (void *&buf) const
 Delete the temporary buffer for the modified types.
 
void deleteTypeBuffer (void *&buf, size_t size) const
 Delete the temporary buffer.
 
void freeType (void *buf, size_t bufOffset, int elements) const
 Destroy the types in the buffer.
 
const ADToolInterfacegetADTool () const
 Get the AD tool that handled the AD specifics.
 
void getIndices (const void *buf, size_t bufOffset, void *indices, size_t bufModOffset, int elements) const
 Get all the AD identifiers from all AD types in the buffer.
 
void getValues (const void *buf, size_t bufOffset, void *primals, size_t bufModOffset, int elements) const
 Get the primal values from the AD types.
 
void initializeType (void *buf, size_t bufOffset, int elements) const
 Initialize the types in the buffer.
 
bool isModifiedBufferRequired () const
 Tell the functions if the underlying AD tool requires new send/recv buffers or if the original buffers can be used.
 
 MpiStructType (const MpiStructType *other)
 
 MpiStructType (const MpiStructType *other, size_t offset, size_t extent)
 
 MpiStructType (int count, const int *array_of_blocklengths, const MPI_Aint *array_of_displacements, MpiTypeInterface *const *array_of_types)
 
void performReduce (void *buf, void *target, int count, AMPI_Op op, int ranks) const
 Perform a local reduce operation.
 
void registerValue (void *buf, size_t bufOffset, void *indices, void *oldPrimals, size_t bufModOffset, int elements) const
 Register all the AD values on the new machine.
 
 ~MpiStructType ()
 
- Public Member Functions inherited from medi::MpiTypeInterface
MPI_Datatype getModifiedMpiType () const
 Return the MPI type for the modified data.
 
MPI_Datatype getMpiType () const
 Return the MPI type for the data that this interface represents.
 
 MpiTypeInterface (MPI_Datatype mpiType, MPI_Datatype modifiedMpiType)
 Wrapper interface for MPI types in communications. See the class description for details.
 
virtual ~MpiTypeInterface ()
 Virtual destructor.
 

Additional Inherited Members

- Protected Member Functions inherited from medi::MpiTypeInterface
void setMpiTypes (MPI_Datatype mpiType, MPI_Datatype modifiedMpiType)
 Helper method for extending classes to set the types after the initial construction.
 

Detailed Description

Handling for costum MPI_Datatypes crated by the user.

The type stores the special intefaces of the types used to construct the datatype. It then uses these types to forward all calls to the implementations.

Member Typedef Documentation

◆ AdjointType

◆ IndexType

◆ ModifiedType

◆ PrimalType

◆ Type

Constructor & Destructor Documentation

◆ MpiStructType() [1/3]

medi::MpiStructType::MpiStructType ( const MpiStructType * other)
inline

◆ MpiStructType() [2/3]

medi::MpiStructType::MpiStructType ( const MpiStructType * other,
size_t offset,
size_t extent )
inline

◆ MpiStructType() [3/3]

medi::MpiStructType::MpiStructType ( int count,
const int * array_of_blocklengths,
const MPI_Aint * array_of_displacements,
MpiTypeInterface *const * array_of_types )
inline

◆ ~MpiStructType()

medi::MpiStructType::~MpiStructType ( )
inline

Member Function Documentation

◆ clearIndices()

void medi::MpiStructType::clearIndices ( void * buf,
size_t bufOffset,
int elements ) const
inlinevirtual

Clear the AD types in the buffer such that they can be overwritten.

Parameters
[in]bufThe original buffer provided by the user.
[in]bufOffsetThe offset into the original buffer, as provided by the user.
[in]elementsThe number of elements that should be copied.

Implements medi::MpiTypeInterface.

◆ clone()

MpiStructType * medi::MpiStructType::clone ( ) const
inlinevirtual

Creates a clone of the mpi type also calling MPI_Type_dub.

Returns
The cloned interface.

Implements medi::MpiTypeInterface.

◆ computeActiveElements()

int medi::MpiStructType::computeActiveElements ( const int count) const
inlinevirtual

Get the number of active elements that are contained in count versions of the type.

Parameters
[in]countThe number of times this type is contained in the buffer.
Returns
The number of active elements in the buffer.

Implements medi::MpiTypeInterface.

◆ computeBufferPointer() [1/2]

const void * medi::MpiStructType::computeBufferPointer ( const void * buf,
size_t offset ) const
inline

◆ computeBufferPointer() [2/2]

void * medi::MpiStructType::computeBufferPointer ( void * buf,
size_t offset ) const
inline

◆ computeBufOffset()

int medi::MpiStructType::computeBufOffset ( size_t element) const
inline

◆ computeModOffset()

int medi::MpiStructType::computeModOffset ( size_t element) const
inline

◆ copy()

void medi::MpiStructType::copy ( void * from,
size_t fromOffset,
void * to,
size_t toOffset,
int count ) const
inlinevirtual

Copy the elements of one buffer into the other.

Parameters
[in]fromThe original buffer provided by the user.
[in]fromOffsetThe offset into the original buffer.
[out]toThe target buffer for the data.
[in]toOffsetThe offset for the target buffer.
[in]countThe number of elements that should be copied.

Implements medi::MpiTypeInterface.

◆ copyFromModifiedBuffer()

void medi::MpiStructType::copyFromModifiedBuffer ( void * buf,
size_t bufOffset,
const void * bufMod,
size_t bufModOffset,
int elements ) const
inlinevirtual

Copy all data from the modified buffer and perform the special handling for the AD type.

The data for the AD types is modified such that it can be used on the new machine.

Parameters
[in]bufThe original buffer provided by the user.
[in]bufOffsetThe offset into the original buffer, as provided by the user.
[out]bufModThe buffer with the modified data.
[in]bufModOffsetThe linearized displacement for the modified buffer. These displacements are contiunous and do not contain any holes.
[in]elementsThe number of elements that should be copied.

Implements medi::MpiTypeInterface.

◆ copyIntoModifiedBuffer()

void medi::MpiStructType::copyIntoModifiedBuffer ( const void * buf,
size_t bufOffset,
void * bufMod,
size_t bufModOffset,
int elements ) const
inlinevirtual

Copy all data into the modified buffer and perform the special handling for the AD type.

The data for the AD types is modified such that it can be send over the network.

Parameters
[in]bufThe original buffer provided by the user.
[in]bufOffsetThe offset into the original buffer, as provided by the user.
[out]bufModThe new buffer for the modified data.
[in]bufModOffsetThe linearized displacement for the modified buffer. These displacements are continuous and do not contain any holes.
[in]elementsThe number of elements that should be copied.

Implements medi::MpiTypeInterface.

◆ createIndices()

void medi::MpiStructType::createIndices ( void * buf,
size_t bufOffset,
void * indices,
size_t bufModOffset,
int elements ) const
inlinevirtual

Create indices for a reciving buffer if necessary.

Parameters
[in]bufThe original buffer provided by the user.
[in]bufOffsetThe offset into the original buffer, as provided by the user.
[out]indicesThe generated buffer for indices. Indices are stored in a linearized fashion.
[in]bufModOffsetThe linearized displacement for the modified buffer. These displacements are continuous and do not contain any holes.
[in]elementsThe number of elements that should be copied.

Implements medi::MpiTypeInterface.

◆ createModifiedTypeBuffer()

void medi::MpiStructType::createModifiedTypeBuffer ( void *& buf,
size_t size ) const
inlinevirtual

Create a temporary buffer of the modified type that this interface represents.

Parameters
[in,out]bufThe location for the new buffer
[in]sizeThe number of elements for the buffer

Implements medi::MpiTypeInterface.

◆ createTypeBuffer()

void medi::MpiStructType::createTypeBuffer ( void *& buf,
size_t size ) const
inlinevirtual

Create a temporary buffer of the type that this interface represents.

Parameters
[in,out]bufThe location for the new buffer
[in]sizeThe number of elements for the buffer

Implements medi::MpiTypeInterface.

◆ deleteModifiedTypeBuffer()

void medi::MpiStructType::deleteModifiedTypeBuffer ( void *& buf) const
inlinevirtual

Delete the temporary buffer for the modified types.

Parameters
[in,out]bufThe location for the buffer

Implements medi::MpiTypeInterface.

◆ deleteTypeBuffer()

void medi::MpiStructType::deleteTypeBuffer ( void *& buf,
size_t size ) const
inlinevirtual

Delete the temporary buffer.

Parameters
[in,out]bufThe location for the buffer
[in]sizeThe size of the temporary buffer

Implements medi::MpiTypeInterface.

◆ freeType()

void medi::MpiStructType::freeType ( void * buf,
size_t bufOffset,
int elements ) const
inlinevirtual

Destroy the types in the buffer.

Parameters
[in,out]bufThe buffer in which the types are destroyed.
[in]bufOffsetThe offset into the orignal buffer, as provided by the user.
[in]elementsTHe number of elements the shoudl be initialized.

Implements medi::MpiTypeInterface.

◆ getADTool()

const ADToolInterface & medi::MpiStructType::getADTool ( ) const
inlinevirtual

Get the AD tool that handled the AD specifics.

Returns
The handle to the AD tool

Implements medi::MpiTypeInterface.

◆ getIndices()

void medi::MpiStructType::getIndices ( const void * buf,
size_t bufOffset,
void * indices,
size_t bufModOffset,
int elements ) const
inlinevirtual

Get all the AD identifiers from all AD types in the buffer.

Parameters
[in]bufThe original buffer provided by the user.
[in]bufOffsetThe offset into the original buffer, as provided by the user.
[out]indicesThe generated buffer for indices. Indices are stored in a linearized fashion.
[in]bufModOffsetThe linearized displacement for the modified buffer. These displacements are continuous and do not contain any holes.
[in]elementsThe number of elements that should be copied.

Implements medi::MpiTypeInterface.

◆ getValues()

void medi::MpiStructType::getValues ( const void * buf,
size_t bufOffset,
void * primals,
size_t bufModOffset,
int elements ) const
inlinevirtual

Get the primal values from the AD types.

Parameters
[in]bufThe original buffer provided by the user.
[in]bufOffsetThe offset into the original buffer, as provided by the user.
[out]primalsThe generated buffer for primal values if the AD tool requires theses. Indices are stored in a linearized fashion.
[in]bufModOffsetThe linearized displacement for the modified buffer. These displacements are continuous and do not contain any holes.
[in]elementsThe number of elements that should be copied.

Implements medi::MpiTypeInterface.

◆ initializeType()

void medi::MpiStructType::initializeType ( void * buf,
size_t bufOffset,
int elements ) const
inlinevirtual

Initialize the types in the buffer.

Parameters
[in,out]bufThe buffer in which the types are created.
[in]bufOffsetThe offset into the orignal buffer, as provided by the user.
[in]elementsTHe number of elements the shoudl be initialized.

Implements medi::MpiTypeInterface.

◆ isModifiedBufferRequired()

bool medi::MpiStructType::isModifiedBufferRequired ( ) const
inlinevirtual

Tell the functions if the underlying AD tool requires new send/recv buffers or if the original buffers can be used.

Returns
true if new send/recv buffers are required.

Implements medi::MpiTypeInterface.

◆ performReduce()

void medi::MpiStructType::performReduce ( void * buf,
void * target,
int count,
AMPI_Op op,
int ranks ) const
inlinevirtual

Perform a local reduce operation.

Parameters
[in]bufThe original buffer provided by the user.
[out]targetThe target buffer provided by the user.
[in]countThe number of elements per rank.
[in]opThe operator for the reduction.
[in]ranksThe number of ranks in the communication.

Implements medi::MpiTypeInterface.

◆ registerValue()

void medi::MpiStructType::registerValue ( void * buf,
size_t bufOffset,
void * indices,
void * oldPrimals,
size_t bufModOffset,
int elements ) const
inlinevirtual

Register all the AD values on the new machine.

Parameters
[in]bufThe original buffer provided by the user.
[in]bufOffsetThe offset into the original buffer, as provided by the user.
[out]indicesThe generated buffer for indices. Indices are stored in a linearized fashion.
[out]oldPrimalsThe generated buffer for primal values if the AD tool requires theses. Indices are stored in a linearized fashion.
[in]bufModOffsetThe linearized displacement for the modified buffer. These displacements are continuous and do not contain any holes.
[in]elementsThe number of elements that should be copied.

Implements medi::MpiTypeInterface.


The documentation for this class was generated from the following file: