AdjoinableMPI
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
support.c File Reference
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include "ampi/adTool/support.h"
Include dependency graph for support.c:

Go to the source code of this file.

Functions

int AMPI_Init_NT (int *argc, char ***argv)
 
void ADTOOL_AMPI_pushBcastInfo (void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm)
 
void ADTOOL_AMPI_popBcastInfo (void **buf, int *count, MPI_Datatype *datatype, int *root, MPI_Comm *comm, void **idx)
 
void ADTOOL_AMPI_pushDoubleArray (void *buf, int count)
 
void ADTOOL_AMPI_popDoubleArray (double *buf, int *count)
 
void ADTOOL_AMPI_pushReduceInfo (void *sbuf, void *rbuf, void *resultData, int pushResultData, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)
 
void ADTOOL_AMPI_popReduceCountAndType (int *count, MPI_Datatype *datatype)
 
void ADTOOL_AMPI_popReduceInfo (void **sbuf, void **rbuf, void **prevData, void **resultData, int *count, MPI_Op *op, int *root, MPI_Comm *comm, void **idx)
 
void ADTOOL_AMPI_pushSRinfo (void *buf, int count, MPI_Datatype datatype, int src, int tag, AMPI_PairedWith pairedWith, MPI_Comm comm)
 
void ADTOOL_AMPI_popSRinfo (void **buf, int *count, MPI_Datatype *datatype, int *src, int *tag, AMPI_PairedWith *pairedWith, MPI_Comm *comm, void **idx)
 
void ADTOOL_AMPI_pushOSinfo (void *buf, int count, MPI_Datatype datatype, int src, int tag, AMPI_PairedWith pairedWith, MPI_Comm comm)
 
void ADTOOL_AMPI_popOSinfo (void **buf, int *count, MPI_Datatype *datatype, int *src, int *tag, AMPI_PairedWith *pairedWith, MPI_Comm *comm, void **idx)
 
void ADTOOL_AMPI_pushGSinfo (int commSizeForRootOrNull, void *rbuf, int rcnt, MPI_Datatype rtype, void *buf, int count, MPI_Datatype type, int root, MPI_Comm comm)
 
void ADTOOL_AMPI_popGScommSizeForRootOrNull (int *commSizeForRootOrNull)
 
void ADTOOL_AMPI_popGSinfo (int commSizeForRootOrNull, void **rbuf, int *rcnt, MPI_Datatype *rtype, void **buf, int *count, MPI_Datatype *type, int *root, MPI_Comm *comm)
 
void ADTOOL_AMPI_pushGSVinfo (int commSizeForRootOrNull, void *rbuf, int *rcnts, int *displs, MPI_Datatype rtype, void *buf, int count, MPI_Datatype type, int root, MPI_Comm comm)
 
void ADTOOL_AMPI_popGSVinfo (int commSizeForRootOrNull, void **rbuf, int *rcnts, int *displs, MPI_Datatype *rtype, void **buf, int *count, MPI_Datatype *type, int *root, MPI_Comm *comm)
 
void ADTOOL_AMPI_push_CallCode (enum AMPI_CallCode_E thisCall)
 
void ADTOOL_AMPI_pop_CallCode (enum AMPI_CallCode_E *thisCall)
 
void ADTOOL_AMPI_push_AMPI_Request (struct AMPI_Request_S *ampiRequest)
 
void ADTOOL_AMPI_pop_AMPI_Request (struct AMPI_Request_S *ampiRequest)
 
void ADTOOL_AMPI_push_AMPI_Win (AMPI_Win *win)
 
void ADTOOL_AMPI_pop_AMPI_Win (AMPI_Win *win)
 
void ADTOOL_AMPI_push_request (MPI_Request request)
 
MPI_Request ADTOOL_AMPI_pop_request ()
 
void ADTOOL_AMPI_push_AMPI_WinRequest (AMPI_WinRequest *winRequest)
 
void ADTOOL_AMPI_pop_AMPI_WinRequest (AMPI_WinRequest *winRequest)
 
void ADTOOL_AMPI_push_comm (MPI_Comm comm)
 
MPI_Comm ADTOOL_AMPI_pop_comm ()
 
void * ADTOOL_AMPI_rawData (void *activeData, int *size)
 
