#include "mpi_test_incl.h" class Master : public MasterBase { public: Master(int slaves, int iters, FILE* fpLog) : MasterBase(slaves, iters, fpLog) {} // void SendReceiveAsyncP2P(); // void SendReceiveAsyncP2MP(); // void SendReceiveAsyncP2MP_2(); void SendReceiveAsyncP2MP_C(); virtual void SendEndOfCommunication(MPI::Intracomm* comm = NULL); protected: // int Waitany(int count, MPI::Request* array_of_requests, int* index, MPI::Status* status); int Waitany_C(int count, MPI_Request* array_of_requests, int* outIndex, MPI_Status* status); }; /* void Master::SendReceiveAsyncP2MP_2() { MPI_Request send_request, recv_request; int rcvInt, sendInt = 0; int retErr = MPI_SUCCESS; int rcvIter = 0; int slaveRank; int nodeFail = 0; int opCompleted = 1; vector rcvRequests(mSlaves); MPI::Status status; // Init MPI_Irecv requests. for(int slaveIdx=0; slaveIdx= count)) // if *index is out of range init it with last index in the vector. { *index = count-1; } MPI::Request* req = array_of_requests + *index; MPI_Status* stat = (MPI_Status*)status; int startIndex = *index; int isCancelled = 0; while( (funcRetErr == MPI_SUCCESS) && (!opCompleted) ) // && (!isCancelled) ) { ++req; *index += 1; if(*index == count) { *index = 0; req = array_of_requests; usleep(100); } if( *req != MPI::Request(MPI_REQUEST_NULL) ) { funcRetErr = MPI_Test((MPI_Request*)*req, &opCompleted, stat); // funcRetErr = MPI_Request_get_status(*(MPI_Request*)*req, &opCompleted, stat); } } if (funcRetErr != MPI_SUCCESS) { fprintf(mFpLog, "GES_FTMPIService::Waitany - Fail of index %d\n", *index); *req = MPI::Request(MPI_REQUEST_NULL); } else // (funcRetErr == MPI_SUCCESS) { MPI_Test_cancelled((MPI_Status*)*status, &isCancelled); if (isCancelled) { funcRetErr = MPI_ERR_OTHER; fprintf(mFpLog, "GES_FTMPIService::Waitany - request %d isCancelled", *index); } // MPI_Wait((MPI_Request*)*req, stat); // MPI_Request_free((MPI_Request*)*req); } } catch(...) { std::cout << "Master::Waitany Unhandled exception"< rcvRequests(mSlaves); MPI_Status status; // Init MPI_Irecv requests. for(int slaveIdx=0; slaveIdx rcvRequests(mSlaves); vector statuses(mSlaves); // Init MPI_Irecv requests. for(int slaveIdx=0; slaveIdx