MeDiPack  1.4.0
A Message Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
medi::ADToolImplCommon< Impl, restorePrimal, modifiedBuffer, Type, AdjointType, PrimalType, IndexType > Class Template Reference

#include <adToolImplCommon.hpp>

Inheritance diagram for medi::ADToolImplCommon< Impl, restorePrimal, modifiedBuffer, Type, AdjointType, PrimalType, IndexType >:

Public Types

using Base = ADToolBase<Impl, AdjointType, PrimalType, IndexType>
 
using CallbackFuncTyped = typename Base::CallbackFuncTyped
 
- Public Types inherited from medi::ADToolBase< Impl, AdjointType, PrimalType, IndexType >
using CallbackFuncTyped
 
using CallbackFuncTyped
 
- Public Types inherited from medi::ADToolInterface
typedef void AdjointType
 The data type that is used for the adjoint variables.
 
typedef void IndexType
 The data type from the AD tool for the identification of AD variables.
 
typedef void ModifiedType
 The type that is send through the modified buffers.
 
typedef void PrimalType
 The data type used for the floating point data.
 
typedef void Type
 The actual type that the AD implementation uses.
 

Public Member Functions

 ADToolImplCommon (MPI_Datatype primalMpiType, MPI_Datatype adjointMpiType)
 
void createIndexTypeBuffer (IndexType *&buf, size_t size) const
 Create an array for the index variables.
 
void createPrimalTypeBuffer (PrimalType *&buf, size_t size) const
 Create an array for the passive variables.
 
void deleteIndexTypeBuffer (IndexType *&buf) const
 Delete the array of the index variables.
 
void deletePrimalTypeBuffer (PrimalType *&buf) const
 Delete the array of the passive variables.
 
bool isActiveType () const
 If this AD interface represents an AD type.
 
bool isModifiedBufferRequired () const
 Indicates if the AD tool needs to modify the buffer in order to send the correct data.
 
bool isOldPrimalsRequired () const
 Indicates if MeDiPack needs store the overwritten primal values for the AD tool.
 
void iterateIdentifiers (IndexType *indices, int elements, CallbackFuncTyped func, void *userData) const
 Iterate of the identifiers of the AD tool. That is the AD tool should perform the operation:
 
- Public Member Functions inherited from medi::ADToolBase< Impl, AdjointType, PrimalType, IndexType >
 ADToolBase (MPI_Datatype primalMpiType, MPI_Datatype adjointMpiType)
 Construct the type safe wrapper.
 
 ADToolBase (MPI_Datatype primalMpiType, MPI_Datatype adjointMpiType)
 Construct the type safe wrapper.
 
- Public Member Functions inherited from medi::ADToolInterface
virtual void addToolAction (HandleBase *h) const =0
 Register the handle so that the AD tool can evaluate it in the reverse sweep.
 
 ADToolInterface (MPI_Datatype primalMpiType, MPI_Datatype adjointMpiType)
 Create an interface for the AD type.
 
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.
 
MPI_Datatype getAdjointMpiType () const
 The mpi data type for the adjoint type.
 
MPI_Datatype getPrimalMpiType () const
 The mpi data type for the primal type.
 
virtual bool isHandleRequired () const =0
 The handle needs to be created if an adjoint action is required by the AD tool.
 
virtual void startAssembly (HandleBase *h) const =0
 Indicates to the AD tool that an adjoint action is in the progress of beeing recorded.
 
virtual void stopAssembly (HandleBase *h) const =0
 Indicates to the AD tool that an adjoint action is beeing finished.
 
virtual ~ADToolInterface ()
 

Member Typedef Documentation

◆ Base

template<typename Impl, bool restorePrimal, bool modifiedBuffer, typename Type, typename AdjointType, typename PrimalType, typename IndexType>
using medi::ADToolImplCommon< Impl, restorePrimal, modifiedBuffer, Type, AdjointType, PrimalType, IndexType >::Base = ADToolBase<Impl, AdjointType, PrimalType, IndexType>

◆ CallbackFuncTyped

template<typename Impl, bool restorePrimal, bool modifiedBuffer, typename Type, typename AdjointType, typename PrimalType, typename IndexType>
using medi::ADToolImplCommon< Impl, restorePrimal, modifiedBuffer, Type, AdjointType, PrimalType, IndexType >::CallbackFuncTyped = typename Base::CallbackFuncTyped

Constructor & Destructor Documentation

◆ ADToolImplCommon()

template<typename Impl, bool restorePrimal, bool modifiedBuffer, typename Type, typename AdjointType, typename PrimalType, typename IndexType>
medi::ADToolImplCommon< Impl, restorePrimal, modifiedBuffer, Type, AdjointType, PrimalType, IndexType >::ADToolImplCommon ( MPI_Datatype primalMpiType,
MPI_Datatype adjointMpiType )
inline