void * ADTOOL_AMPI_rawDataV (void *activeData, int commSize, int *counts, int *displs)
 
void * ADTOOL_AMPI_packDType (void *indata, void *outdata, int count, int idx)
 
void * ADTOOL_AMPI_unpackDType (void *indata, void *outdata, int count, int idx)
 
void * ADTOOL_AMPI_rawAdjointData (void *activeData)
 
void ADTOOL_AMPI_mapBufForAdjoint (struct AMPI_Request_S *ampiRequest, void *buf)
 
void ADTOOL_AMPI_Turn (void *buf, void *adjointBuf)
 
void ADTOOL_AMPI_setBufForAdjoint (struct AMPI_Request_S *ampiRequest, void *buf)
 
void ADTOOL_AMPI_getAdjointCount (int *count, MPI_Datatype datatype)
 
void ADTOOL_AMPI_setAdjointCount (struct AMPI_Request_S *ampiRequest)
 
void ADTOOL_AMPI_setAdjointCountAndTempBuf (struct AMPI_Request_S *ampiRequest)
 
void ADTOOL_AMPI_setWinAdjointCount (AMPI_WinRequest *winRequest)
 
void ADTOOL_AMPI_setWinAdjointCountAndTempBuf (AMPI_WinRequest *winRequest)
 
void ADTOOL_AMPI_syncAdjointWin (AMPI_Win *win)
 
void * ADTOOL_AMPI_allocateTempBuf (int adjointCount, MPI_Datatype datatype, MPI_Comm comm)
 
void ADTOOL_AMPI_releaseAdjointTempBuf (void *tempBuf)
 
void * ADTOOL_AMPI_allocateTempActiveBuf (int count, MPI_Datatype datatype, MPI_Comm comm)
 
void ADTOOL_AMPI_releaseTempActiveBuf (void *buf, int count, MPI_Datatype datatype)
 
void * ADTOOL_AMPI_copyActiveBuf (void *source, void *target, int count, MPI_Datatype datatype, MPI_Comm comm)
 
void ADTOOL_AMPI_adjointMultiply (int count, MPI_Datatype datatype, MPI_Comm comm, void *source, void *adjointSource, void *target, void *adjointTarget)
 
void ADTOOL_AMPI_adjointMin (int count, MPI_Datatype datatype, MPI_Comm comm, void *source, void *adjointSource, void *target, void *adjointTarget)
 
void ADTOOL_AMPI_adjointMax (int count, MPI_Datatype datatype, MPI_Comm comm, void *source, void *adjointSource, void *target, void *adjointTarget)
 
void ADTOOL_AMPI_incrementAdjoint (int adjointCount, MPI_Datatype datatype, MPI_Comm comm, void *target, void *source, void *idx)
 
void ADTOOL_AMPI_multiplyAdjoint (int adjointCount, MPI_Datatype datatype, MPI_Comm comm, void *target, void *source, void *idx)
 
void ADTOOL_AMPI_divideAdjoint (int adjointCount, MPI_Datatype datatype, MPI_Comm comm, void *target, void *source, void *idx)
 
void ADTOOL_AMPI_equalAdjoints (int adjointCount, MPI_Datatype datatype, MPI_Comm comm, void *target, void *source1, void *source2, void *idx)
 
void ADTOOL_AMPI_nullifyAdjoint (int adjointCount, MPI_Datatype datatype, MPI_Comm comm, void *target)
 
void ADTOOL_AMPI_pushBuffer (int count, MPI_Datatype datatype, MPI_Comm comm, void *buffer)
 
void ADTOOL_AMPI_popBuffer (int count, MPI_Datatype datatype, MPI_Comm comm, void *buffer)
 
void ADTOOL_AMPI_writeData (void *buf, int *count)
 
void ADTOOL_AMPI_writeDataV (void *activeData, int *counts, int *displs)
 
AMPI_Activity ADTOOL_AMPI_isActiveType (MPI_Datatype datatype)
 
void * ADTOOL_AMPI_createWinMap (void *active_buf, MPI_Aint size)
 
void ADTOOL_AMPI_writeWinData (void *map, void *buf, MPI_Aint size)
 
MPI_Aint ADTOOL_AMPI_getWinSize (MPI_Aint size)
 
