MeDiPack  1.3.0
A Message Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB > Class Template Reference

#include <typeInterface.hpp>

Inheritance diagram for medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >:

Public Types

typedef ADToolB::IndexType IndexTypeB
 
typedef ADToolB::PrimalType PrimalTypeB
 
- 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.
 
int computeActiveElements (const int count) const
 Get the number of active elements that are contained in count versions of the type.
 
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.
 
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.
 
 MpiTypeBase (MPI_Datatype mpiType, MPI_Datatype modifiedMpiType)
 
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.
 
- Public Member Functions inherited from medi::MpiTypeInterface
virtual MpiTypeInterfaceclone () const =0
 Creates a clone of the mpi type also calling MPI_Type_dub.
 
virtual const ADToolInterfacegetADTool () const =0
 Get the AD tool that handled the AD specifics.
 
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.
 
virtual bool isModifiedBufferRequired () const =0
 Tell the functions if the underlying AD tool requires new send/recv buffers or if the original buffers can be used.
 
 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

template<typename Impl, typename TypeB, typename ModifiedTypeB, typename ADToolB>
class medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >

Implements all functions from MpiType that require a type change.

Functions that are not implemented: isModifiedBufferRequired

Member Typedef Documentation

◆ IndexTypeB

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
typedef ADToolB::IndexType medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::IndexTypeB

◆ PrimalTypeB

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
typedef ADToolB::PrimalType medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::PrimalTypeB

Constructor & Destructor Documentation

◆ MpiTypeBase()

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::MpiTypeBase ( MPI_Datatype mpiType,
MPI_Datatype modifiedMpiType )
inline

Member Function Documentation

◆ clearIndices()

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
void medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::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.

◆ computeActiveElements()

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
int medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::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.

Reimplemented in medi::MpiTypeDefault< ADTool >, and medi::MpiTypePassive< T >.

◆ copy()

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
void medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::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()

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
void medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::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()

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
void medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::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()

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
void medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::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()

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
void medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::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()

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
void medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::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()

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
void medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::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()

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
void medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::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()

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
void medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::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.

◆ getIndices()

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
void medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::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()

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
void medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::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()

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
void medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::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.

◆ performReduce()

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
void medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::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()

template<typename Impl , typename TypeB , typename ModifiedTypeB , typename ADToolB >
void medi::MpiTypeBase< Impl, TypeB, ModifiedTypeB, ADToolB >::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: