16 static vector< vector< double > >
recvBuf;
24 ret[i] = i + numCalls;
31 static double doWork(
double* work);
33 int main(
int argc,
char **argv)
39 tc * ( ( ne * (ne - 1.0) )/2.0 ) +
40 ne * ( tc * (tc - 1.0) )/2.0;
46 MPI_Init(&argc, &argv);
50 MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
51 MPI_Comm_size(MPI_COMM_WORLD, &numNodes);
58 int begin = myrank * numCallsPerNode;
59 int end = begin + numCallsPerNode;
62 for (
int i = 0; i < numCallsPerNode; ++i ) {
66 sendBuf[targetNode * numEntries + j ] = work[j];
69 if ( targetNode == numNodes - 1 ) {
70 for (
int j = 0; j <
numNodes; ++j ) {
71 MPI_Scatter( sendBuf, numEntries, MPI_DOUBLE,
72 recvBuf, numEntries * (1 + j ), MPI_DOUBLE, j,
81 MPI_Allgather( &tot, 1, MPI_DOUBLE,
82 totBuf, 1, MPI_DOUBLE,
92 cout << myrank <<
": Tot = " << tot <<
93 ", expected = " << expectedTot <<
94 ", subtot = " << subtot << endl;
static int clearPending(int numNodes, int myrank, MPI_Request *recvReq, double &tot)
static double doWork(double *work)
int main(int argc, char **argv)
static unsigned int numNodes
static double * get_next_work_item(int numCalls)
static vector< vector< double > > recvBuf