void ADTOOL_AMPI_setupTypes ()
 
void ADTOOL_AMPI_cleanupTypes ()
 
MPI_Datatype ADTOOL_AMPI_FW_rawType (MPI_Datatype datatype)
 
MPI_Datatype ADTOOL_AMPI_BW_rawType (MPI_Datatype datatype)
 

Variables

MPI_Comm ADTOOL_AMPI_COMM_WORLD_SHADOW
 

Function Documentation

void ADTOOL_AMPI_adjointMax ( int  count,
MPI_Datatype  datatype,
MPI_Comm  comm,
void *  source,
void *  adjointSource,
void *  target,
void *  adjointTarget 
)

This is the adjoint of assignment target=MAX(source,target)

Definition at line 381 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_adjointMin ( int  count,
MPI_Datatype  datatype,
MPI_Comm  comm,
void *  source,
void *  adjointSource,
void *  target,
void *  adjointTarget 
)

This is the adjoint of assignment target=MIN(source,target)

Definition at line 375 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_adjointMultiply ( int  count,
MPI_Datatype  datatype,
MPI_Comm  comm,
void *  source,
void *  adjointSource,
void *  target,
void *  adjointTarget 
)

This is the adjoint of assignment target=source*target

Definition at line 369 of file support.c.

Referenced by AMPI_Init_NT().

void* ADTOOL_AMPI_allocateTempActiveBuf ( int  count,
MPI_Datatype  datatype,
MPI_Comm  comm 
)

allocates buffer with active variables (needed as a temporary in Reduce)

Definition at line 342 of file support.c.

Referenced by AMPI_Init_NT().

void* ADTOOL_AMPI_allocateTempBuf ( int  adjointCount,
MPI_Datatype  dataType,
MPI_Comm  comm 
)

Allocates a temporary buffer needed to receive adjoint data before adding it to the adjoint variable

Definition at line 324 of file support.c.

References derivedTypeIdx(), getDTypeData(), isDerivedType(), and derivedTypeData::p_extents.

Referenced by ADTOOL_AMPI_setAdjointCountAndTempBuf(), and AMPI_Init_NT().

Here is the call graph for this function:

MPI_Datatype ADTOOL_AMPI_BW_rawType ( MPI_Datatype  datatype)

Take datatype for reverse mode, return datatype for transfer.

Definition at line 468 of file support.c.

References AMPI_Request_stack::datatype.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_cleanupTypes ( )

cleanup types created with ADTOOL_AMPI_setupTypes

Definition at line 461 of file support.c.

Referenced by AMPI_Finalize_NT(), and AMPI_Init_NT().

void* ADTOOL_AMPI_copyActiveBuf ( void *  source,
void *  target,
int  count,
MPI_Datatype  datatype,
MPI_Comm  comm 
)

copies contents of buffer including real values of active variables

Definition at line 360 of file support.c.

Referenced by AMPI_Init_NT().

void* ADTOOL_AMPI_createWinMap ( void *  active_buf,
MPI_Aint  size 
)

Maps the active buffer on a mapped buffer for a MPI_Win

Definition at line 425 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_divideAdjoint ( int  adjointCount,
MPI_Datatype  datatype,
MPI_Comm  comm,
void *  target,
void *  source,
void *  idx 
)

Divide the given buffer target, which holds an adjoint, with the given source value

Parameters
adjointCountis the number of items in the buffer we will increment
datatypethe data type of the buffer to be incremented
commthe communicator to be passed to MPI_Abort for failures
targetthe adjoint buffer to be divided
sourcethe value to divide by.
idxtape index for each element of the non contiguous buffer

Definition at line 392 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_equalAdjoints ( int  adjointCount,
MPI_Datatype  datatype,
MPI_Comm  comm,
void *  target,
void *  source1,
void *  source2,
void *  idx 
)

Check equality of the given buffers source1 and source2, which hold adjoints, and return the result in the given target buffer.

Parameters
adjointCountis the number of items in the buffer we will increment
datatypethe data type of the buffer to be incremented
commthe communicator to be passed to MPI_Abort for failures
targetthe buffer that will hold the result (0==difference)
source1the one buffer to compare
source2the other buffer to compare
idxtape index for each element of the non contiguous buffer

Definition at line 395 of file support.c.

