MeDiPack  1.2.2
A Message Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
medi::ADToolInterface Class Referenceabstract

The interface for the AD tool that is accessed by MeDiPack. More...

#include <adToolInterface.h>

Inheritance diagram for medi::ADToolInterface:

Public Types

typedef void AdjointType
 The data type that is used for the adjoint variables. More...
 
typedef void IndexType
 The data type from the AD tool for the identification of AD variables. More...
 
typedef void ModifiedType
 The type that is send through the modified buffers. More...
 
typedef void PrimalType
 The data type used for the floating point data. More...
 
typedef void Type
 The actual type that the AD implementation uses. More...
 

Public Member Functions

virtual void addToolAction (HandleBase *h) const =0
 Register the handle so that the AD tool can evaluate it in the reverse sweep. More...
 
 ADToolInterface (MPI_Datatype primalMpiType, MPI_Datatype adjointMpiType)
 Create an interface for the AD type. More...
 
virtual AMPI_Op convertOperator (AMPI_Op op) const =0
 Convert the mpi intrinsic operators like MPI_SUM to the specific one for the AD tool. More...
 
virtual void createIndexTypeBuffer (void *&buf, size_t size) const =0
 Create an array for the index variables. More...
 
virtual void createPrimalTypeBuffer (void *&buf, size_t size) const =0
 Create an array for the passive variables. More...
 
virtual void deleteIndexTypeBuffer (void *&buf) const =0
 Delete the array of the index variables. More...
 
virtual void deletePrimalTypeBuffer (void *&buf) const =0
 Delete the array of the passive variables. More...
 
MPI_Datatype getAdjointMpiType () const
 The mpi data type for the adjoint type. More...
 
MPI_Datatype getPrimalMpiType () const
 The mpi data type for the primal type. More...
 
virtual bool isActiveType () const =0
 If this AD interface represents an AD type. More...
 
virtual bool isHandleRequired () const =0
 The handle needs to be created if an adjoint action is required by the AD tool. More...
 
virtual bool isModifiedBufferRequired () const =0
 Indicates if the AD tool needs to modify the buffer in order to send the correct data. More...
 
virtual bool isOldPrimalsRequired () const =0
 Indicates if MeDiPack needs store the overwritten primal values for the AD tool. More...
 
virtual void startAssembly (HandleBase *h) const =0
 Indicates to the AD tool that an adjoint action is in the progress of beeing recorded. More...
 
virtual void stopAssembly (HandleBase *h) const =0
 Indicates to the AD tool that an adjoint action is beeing finished. More...
 
virtual ~ADToolInterface ()
 

Detailed Description

The interface for the AD tool that is accessed by MeDiPack.

Member Typedef Documentation

◆ AdjointType

The data type that is used for the adjoint variables.

◆ IndexType

The data type from the AD tool for the identification of AD variables.

◆ ModifiedType

The type that is send through the modified buffers.

◆ PrimalType

The data type used for the floating point data.

◆ Type

The actual type that the AD implementation uses.

Constructor & Destructor Documentation

◆ ADToolInterface()

medi::ADToolInterface::ADToolInterface ( MPI_Datatype  primalMpiType,
MPI_Datatype  adjointMpiType 
)
inline

Create an interface for the AD type.

Parameters
[in]adjointMpiTypeThe mpi data type for the adjoint type.

◆ ~ADToolInterface()

virtual medi::ADToolInterface::~ADToolInterface ( )
inlinevirtual

Member Function Documentation

◆ addToolAction()

virtual void medi::ADToolInterface::addToolAction ( HandleBase h) const
pure virtual

Register the handle so that the AD tool can evaluate it in the reverse sweep.

The AD tool needs to store the handle and do the following call:

h->func(h);

This call will evaluate the necessary adjoint actions by MeDiPack.

The handle pointer is now in the possion of the AD tool and the AD tool needs to delete the handle with the call

delete h;

The virtual function call will take care of the proper deletion of the MeDiPack structure.

Parameters
[in,out]hThe handle that is used by MeDiPack for the data storing.

Implemented in medi::ADToolPassive.

◆ convertOperator()

virtual AMPI_Op medi::ADToolInterface::convertOperator ( AMPI_Op  op) const
pure virtual

Convert the mpi intrinsic operators like MPI_SUM to the specific one for the AD tool.

Parameters
[in]opThe intrinsic mpi operator.
Returns
The opertor that can handle the AD type.

Implemented in medi::ADToolPassive.

◆ createIndexTypeBuffer()

virtual void medi::ADToolInterface::createIndexTypeBuffer ( void *&  buf,
size_t  size 
) const
pure virtual

◆ createPrimalTypeBuffer()

virtual void medi::ADToolInterface::createPrimalTypeBuffer ( void *&  buf,
size_t  size 
) const
pure virtual

◆ deleteIndexTypeBuffer()

virtual void medi::ADToolInterface::deleteIndexTypeBuffer ( void *&  buf) const
pure virtual

◆ deletePrimalTypeBuffer()

virtual void medi::ADToolInterface::deletePrimalTypeBuffer ( void *&  buf) const
pure virtual

◆ getAdjointMpiType()

MPI_Datatype medi::ADToolInterface::getAdjointMpiType ( ) const
inline

The mpi data type for the adjoint type.

Returns
The adjoint mpi data type.

◆ getPrimalMpiType()

MPI_Datatype medi::ADToolInterface::getPrimalMpiType ( ) const
inline

The mpi data type for the primal type.

Returns
The adjoint mpi data type.

◆ isActiveType()

virtual bool medi::ADToolInterface::isActiveType ( ) const
pure virtual

If this AD interface represents an AD type.

Returns
true if it is an AD type.

Implemented in medi::ADToolImplCommon< Impl, restorePrimal, modifiedBuffer, Type, AdjointType, PrimalType, IndexType >, and medi::ADToolPassive.

◆ isHandleRequired()

virtual bool medi::ADToolInterface::isHandleRequired ( ) const
pure virtual

The handle needs to be created if an adjoint action is required by the AD tool.

Returns
True if an adjoint action is required.

Implemented in medi::ADToolPassive.

◆ isModifiedBufferRequired()

virtual bool medi::ADToolInterface::isModifiedBufferRequired ( ) const
pure virtual

Indicates if the AD tool needs to modify the buffer in order to send the correct data.

Returns
true if a new buffer needs to be created.

Implemented in medi::ADToolImplCommon< Impl, restorePrimal, modifiedBuffer, Type, AdjointType, PrimalType, IndexType >, and medi::ADToolPassive.

◆ isOldPrimalsRequired()

virtual bool medi::ADToolInterface::isOldPrimalsRequired ( ) const
pure virtual

Indicates if MeDiPack needs store the overwritten primal values for the AD tool.

Returns
True if overwritten primal values need to be restored.

Implemented in medi::ADToolImplCommon< Impl, restorePrimal, modifiedBuffer, Type, AdjointType, PrimalType, IndexType >, and medi::ADToolPassive.

◆ startAssembly()

virtual void medi::ADToolInterface::startAssembly ( HandleBase h) const
pure virtual

Indicates to the AD tool that an adjoint action is in the progress of beeing recorded.

Parameters
[in,out]hThe handle that is used by MeDiPack for the data storing.

Implemented in medi::ADToolPassive.

◆ stopAssembly()

virtual void medi::ADToolInterface::stopAssembly ( HandleBase h) const
pure virtual

Indicates to the AD tool that an adjoint action is beeing finished.

Parameters
[in,out]hThe handle that is used by MeDiPack for the data storing.

Implemented in medi::ADToolPassive.


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