130 int result1 = MPI_Op_create(
primalFunction, primalFunctionCommute, &this->primalFunction);
137 this->hasAdjoint =
true;
155 int init(MPI_User_function* user_fn,
int commute) {
158 int result = MPI_Op_create(user_fn, commute, &op);
177 this->primalFunction = op;
178 this->requiresPrimal =
false;
179 this->requiresPrimalSend =
false;
180 this->modifiedPrimalFunction = MPI_SUM;
181 this->preAdjointOperation = noPreAdjointOperation;
182 this->postAdjointOperation = noPostAdjointOperation;
183 this->hasAdjoint =
false;
187 if(this->hasAdjoint) {
188 MPI_Op_free(&this->modifiedPrimalFunction);
191 return MPI_Op_free(&this->primalFunction);
#define MEDI_UNUSED(name)
Definition macros.h:108
Global namespace for MeDiPack - Message Differentiation Package.
Definition adjointInterface.hpp:37
bool operator!=(const AMPI_Request &a, const AMPI_Request &b)
Definition async.hpp:86
const AMPI_Op AMPI_OP_NULL
Definition op.cpp:35
void(* PreAdjointOperation)(void *adjoints, void *primals, int count, int dim)
Definition typeDefinitions.h:49
bool operator==(const AMPI_Request &a, const AMPI_Request &b)
Definition async.hpp:82
void(* PostAdjointOperation)(void *adjoints, void *primals, void *rootPrimals, int count, int dim)
Definition typeDefinitions.h:50
Structure for the special handling of the MPI_Op structure.
Definition op.hpp:50
PreAdjointOperation preAdjointOperation
The operation that is evaluated on each adjoint value before they are send in a message.
Definition op.hpp:82
int free()
Definition op.hpp:186
PostAdjointOperation postAdjointOperation
The operation that is evaluated on each adjoint after the values have been received in a message.
Definition op.hpp:87
int init(const bool requiresPrimal, const bool requiresPrimalSend, MPI_User_function *primalFunction, int primalFunctionCommute, MPI_User_function *modifiedPrimalFunction, int modifiedPrimalFunctionCommute, const PreAdjointOperation preAdjointOperation, const PostAdjointOperation postAdjointOperation)
Creates an operator with a specialized adjoint handling.
Definition op.hpp:129
AMPI_Op()
Default constructor for static initialization.
Definition op.hpp:99
MPI_Op primalFunction
The mpi operator for the unmodified AD types. The AD tool needs to record all operations that are eva...
Definition op.hpp:69
bool requiresPrimalSend
Indicates if the primal on the receiving side needs to be send to the sending side.
Definition op.hpp:60
bool hasAdjoint
Indicates if the user has provided a specialized adjoint handling for the operator.
Definition op.hpp:92
int init(MPI_User_function *user_fn, int commute)
Creates an operator that has no special adjoint handling.
Definition op.hpp:155
void init(MPI_Op op)
Creates an operator that has no special adjoint handling.
Definition op.hpp:176
bool requiresPrimal
Indicates if the primal on the sending and receiving side are required by this operator.
Definition op.hpp:55
MPI_Op modifiedPrimalFunction
The mpi operator for the modified AD types. This are the operations that are evaluated during the mpi...
Definition op.hpp:77