Referenced by AMPI_Init_NT().

MPI_Datatype ADTOOL_AMPI_FW_rawType ( MPI_Datatype  datatype)

Take datatype for forward mode, return datatype for transfer.

Definition at line 464 of file support.c.

References AMPI_Request_stack::datatype.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_getAdjointCount ( int *  count,
MPI_Datatype  datatype 
)

this method resets

Parameters
countmember to represent the buffer in terms of elements of the original MPI
datatype;this is of particular interest for vector mode;
Todo:
needs to be expanded for the case where the adjoint data is not represented by the same MPI data type as the original program data

Definition at line 297 of file support.c.

Referenced by ADTOOL_AMPI_setAdjointCount(), and AMPI_Init_NT().

MPI_Aint ADTOOL_AMPI_getWinSize ( MPI_Aint  size)

Gets the size of the mapped buffer for a window at its creation. It returns the size of the mapped window (may be equal to the active window).

Parameters
sizeof the active window.

Definition at line 432 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_incrementAdjoint ( int  adjointCount,
MPI_Datatype  datatype,
MPI_Comm  comm,
void *  target,
void *  source,
void *  idx 
)

Increment the given buffer "target", which holds an adjoint variable, with the given additional adjoint value found in "source".

Parameters
adjointCountis the number of items in the buffer we will increment
datatypethe data type of the buffer to be incremented
commthe communicator to be passed to MPI_Abort for failures
targetthe adjoint buffer to be incremented
sourcethe adjoint value that must be added into the adjoint buffer.
idxtape index for each element of the non contiguous buffer

Increment the given buffer "target", which holds an adjoint variable, with the given additional adjoint value found in "source".

Definition at line 386 of file support.c.

Referenced by AMPI_Init_NT().

AMPI_Activity ADTOOL_AMPI_isActiveType ( MPI_Datatype  datatype)

test types for activity

Parameters
datatypeany data type but particularly also the active data type(s) created by the tool (see AMPI_ADOUBLE etc.)
Returns
the respective enum value based on the type's activity

Definition at line 421 of file support.c.

References AMPI_PASSIVE.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_mapBufForAdjoint ( struct AMPI_Request_S ampiRequest,
void *  buf 
)

set it on the request;

Parameters
bufis forward sweep buffer (for source transformation tools)
ampiRequestis the request to be pushed and popped for the adjoint communication

Remembers the association from a request ampiRequest to its associated non-diff buffer buf

Definition at line 286 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_multiplyAdjoint ( int  adjointCount,
MPI_Datatype  datatype,
MPI_Comm  comm,
void *  target,
void *  source,
void *  idx 
)

Multiply the given buffer target, which holds an adjoint, with the given source value

Parameters
adjointCountis the number of items in the buffer we will increment
datatypethe data type of the buffer to be incremented
commthe communicator to be passed to MPI_Abort for failures
targetthe adjoint buffer to be multiplied
sourcethe value to multiply by.
idxtape index for each element of the non contiguous buffer

Definition at line 389 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_nullifyAdjoint ( int  adjointCount,
MPI_Datatype  datatype,
MPI_Comm  comm,
void *  target 
)

Reset to zero the given buffer "target", which holds an adjoint variable.

Parameters
adjointCountis the number of items in the buffer we will nullify
datatypethe data type of the buffer to be nullified
commthe communicator to be passed to MPI_Abort for failures
targetthe adjoint buffer to be nullified

Reset to zero the given buffer "target", which holds an adjoint variable.

Definition at line 398 of file support.c.

Referenced by AMPI_Init_NT().

void* ADTOOL_AMPI_packDType ( void *  indata,
void *  outdata,
int  count,
int  idx 
)

serialize user-defined struct for sending in forward execution in association-by-address tools

returns contiguous data from indata

Definition at line 275 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_pop_AMPI_Request ( struct AMPI_Request_S ampiRequest)

the implementation of popping the required elements of an AMPI_Request_S from the AD-tool-internal stack

Definition at line 239 of file support.c.

Referenced by AMPI_Init_NT(), and BW_AMPI_Wait_ST().

void ADTOOL_AMPI_pop_AMPI_Win ( AMPI_Win win)

Pop a window for one-sided communication using a specific window

