HP-MPI User's Guide (11th Edition)
Example applications
sort.C
Appendix A 275
} else {
int recvVal;
MPI_Status Status;
MPI_Recv(&recvVal, 1, MPI_INT, myRank-1, 2,
MPI_COMM_WORLD, &Status);
aBlock->printEntries(myRank);
aBlock->verifyEntries(myRank, recvVal);
if (myRank != numRanks-1) {
recvVal = aBlock->getRightEnd().getValue();
MPI_Send(&recvVal, 1, MPI_INT, myRank+1, 2,
MPI_COMM_WORLD);
}
}
delete aBlock;
MPI_Finalize();
exit(0);
}
sort.C output
The output from running the sort executable is shown below. The
application was run with -np4.
Rank 0
-998
-996
-996
-993
...
-567
-563
-544
-543
Rank 1
-535
-528
-528
...
-90
-90
-84
-84
Rank 2
-78
-70
-69
-69