[mpich-discuss] MPI_Send and MPI_Recv cause hang

Suad Basbug suadbasbug at gmail.com
Tue Sep 6 05:45:58 CDT 2011


Hello,

I installed MPICH2 to two computers ( 'suaddell' and 'o01' ) with Windows 7
operating system. Everything is good. I can run simple "Hello World"
applications in both hosts. But when I try to run simple MPI_Send and
MPI_Recv applications, the program does not end, it hangs. I can see it runs
without end on my computer and remote host by using Resource Monitor. If I
press "Ctrl+C", it is ended and it displays below message, it pretends that
every things work fine.

----------------------------------------------------------------------
mpiexec command and the message after Ctrl+C
----------------------------------------------------------------------

C:\>mpiexec.exe -hosts 2 suaddell o01 -noprompt mesajlasma.exe
 mpiexec aborting job...
Received Message :Hello World
_OK!_

job aborted:
rank: node: exit code[: error message]
0: suaddell: 123: mpiexec aborting job
1: o01: 123


------------------------
the code is here:
------------------------

 #include "stdafx.h"
#include "string.h"
#include "mpi.h"

int main(int argc, char* argv[])
{

int  nTasks, rank;
char mesaj[20];
MPI_Status status;

MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD,&nTasks);
MPI_Comm_rank(MPI_COMM_WORLD,&rank);

if(rank == 1)
{
strcpy_s(mesaj, "Hello World");
if (MPI_SUCCESS==MPI_Send(mesaj, strlen(mesaj)+1, MPI_CHAR, 0, 7,
MPI_COMM_WORLD)) printf("_OK!_\n");
}


if(rank == 0)
{
MPI_Recv(mesaj, 20, MPI_CHAR, 1, 7, MPI_COMM_WORLD, &status);
printf("Received Message :%s\n", mesaj);
}

MPI_Finalize();

return 0;
}


--------------------------------------------------------------------------------------------------------------------------------------------------------
When the program runs by using "-verbose" , i can see that the system is
waiting here untill pressing "Ctrl+C":
--------------------------------------------------------------------------------------------------------------------------------------------------------
.
(There are a lot of lines here)
.
......command written to left: "cmd=result src=0 dest=2 tag=5 cmd_tag=0
ctx_key=
0 result=SUCCESS "
......\smpd_free_command
.......\smpd_init_command
......./smpd_init_command
....../smpd_free_command
...../smpd_state_writing_cmd
..../smpd_handle_op_write
....sock_waiting for the next event.
....\SMPDU_Sock_wait
(this is the last line till I press "Ctrl+C")


How can I fix this problem.

Thanks in advance

Suad Basbug
Nevsehir University
Turkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20110906/08e38bee/attachment-0001.htm>


More information about the mpich-discuss mailing list