Definition at line 245 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_pop_AMPI_WinRequest ( AMPI_WinRequest winRequest)

Pop a window request for one-sided communication using a specific window

Definition at line 258 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_pop_CallCode ( enum AMPI_CallCode_E thisCall)

the implementation of popping an operation code from the to the AD-tool-internal stack for an operator overloading tool; See comments of ADTOOL_AMPI_push_CallCode. the operator overloading tool needs to pop the code from its operation stack first and then call (with dummy parameters) the respect BW_ variant of the operatiorn represented by thisCall

Definition at line 233 of file support.c.

Referenced by AMPI_Init_NT().

MPI_Comm ADTOOL_AMPI_pop_comm ( )

the companion to ADTOOL_AMPI_push_request

Definition at line 264 of file support.c.

Referenced by AMPI_Init_NT().

MPI_Request ADTOOL_AMPI_pop_request ( )

the companion to ADTOOL_AMPI_push_request. See Bookkeeping of Requests.

Definition at line 251 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_popBcastInfo ( void **  buf,
int *  count,
MPI_Datatype *  datatype,
int *  root,
MPI_Comm *  comm,
void **  idx 
)

Popping the required elements for Bcast calls.

Definition at line 102 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_popBuffer ( int  count,
MPI_Datatype  datatype,
MPI_Comm  comm,
void *  buffer 
)

Pop the contents of buffer from somewhere

Definition at line 412 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_popDoubleArray ( double *  buf,
int *  count 
)

Definition at line 114 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_popGScommSizeForRootOrNull ( int *  commSizeForRootOrNull)

this must be called before ADTOOL_AMPI_popGSinfo and ADTOOL_AMPI_popGSVinfo

Parameters
commSizeForRootOrNullthis is popped so that we may allocate buffers for rcnts and displs in the subsequent call to ADTOOL_AMPI_popGSVinfo

Definition at line 192 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_popGSinfo ( int  commSizeForRootOrNull,
void **  rbuf,
int *  rcnt,
MPI_Datatype *  rtype,
void **  buf,
int *  count,
MPI_Datatype *  type,
int *  root,
MPI_Comm *  comm 
)

the implementation of popping the required elements for gather/scatter from the AD-tool-internal stack; see comments of ADTOOL_AMPI_pushGSinfo; following the note there we will not be setting the values for root specific arguments on non-root ranks

Parameters
commSizeForRootOrNullretrieved via ADTOOL_AMPI_popGScommSizeForRootOrNull
rbufthe buffer on rank rook, set if commSizeForRootOrNull>0
rcntthe size for rank root, set if commSizeForRootOrNull>0
rtypethe data type for rank root, set if commSizeForRootOrNull>0
bufthe buffer for all ranks
countthe count for all ranks
typethe type for all ranks
rootthe root rank
commthe communicator for all ranks

Definition at line 195 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_popGSVinfo ( int  commSizeForRootOrNull,
void **  rbuf,
int *  rcnts,
int *  displs,
MPI_Datatype *  rtype,
void **  buf,
int *  count,
MPI_Datatype *  type,
int *  root,
MPI_Comm *  comm 
)

the implementation of popping the required elements for gatherv/scatterv from the AD-tool-internal stack; see comments of ADTOOL_AMPI_pushGSVinfo; following the note there we will not be setting the values for root specific arguments on non-root ranks

Parameters
commSizeForRootOrNullretrieved via ADTOOL_AMPI_popGScommSizeForRootOrNull
rbufthe buffer on rank rook, set if commSizeForRootOrNull>0
rcntsthe array of size commSizeForRootOrNull for rank root, set if commSizeForRootOrNull>0
displsthe array of size commSizeForRootOrNull for rank root, set if commSizeForRootOrNull>0
rtypethe data type for rank root, set if commSizeForRootOrNull>0
bufthe buffer for all ranks
countthe count for all ranks
typethe type for all ranks
rootthe root rank
commthe communicator for all ranks

Definition at line 218 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_popOSinfo ( void **  buf,
int *  count,
MPI_Datatype *  datatype,
int *  src,
int *  tag,
AMPI_PairedWith pairedWith,
MPI_Comm *  comm,
void **  idx 
)

