71 this->reverseData = data;
72 this->deleteDataFunc =
func;
109 inline void AMPI_Wait_b(HandleBase* handle, AdjointInterface* adjointInterface);
110 inline void AMPI_Wait_d(HandleBase* handle, AdjointInterface* adjointInterface);
143 if(
nullptr != request->
start
151 if(
nullptr != request->
func
152 && (
nullptr == request->
start
159 if(
nullptr == request->
start) {
168 MPI_Request* converted =
new MPI_Request[count];
170 for(
int i = 0; i < count; ++i) {
171 converted[i] = array[i].
request;
177#if MEDI_MPI_VERSION_1_0 <= MEDI_MPI_TARGET
183 int rStatus = MPI_Wait(&request->
request, status);
191#if MEDI_MPI_VERSION_1_0 <= MEDI_MPI_TARGET
198 int rStatus = MPI_Test(&request->
request, flag, status);
208#if MEDI_MPI_VERSION_1_0 <= MEDI_MPI_TARGET
218 return MPI_Start(&request->
request);
222#if MEDI_MPI_VERSION_1_0 <= MEDI_MPI_TARGET
224 MPI_Request* array =
convertToMPI(array_of_requests, count);
226 for(
int i = 0; i < count; ++i) {
232 int rStatus = MPI_Startall(count, array);
240#if MEDI_MPI_VERSION_1_0 <= MEDI_MPI_TARGET
246 if(
nullptr != request->
end &&
false == request->
isActive) {
249 MEDI_EXCEPTION(
"Freeing a handle that is not finish with wait, waitall, etc..");
252 int rStatus = MPI_Request_free(&request->
request);
259#if MEDI_MPI_VERSION_1_0 <= MEDI_MPI_TARGET
261 MPI_Request* array =
convertToMPI(array_of_requests, count);
263 int rStatus = MPI_Waitany(count, array, index, status);
265 if(MPI_UNDEFINED != *index) {
275#if MEDI_MPI_VERSION_1_0 <= MEDI_MPI_TARGET
277 MPI_Request* array =
convertToMPI(array_of_requests, count);
279 int rStatus = MPI_Testany(count, array, index, flag, status);
282 if(MPI_UNDEFINED != *index) {
293#if MEDI_MPI_VERSION_1_0 <= MEDI_MPI_TARGET
295 MPI_Request* array =
convertToMPI(array_of_requests, count);
297 int rStatus = MPI_Waitall(count, array, array_of_statuses);
299 for(
int i = 0; i < count; ++i) {
311#if MEDI_MPI_VERSION_1_0 <= MEDI_MPI_TARGET
313 MPI_Request* array =
convertToMPI(array_of_requests, count);
315 int rStatus = MPI_Testall(count, array, flag, array_of_statuses);
318 for(
int i = 0; i < count; ++i) {
331#if MEDI_MPI_VERSION_1_0 <= MEDI_MPI_TARGET
333 MPI_Request* array =
convertToMPI(array_of_requests, incount);
335 int rStatus = MPI_Waitsome(incount, array, outcount, array_of_indices, array_of_statuses);
337 for(
int i = 0; i < *outcount; ++i) {
338 int index = array_of_indices[i];
350#if MEDI_MPI_VERSION_1_0 <= MEDI_MPI_TARGET
352 MPI_Request* array =
convertToMPI(array_of_requests, incount);
354 int rStatus = MPI_Testsome(incount, array, outcount, array_of_indices, array_of_statuses);
356 for(
int i = 0; i < *outcount; ++i) {
357 int index = array_of_indices[i];
369#if MEDI_MPI_VERSION_3_0 <= MEDI_MPI_TARGET
372 int rStatus = MPI_Ibarrier(comm, &request->
request);
373 request->
func =
nullptr;
#define AMPI_Status
Definition ampiDefinitions.h:772
#define AMPI_Comm
Definition ampiDefinitions.h:778
Definition adjointInterface.hpp:40
#define MEDI_EXCEPTION(...)
Generates an exception.
Definition exceptions.hpp:44
Global namespace for MeDiPack - Message Differentiation Package.
Definition adjointInterface.hpp:37
void(* DeleteReverseData)(void *data)
Definition async.hpp:41
int AMPI_Testsome(int incount, AMPI_Request *array_of_requests, int *outcount, int *array_of_indices, MPI_Status *array_of_statuses)
Definition async.hpp:351
MPI_Request * convertToMPI(AMPI_Request *array, int count)
Definition async.hpp:167
bool operator!=(const AMPI_Request &a, const AMPI_Request &b)
Definition async.hpp:86
void performReverseAction(AMPI_Request *request)
Definition async.hpp:150
int AMPI_Testany(int count, AMPI_Request *array_of_requests, int *index, int *flag, MPI_Status *status)
Definition async.hpp:276
int AMPI_Startall(int count, AMPI_Request *array_of_requests)
Definition async.hpp:223
int AMPI_Waitall(int count, AMPI_Request *array_of_requests, MPI_Status *array_of_statuses)
Definition async.hpp:294
void(* ForwardFunction)(HandleBase *h, AdjointInterface *a)
Definition typeDefinitions.h:46
int AMPI_Start(AMPI_Request *request)
Definition async.hpp:209
int AMPI_Test(AMPI_Request *request, int *flag, MPI_Status *status)
Definition async.hpp:192
int AMPI_Request_free(AMPI_Request *request)
Definition async.hpp:241
const AMPI_Request AMPI_REQUEST_NULL
Definition async.cpp:35
int AMPI_Waitany(int count, AMPI_Request *array_of_requests, int *index, MPI_Status *status)
Definition async.hpp:260
void AMPI_Wait_b(HandleBase *handle, AdjointInterface *adjointInterface)
Definition async.hpp:130
int AMPI_Wait(AMPI_Request *request, MPI_Status *status)
Definition async.hpp:178
int(* ContinueFunction)(HandleBase *h)
Definition typeDefinitions.h:48
int AMPI_Waitsome(int incount, AMPI_Request *array_of_requests, int *outcount, int *array_of_indices, MPI_Status *array_of_statuses)
Definition async.hpp:332
int AMPI_Ibarrier(MPI_Comm comm, AMPI_Request *request)
Definition async.hpp:370
int AMPI_Testall(int count, AMPI_Request *array_of_requests, int *flag, MPI_Status *array_of_statuses)
Definition async.hpp:312
bool operator==(const AMPI_Request &a, const AMPI_Request &b)
Definition async.hpp:82
void(* ReverseFunction)(HandleBase *h, AdjointInterface *a)
Definition typeDefinitions.h:45
void AMPI_Wait_d(HandleBase *handle, AdjointInterface *adjointInterface)
Definition async.hpp:136
void performStartAction(AMPI_Request *request)
Definition async.hpp:142
AsyncHandle * handle
Definition async.hpp:47
DeleteReverseData deleteDataFunc
Definition async.hpp:58
AMPI_Request()
Definition async.hpp:60
void deleteReverseData()
Definition async.hpp:75
void * reverseData
Definition async.hpp:57
ContinueFunction start
Definition async.hpp:52
ContinueFunction end
Definition async.hpp:53
MPI_Request request
Definition async.hpp:46
ContinueFunction func
Definition async.hpp:48
void setReverseData(void *data, DeleteReverseData func)
Definition async.hpp:70
bool isActive
Definition async.hpp:54
AMPI_Request requestReverse
Definition async.hpp:95
AsyncAdjointHandle()
Definition async.hpp:97
struct WaitHandle * waitHandle
Definition async.hpp:94
AsyncAdjointHandle * toolHandle
Definition async.hpp:103
AsyncHandle()
Definition async.hpp:105
Definition typeDefinitions.h:53
ManualDeleteType deleteType
Definition typeDefinitions.h:57
ReverseFunction funcReverse
Definition typeDefinitions.h:54
ForwardFunction funcForward
Definition typeDefinitions.h:55
AsyncAdjointHandle * adjointHandle
Definition async.hpp:114
ForwardFunction finishFuncForward
Definition async.hpp:113
WaitHandle(ReverseFunction finishFuncReverse, ForwardFunction finishFuncForward, AsyncAdjointHandle *handle)
Definition async.hpp:116
ReverseFunction finishFuncReverse
Definition async.hpp:112