Hi,
I have followed the tutorial in this link: http://www.cs.ucla.edu/~zhu/tutorial/Using_MS-MPI.pdf to use MPI on my local windows machine with vs. The simple Hello wold work as expected, I have 2 processors and I get the expected result.
The problem is when I try a very simple send receive program I just see nothing printed on the screen, I have no errors in compilation or linking. Here is the code:
#include <iostream>
#include <mpi.h>
#include <stdio.h>
using namespace std;
int main (int argc, char *argv[])
{
int numtasks, rank, dest, source, rc, count, tag=1;
char inmsg, outmsg='x';
MPI_Status Stat;
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD, &numtasks);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if(rank == 0){
dest = 1;
rc = MPI_Send(&outmsg, 1, MPI_CHAR, dest, tag, MPI_COMM_WORLD);
}
else
{
source = 0;
rc = MPI_Recv(&inmsg, 1, MPI_CHAR, source, tag, MPI_COMM_WORLD, &Stat);
std::cout<<"Task "<<rank<<": Received "<< inmsg << "\n";
}
MPI_Finalize();
system("pause");
return 0;
}
the command line I use on cmd is: mpiexec -n 2 C:\Debug\out.exe and as I said I see nothing at all, the program just ask me to press any key to proceed. Anybody has an Idea what can be the problem?
Thanks!!