the implementation of popping the required elements for one-sided communication from the AD-tool-internal stack; See comments of ADTOOL_AMPI_pushOSinfo.

Definition at line 171 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_popReduceCountAndType ( int *  count,
MPI_Datatype *  datatype 
)

Popping the required elements for Reduce calls.

Definition at line 128 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_popReduceInfo ( void **  sbuf,
void **  rbuf,
void **  prevData,
void **  resultData,
int *  count,
MPI_Op *  op,
int *  root,
MPI_Comm *  comm,
void **  idx 
)

Definition at line 132 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_popSRinfo ( void **  buf,
int *  count,
MPI_Datatype *  datatype,
int *  src,
int *  tag,
AMPI_PairedWith pairedWith,
MPI_Comm *  comm,
void **  idx 
)

the implementation of popping the required elements for send/recv from the AD-tool-internal stack; See comments of ADTOOL_AMPI_pushSRinfo.

Definition at line 152 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_push_AMPI_Request ( struct AMPI_Request_S ampiRequest)

the implementation of pushing the required elements of an AMPI_Request_S to the AD-tool-internal stack

Definition at line 236 of file support.c.

Referenced by AMPI_Init_NT(), and FW_AMPI_Wait_ST().

void ADTOOL_AMPI_push_AMPI_Win ( AMPI_Win win)

Push a window for one-sided communication using a specific window

Definition at line 242 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_push_AMPI_WinRequest ( AMPI_WinRequest winRequest)

Push a window request for one-sided communication using a specific window

Definition at line 255 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_push_CallCode ( enum AMPI_CallCode_E  thisCall)

the implementation of pushing an operation code to the to the AD-tool-internal stack for an operator overloading tool; the source transformation implementation will leave this empty; this method is called in the respective FW_ variant implemented in Common

Definition at line 230 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_push_comm ( MPI_Comm  comm)

Definition at line 261 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_push_request ( MPI_Request  request)

Push the MPI_Request on the AD tool internal stack. This is used as a key to the request bookkeeping to keep correspondence between the request Id of the FW sweep to the request Id in BW sweep. if we need to trace requests for a pure (operator overloading) trace evaluation the Common implementation uses this to push the request See Bookkeeping of Requests.

Definition at line 248 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_pushBcastInfo ( void *  buf,
int  count,
MPI_Datatype  datatype,
int  root,
MPI_Comm  comm 
)

The implementation of pushing the required elements for Bcast calls. Might rework for conciseness. Wrote this to avoid pushing too much stuff with _pushSRinfo.

Definition at line 95 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_pushBuffer ( int  count,
MPI_Datatype  datatype,
MPI_Comm  comm,
void *  buffer 
)

Push the contents of buffer somewhere

Definition at line 404 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_pushDoubleArray ( void *  buf,
int  count 
)

Pushing and popping a block of double values, specifically for reduction results.

Definition at line 110 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_pushGSinfo ( int  commSizeForRootOrNull,
void *  rbuf,
int  rcnt,
MPI_Datatype  rtype,
void *  buf,
int  count,
MPI_Datatype  type,
int  root,
MPI_Comm  comm 
)

the implementation of pushing the required elements for gather/scatter to the AD-tool-internal stack; the implementation rationale follows ADTOOL_AMPI_pushSRinfo NOTE: for non-root ranks the root specific parameters are ignored which implies in particular that the pointers passed may not be valid therefore we use commSizeForRootOrNull to discriminate

Parameters
commSizeForRootOrNullis the communicator size for rank root or 0
rbufthe buffer on rank root
rcntthe count on rank root
rtypethe data type on rank root
bufthe buffer on non-root ranks
countthe counter for buf on non-root ranks
typethe data type on non-root ranks
rootthe root rank
commthe communicator

Definition at line 181 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_pushGSVinfo ( int  commSizeForRootOrNull,
void *  rbuf,
int *  rcnts,
int *  displs,
MPI_Datatype  rtype,
void *  buf,
int  count,
MPI_Datatype  type,
int  root,
MPI_Comm  comm 
)

the implementation of pushing the required elements for gatherv/scatterv to the AD-tool-internal stack; the implementation rationale follows ADTOOL_AMPI_pushSRinfo NOTE: for non-root ranks the root specific parameters are ignored which implies in particular that the pointers passed may not be valid therefore we use commSizeForRootOrNull to discriminate

