typedef unsigned char byte;
int main(int argc, char *argv[]){
MPI_Init(&argc, &argv);
int rank,size;
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
byte buf[10][10];
MPI_Request req[10];
MPI_Status stat[10];
int outcount;
int array_of_indices[10];
int i;
if(rank==0) {
for(i =0; i< 10;i++){
MPI_Isend(buf[i], 10, MPI_BYTE, 1, 123, MPI_COMM_WORLD, &req[i]);
}
printf("post send\n");
MPI_Waitall(10, req, stat);
printf("send over\n");
}else {
for(i=0; i< 10;i++){
MPI_Irecv(buf[i], 10, MPI_BYTE, 0, 123, MPI_COMM_WORLD, &req[i]);
}
printf("post recv\n");
for (i=0;i<10;i++){
MPI_Waitsome(10, req, &outcount, array_of_indices, stat);
printf("%d index %d\n", outcount, array_of_indices[0]);
}
}
MPI_Finalize();
}