I have the following c/c++ code with Microsoft MPI
#include <stdio.h>
#include <stdlib.h>
#include "mpi.h"
int main (int argc, char *argv[])
{
int err, numtasks, taskid;
int out=0,val;
MPI_Status status;
MPI_Request req;
err=MPI_Init(&argc, &argv);
err=MPI_Comm_size(MPI_COMM_WORLD, &numtasks);
err=MPI_Comm_rank(MPI_COMM_WORLD, &taskid);
int receiver=(taskid+1)% numtasks;
int sender= (taskid-1+numtasks)% numtasks;
printf("sender %d, receiver %d, rank %d\n",sender,receiver, taskid);
val=50;
MPI_Isend(&val, 1, MPI_INT, receiver, 1, MPI_COMM_WORLD, &req);
MPI_Irecv(&out, 1, MPI_INT, sender, 1, MPI_COMM_WORLD, &req);
printf ("Rank: %d , Value: %d\n", taskid, out );
err=MPI_Finalize();
return 0;
}
The application goes in deadlock if launched with more than 2 processes. With 2 processes the application works but no write on "out" is performed. This code works with a linux mpi distribution, the problem seems to be only in the microsoft version.
Any help ?