Parameters
commSizeForRootOrNullis the communicator size for rank root or 0
rbufthe buffer on rank root
rcntsthe counters per rank on rank root
displsthe displacements for rbuf on rank root
rtypethe data type on rank root
bufthe buffer on non-root ranks
countthe counter for buf on non-root ranks
typethe data type on non-root ranks
rootthe root rank
commthe communicator

Definition at line 206 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_pushOSinfo ( void *  buf,
int  count,
MPI_Datatype  datatype,
int  src,
int  tag,
AMPI_PairedWith  pairedWith,
MPI_Comm  comm 
)

the implementation of pushing the required elements for one-sided communication to the AD-tool-internal stack; For source transformation this may remain unimplemented provided all the parameters are recovered by TBR and buf is mapped explicitly. the operator overloading implementation maps buf to the adjoint address space. The source transformation implementation ignores buf

Definition at line 162 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_pushReduceInfo ( void *  sbuf,
void *  rbuf,
void *  resultData,
int  pushResultData,
int  count,
MPI_Datatype  datatype,
MPI_Op  op,
int  root,
MPI_Comm  comm 
)

The implementation of pushing the required elements for Reduce calls. Might rework for conciseness. Note that we require a separate TAPE_AMPI_push_MPI_Op function to push the reduce operation. I defined _push_MPI_Op in AdjoinableMPI/Tape/support.c w/ header AdjoinableMPI/ampi/tape/support.h.

Definition at line 118 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_pushSRinfo ( void *  buf,
int  count,
MPI_Datatype  datatype,
int  src,
int  tag,
AMPI_PairedWith  pairedWith,
MPI_Comm  comm 
)

the implementation of pushing the required elements for send/recv to the AD-tool-internal stack; For source transformation this may remain unimplemented provided all the parameters are recovered by TBR and buf is mapped explicitly. the operator overloading implementation maps buf to the adjoint address space. The source transformation implementation ignores buf

Definition at line 143 of file support.c.

Referenced by AMPI_Init_NT().

void* ADTOOL_AMPI_rawAdjointData ( void *  activeData)

map active data to adjoint data; this is to be implemented for the backward execution by tools using association-by-address; for tools using association-by-name the same address should be returned;

Returns the diff part of the adjoint of a communication buffer passed to AMPI send or recv. For Tapenade, this is the adjoint communication buffer itself (association by name)

Definition at line 282 of file support.c.

Referenced by AMPI_Init_NT().

void* ADTOOL_AMPI_rawData ( void *  activeData,
int *  size 
)

map active data to raw data; this is to be implemented for the forward execution by tools using association-by-address; for tools using association-by-name the same address should be returned;

Returns the non-diff part of a communication buffer passed to AMPI send or recv. For Tapenade, this is the communication buffer itself (association by name)

Definition at line 268 of file support.c.

Referenced by AMPI_Init_NT().

void* ADTOOL_AMPI_rawDataV ( void *  activeData,
int  commSize,
int *  counts,
int *  displs 
)

map active data to raw data; functionality similar to ADTOOL_AMPI_rawData except it is handling vector buffers with arrays of counts and displacements as used in MPI_Gatherv or MPI_Scatterv

see ADTOOL_AMPI_rawData

Definition at line 272 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_releaseAdjointTempBuf ( void *  tempBuf)

releases the temporary buffer (allocated by ADTOOL_AMPI_setAdjointCountAndTempBuf) into which the adjoint data was received

Definition at line 338 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_releaseTempActiveBuf ( void *  buf,
int  count,
MPI_Datatype  datatype 
)

releases buffer with active variables (used as a temporary in Reduce)

Definition at line 354 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_setAdjointCount ( struct AMPI_Request_S ampiRequest)
Parameters
ampiRequestin this instance this method resets the adjointCount member;

Definition at line 301 of file support.c.

Referenced by ADTOOL_AMPI_setAdjointCountAndTempBuf(), AMPI_Init_NT(), and BW_AMPI_Wait_ST().

void ADTOOL_AMPI_setAdjointCountAndTempBuf ( struct AMPI_Request_S ampiRequest)

calls ADTOOL_AMPI_setAdjointCount and sets up a temporary buffer into which the adjoint data is received, see e.g. BW_AMPI_Wait

