[mpich-discuss] MPI_Finalize hangs

Jayesh Krishna jayesh at mcs.anl.gov
Mon Jul 25 20:34:53 CDT 2011


Hi,
 Can you run the example program provided with MPICH2 (C:\Progra~1\MPICH2\examples\cpi.exe)?

(PS: The MPI processes try to connect to each other to exchange data when MPI_Send() is called. So your problem could still be a network setup issue.)
Regards,
Jayesh

----- Original Message -----
From: "shridhar mohan" <shri.emi at gmail.com>
To: "Jayesh Krishna" <jayesh at mcs.anl.gov>
Cc: mpich-discuss at mcs.anl.gov
Sent: Monday, July 25, 2011 6:25:24 PM
Subject: MPI_Finalize hangs

Hi, 

I found the problem. 
It was not the firewall. 

The process hangs at MPI_Finalize. 
When i abort the process I Get correct the results. 

I think the MPI_Send causes this problem. 
I tried using non-blocking send but ran in to the same issue. 
I have the same issue when i try running the CPi.c example 
on multiple hosts. 

The following is the code. 
I don't see anything wrong with it. 
What do you think causes this issue. 

Program 

#include < mpi .h> 
#include <iostream> 
#include <stdio.h> /* printf and BUFSIZ defined there */ 
#include <stdlib.h> /* exit defined there */ 


using namespace std; 

int _tmain(int argc, char * argv[]) 
{ 
int numtasks, rank, dest, source, rc, tag=1; 
char inmsg, outmsg='F'; 
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; 
printf(" Process %d: testing \n",rank); 

rc = MPI_Send(&outmsg, 1, MPI_CHAR, dest, tag, MPI_COMM_WORLD); 
printf(" Process %d: sent \n",rank); 

} 

else if (rank == 1) { 
source = 0; 
printf(" Process %d: testing \n",rank); 
rc = MPI_Recv(&inmsg, 1, MPI_CHAR, source, tag, MPI_COMM_WORLD,&Stat); 

printf("Process %d: Received %c char(s) from task %d with tag %d \n", 
rank, inmsg, Stat.MPI_SOURCE, Stat.MPI_TAG); 


} 

MPI_Finalize(); 
return 0; 
} 

-Regards 
-shridhar 




More information about the mpich-discuss mailing list