[mpich-discuss] MPI_Finalize hangs

shridhar mohan shri.emi at gmail.com
Mon Jul 25 18:25:24 CDT 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20110725/6a8efb9e/attachment.htm>


More information about the mpich-discuss mailing list