[mpich-discuss] where mpi waitsome only returns one request each time
Bland, Wesley B.
wbland at anl.gov
Sun Oct 19 09:36:25 CDT 2014
You need to move your waitany outside of the if statement so both ranks execute it.
On Oct 19, 2014, at 9:33 AM, myself <chcdlf at 126.com<mailto:chcdlf at 126.com>> wrote:
Here is my test program
======
#include "mpi.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
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();
}
======
get the result like this
======
$ mpirun -n 2 ./tests
post send
send over
post recv
1 index 0
1 index 1
1 index 2
1 index 3
1 index 4
1 index 5
1 index 6
1 index 7
1 index 8
1 index 9
======
I think I should get some completed receive connection, not just 1.
_______________________________________________
discuss mailing list discuss at mpich.org<mailto:discuss at mpich.org>
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20141019/6046af36/attachment.html>
-------------- next part --------------
_______________________________________________
discuss mailing list discuss at mpich.org
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss
More information about the discuss
mailing list