[mpich-discuss] WMPIEXEC hangs

Rebecca rebeccakern at sbcglobal.net
Mon Jul 14 11:24:18 CDT 2008


Hi All,

 

I am new to using MPICH.  I am trying to get programs to run on wmpiexec,
but they do not seem to complete even with the MPI_Finalize().  I have to
click the break button to terminate.  Also, if anyone is aware of a good
reference manual with samples I would appreciate it because I am not able to
get the syntax correct for MPIWait().  The code is pasted below.  Thank you
in advance for assisting!

 

/* greetings.c -- greetings program

 *

 * Send a message from all processes with rank != 0 to the next lowest
neighbor.

 *    Process 0 prints the messages received.

 *

 * Input: none.

 * Output: contents of messages received by process 0.

 *

 */

#include <stdio.h>

#include <string.h>

#include <D:\\Program Files\\MPICH2\\include\\mpi.h> 

#pragma comment( lib, "D:\\Program Files\\MPICH2\\lib\\mpi.lib" ) 

 

main(int argc, char* argv[]) 

{

    int         my_rank;       /* rank of process      */

    int         p;                    /* number of processes  */

    int         dest;          /* rank of receiver     */

    int         tag = 0;       /* tag for messages     */

    int         i, j;               /* loop counters        */

    char        message[100], send[100];  /* storage for message  */

    MPI_Request req0;

      //MPI_Status  status;        /* return status for    */

                               /* receive              */

 

    /* Start up MPI */

    MPI_Init(&argc, &argv);

 

    /* Find out process rank  */

    MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);

 

    /* Find out number of processes */

    MPI_Comm_size(MPI_COMM_WORLD, &p);

 

      /* Create message */

      sprintf(message, "Greetings from process %d!",my_rank);

//    sprintf(send,message);

      

      for (i=0;i<p;i++)

      {

      for (j=p;j>=0;j--)

      {     

            dest = (my_rank + p)%(p+1);

            

            if(my_rank ==p)

            MPI_Isend(message, strlen(send)+1, MPI_CHAR, dest, tag,
MPI_COMM_WORLD, &req0);

            

            if(my_rank ==dest )     

            MPI_Irecv(message, 100, MPI_CHAR, p, tag, MPI_COMM_WORLD,
&req0);

      

//          MPI_Wait(req1, status);

      }

      if (my_rank == 0)/* my_rank == 0 */ 

            {     

                  printf("%s\n", message);

            }

      }

 

    /* Shut down MPI */

    MPI_Finalize();

      } /* main */

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20080714/b6425e8c/attachment.htm>


More information about the mpich-discuss mailing list