Parameters
ampiRequestis the request instance that is modified

Definition at line 304 of file support.c.

References AMPI_Request_S::adjointCount, AMPI_Request_S::adjointTempBuf, ADTOOL_AMPI_allocateTempBuf(), ADTOOL_AMPI_setAdjointCount(), AMPI_Request_S::comm, and AMPI_Request_S::datatype.

Referenced by AMPI_Init_NT(), and BW_AMPI_Wait_ST().

Here is the call graph for this function:

void ADTOOL_AMPI_setBufForAdjoint ( struct AMPI_Request_S ampiRequest,
void *  buf 
)

an operator overloading tool should not do anything in the implementation but see ADTOOL_AMPI_mapBufForAdjoint; a source transformation tool would receive the adjoint buffer as an argument and set it on the request;

Parameters
bufis the adjoint buffer (for source transformation tools)
ampiRequestis the request to be used during the adjoint communication

Definition at line 292 of file support.c.

Referenced by AMPI_Init_NT(), and BW_AMPI_Wait_ST().

void ADTOOL_AMPI_setupTypes ( )

create predefined active types; to be cleaned up with ADTOOL_AMPI_cleanupTypes

Definition at line 441 of file support.c.

References AMPI_ADOUBLE, AMPI_ADOUBLE_PRECISION, AMPI_AFLOAT, and AMPI_AREAL.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_setWinAdjointCount ( AMPI_WinRequest winRequest)
Parameters
winRequestin this instance this method resets the adjointCount member;

Definition at line 313 of file support.c.

Referenced by ADTOOL_AMPI_setWinAdjointCountAndTempBuf(), and AMPI_Init_NT().

void ADTOOL_AMPI_setWinAdjointCountAndTempBuf ( AMPI_WinRequest winRequest)

calls ADTOOL_AMPI_setAdjointCount and sets up a temporary buffer into which the adjoint data is received, see e.g. BW_AMPI_Win_fence

Parameters
winRequestis the request instance that is modified

Definition at line 316 of file support.c.

References AMPI_WinRequest::adjointTempBuf, and ADTOOL_AMPI_setWinAdjointCount().

Referenced by AMPI_Init_NT().

Here is the call graph for this function:

void ADTOOL_AMPI_syncAdjointWin ( AMPI_Win win)

synchronizes the window with incoming adjoints, applies the corresponding increments and nullifies the adjoints in the window.

Parameters
winis the AMPI_Win instance providing the window for the incoming adjoints

Definition at line 321 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_Turn ( void *  buf,
void *  adjointBuf 
)

Declares correspondence between a buffer and its counterpart adjoint buffer Adds correspondence into the request-to-buffer association list This is necessary for association-by-name transfo tools. should be done upon turn from FW sweep to BW sweep.

Parameters
bufthe original, non-differentiated buffer.
adjointBufthe corresponding adjoint buffer.

Adds into the request-to-buffer association list the associated adjoint buffer adjointBuf of non-diff buffer buf This should be done upon turn from FW sweep to BW sweep.

Definition at line 290 of file support.c.

Referenced by adtool_ampi_turn_(), and AMPI_Init_NT().

void* ADTOOL_AMPI_unpackDType ( void *  indata,
void *  outdata,
int  count,
int  idx 
)

unpack serialized user-defined struct data into its original form

unpacks contiguous data back into structure

Definition at line 278 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_writeData ( void *  activeData,
int *  size 
)
Todo:
add description

Definition at line 417 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_writeDataV ( void *  activeData,
int *  counts,
int *  displs 
)
Todo:
add description

Definition at line 419 of file support.c.

Referenced by AMPI_Init_NT().

void ADTOOL_AMPI_writeWinData ( void *  map,
void *  buf,
MPI_Aint  size 
)

Maps the active buffer on a mapped buffer for a MPI_Win

Definition at line 429 of file support.c.

Referenced by AMPI_Init_NT().

Variable Documentation

MPI_Comm ADTOOL_AMPI_COMM_WORLD_SHADOW

The global MPI_COMM_WORLD_D

Definition at line 14 of file support.c.

Referenced by ADTOOL_AMPI_getShadowComm(), and AMPI_Init_NT().