#include #include #include #include #include //for atoi (in case someone doesn't have boost) const int buflen=5000; int main(int argc, char *argv[]) { using namespace std; int reps=1000; if(argc>1){ //optionally specify number of repeats on the command line reps=atoi(argv[1]); } int numprocs, rank, namelen; char processor_name[MPI_MAX_PROCESSOR_NAME]; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &numprocs); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Get_processor_name(processor_name, &namelen); cerr << "Process "<0){ cerr << "Process "< sendQ; char somememory; for(int i=0;i::iterator ite=sendQ.begin();ite!=sendQ.end();){ MPI_Test(&*ite,&f,&s); if(f){ list::iterator j=ite; ++ite; sendQ.erase(j); }else{ break; //these should be received in order, so if we have a pending one, stop there. } } sendQ.push_back(MPI_Request()); MPI_Issend(&somememory,0,MPI_CHAR,0,0,MPI_COMM_WORLD,&sendQ.back()); } cerr << "Process "<::iterator i=sendQ.begin();i!=sendQ.end();){ MPI_Status status; int finished=0; int ret=MPI_Test(&*i,&finished,&status); if(finished){ list::iterator j=i; i++; sendQ.erase(j); }else{ i++; } } } cerr << "Process "<