Member Function Documentation

◆ createIndexTypeBuffer()

template<typename Impl, bool restorePrimal, bool modifiedBuffer, typename Type, typename AdjointType, typename PrimalType, typename IndexType>
void medi::ADToolImplCommon< Impl, restorePrimal, modifiedBuffer, Type, AdjointType, PrimalType, IndexType >::createIndexTypeBuffer ( IndexType *& buf,
size_t size ) const
inlinevirtual

Create an array for the index variables.

Parameters
[out]bufThe pointer for the buffer.
[in]sizeThe size of the buffer.

Reimplemented from medi::ADToolBase< Impl, AdjointType, PrimalType, IndexType >.

◆ createPrimalTypeBuffer()

template<typename Impl, bool restorePrimal, bool modifiedBuffer, typename Type, typename AdjointType, typename PrimalType, typename IndexType>
void medi::ADToolImplCommon< Impl, restorePrimal, modifiedBuffer, Type, AdjointType, PrimalType, IndexType >::createPrimalTypeBuffer ( PrimalType *& buf,
size_t size ) const
inlinevirtual

Create an array for the passive variables.

Parameters
[out]bufThe pointer for the buffer.
[in]sizeThe size of the buffer.

Reimplemented from medi::ADToolBase< Impl, AdjointType, PrimalType, IndexType >.

◆ deleteIndexTypeBuffer()

template<typename Impl, bool restorePrimal, bool modifiedBuffer, typename Type, typename AdjointType, typename PrimalType, typename IndexType>
void medi::ADToolImplCommon< Impl, restorePrimal, modifiedBuffer, Type, AdjointType, PrimalType, IndexType >::deleteIndexTypeBuffer ( IndexType *& buf) const
inlinevirtual

Delete the array of the index variables.

Parameters
[in,out]bufThe pointer for the buffer.

Reimplemented from medi::ADToolBase< Impl, AdjointType, PrimalType, IndexType >.

◆ deletePrimalTypeBuffer()

template<typename Impl, bool restorePrimal, bool modifiedBuffer, typename Type, typename AdjointType, typename PrimalType, typename IndexType>
void medi::ADToolImplCommon< Impl, restorePrimal, modifiedBuffer, Type, AdjointType, PrimalType, IndexType >::deletePrimalTypeBuffer ( PrimalType *& buf) const
inlinevirtual

Delete the array of the passive variables.

Parameters
[in,out]bufThe pointer for the buffer.

Reimplemented from medi::ADToolBase< Impl, AdjointType, PrimalType, IndexType >.

◆ isActiveType()

template<typename Impl, bool restorePrimal, bool modifiedBuffer, typename Type, typename AdjointType, typename PrimalType, typename IndexType>
bool medi::ADToolImplCommon< Impl, restorePrimal, modifiedBuffer, Type, AdjointType, PrimalType, IndexType >::isActiveType ( ) const
inlinevirtual

If this AD interface represents an AD type.

Returns
true if it is an AD type.

Implements medi::ADToolInterface.

◆ isModifiedBufferRequired()

template<typename Impl, bool restorePrimal, bool modifiedBuffer, typename Type, typename AdjointType, typename PrimalType, typename IndexType>
bool medi::ADToolImplCommon< Impl, restorePrimal, modifiedBuffer, Type, AdjointType, PrimalType, IndexType >::isModifiedBufferRequired ( ) const
inlinevirtual

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.

Implements medi::ADToolInterface.

◆ isOldPrimalsRequired()

template<typename Impl, bool restorePrimal, bool modifiedBuffer, typename Type, typename AdjointType, typename PrimalType, typename IndexType>
bool medi::ADToolImplCommon< Impl, restorePrimal, modifiedBuffer, Type, AdjointType, PrimalType, IndexType >::isOldPrimalsRequired ( ) const
inlinevirtual

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

Returns
True if overwritten primal values need to be restored.

Implements medi::ADToolInterface.

◆ iterateIdentifiers()

template<typename Impl, bool restorePrimal, bool modifiedBuffer, typename Type, typename AdjointType, typename PrimalType, typename IndexType>
void medi::ADToolImplCommon< Impl, restorePrimal, modifiedBuffer, Type, AdjointType, PrimalType, IndexType >::iterateIdentifiers ( IndexType * indices,
int elements,
CallbackFuncTyped func,
void * userData ) const
inlinevirtual

Iterate of the identifiers of the AD tool. That is the AD tool should perform the operation:

func(&indices[i], userData)

Parameters
[in,out]indicesThe indices from the AD tool for the variables in the buffer.
[in]elementsThe number of elements in the vectors.
[in]funcThe callback function for each index.
[in]userDataThe user data for the callback function.

Reimplemented from medi::ADToolBase< Impl, AdjointType, PrimalType, IndexType >.


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