13 static vector< vector< double > >
recvBuf;
21 ret[i] = i + numCalls;
28 static double doWork(
double* work);
30 int main(
int argc,
char **argv)
36 tc * ( ( ne * (ne - 1.0) )/2.0 ) +
37 ne * ( tc * (tc - 1.0) )/2.0;
43 MPI_Init(&argc, &argv);
47 MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
48 MPI_Comm_size(MPI_COMM_WORLD, &numNodes);
53 recvReq[i] = sendReq[i] = 0;
55 recvBuf.resize( numNodes, temp );
59 int begin = myrank * numCallsPerNode;
60 int end = begin + numCallsPerNode;
63 for (
int i = 0; i <
numNodes; ++i ) {
76 for (
int i = 0; i < numCallsPerNode; ++i ) {
79 if ( targetNode == myrank ) {
100 if ( targetNode == numNodes - 1 ) {
102 while ( numDone < numNodes )
103 numDone +=
clearPending( numNodes, myrank, recvReq, tot );
110 for (
int i = 0; i <
numNodes; ++i ) {
111 if ( i == myrank )
continue;
122 while ( numDone < numNodes )
123 numDone +=
clearPending( numNodes, myrank, recvReq, tot );
125 cout << myrank <<
": Tot = " << tot <<
126 ", expected = " << expectedTot <<
127 ", subtot = " << work[0] << endl;
142 for (
int i = 0; i <
numNodes; ++i ) {
144 MPI_Status &ds = doneStatus[i];
145 ds.MPI_SOURCE = ds.MPI_TAG = ds.MPI_ERROR = ds._count = ds._cancelled = 0;
148 int numDone = MPI_Testsome( numNodes - 1, recvReq, &done,
149 doneIndices, doneStatus );
151 if ( done == MPI_UNDEFINED )
153 for (
unsigned int i = 0; i < done; ++i ) {
154 int recvNode = doneIndices[i];
155 if ( recvNode >= myrank )
157 double* work = &(
recvBuf[recvNode][0]);
167 &recvReq[doneIndices[i]]);
static vector< vector< double > > recvBuf
static double doWork(double *work)
static int clearPending(int numNodes, int myrank, MPI_Request *recvReq, double &tot)
int main(int argc, char **argv)
static unsigned int numNodes
static double * get_next_work_item(int numCalls)