[mvapich-discuss] MPI continuous send and receive of messages in a loop

Devendar Bureddy bureddy at cse.ohio-state.edu
Mon Oct 31 10:55:51 EDT 2011


Hi Juan

Here are couple of my observation.

In your program, you are explicitly asking to send/recv 50 integers.
Hence, it is doing so.  I'm not sure, what datatype you declared the
variable "string"
   MPI_Send(&string, 50
   MPI_Recv(&string, 50

Your programs is semantically incorrect as per MPI standard.  As per
standard, each rank should call MPI_Finalize in order to exit the mpi
job cleanly. But, It seems this will not happen in your program.  In
your application, when one rank exits when condition (strings == n) is
met, all other threads will be stuck in blocking MPI_Recv.  The job
launcher(mpiexec) will send a explicit singal 15 (SIGTERM) to clean
the other processes when it detects a abnormal termination of one
process.  Hence you are seeing "APPLICATION TERMINATED WITH THE EXIT
STRING: Terminated (signal 15)". This is expected with your program.

-Devendar

On Mon, Oct 31, 2011 at 9:06 AM, Juan Vercellone <juanjov at gmail.com> wrote:
>
> On Mon, Oct 31, 2011 at 12:56 AM, roger federer <ooops.789 at gmail.com> wrote:
> > ohk so i need to place the string==n outside the if loop??? but i see that
> > even if i give more number of messages to be sent, it is showing only max of
> > 2 messages are sent and it is printing "ONE OF THE PROCESSES TERMINATED
> > BADLY: CLEANING UP
> > APPLICATION TERMINATED WITH THE EXIT STRING: Terminated (signal 15)
> > "
> >
> > On Mon, Oct 31, 2011 at 12:15 AM, Juan Vercellone <juanjov at gmail.com> wrote:
> >>
> >> On Sun, Oct 30, 2011 at 10:53 PM, roger federer <ooops.789 at gmail.com>
> >> wrote:
> >> > well i am trying to do a program, where the process 0 should start the
> >> > initialization of sending messages to a random process other than
> >> > itself,
> >> > then the random process selected should receive the message and send to
> >> > another random process. This should happen until the requested number of
> >> > messages to be sent is done, which is given by the user as input. I see
> >> > that
> >> > my program is either sending messages at the max 2 or else even none and
> >> > giving me the following error
> >> >
> >> > ONE OF THE PROCESSES TERMINATED BADLY: CLEANING UP
> >> > APPLICATION TERMINATED WITH THE EXIT STRING: Terminated (signal 15)
> >> >
> >> >
> >> > Here is my code, lemme know whats the loop hole in it. The random
> >> > generation
> >> > part is not included, which is working fine
> >> >
> >> >
> >> >     if(rank==0)
> >> >     {
> >> >     rnum=rgenerator(rank,size);
> >> >     string++;
> >> >     MPI_Send(&string, 50, MPI_INT, rnum, rnum, MPI_COMM_WORLD);
> >> >     printf("\n process %d sends message to process %d",rank, rnum);
> >> >
> >> >     //MPI_Recv(&flag, 100, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG,
> >> > MPI_COMM_WORLD, &status);
> >> >
> >> >     }
> >> >
> >> >         while(flag!=1)
> >> >         {
> >> >
> >> >         if(MPI_Recv(&string, 50, MPI_INT, MPI_ANY_SOURCE, rank,
> >> > MPI_COMM_WORLD, &status)==MPI_SUCCESS)
> >> >         {
> >> >
> >> >             printf("\n process %d receives message from process %d count
> >> > :
> >> > %d",rank, status.MPI_SOURCE, string);
> >> >             rnum=rgenerator(rank,size);
> >> >             printf("\n Random num generated is %d",rnum);
> >> >             string=string+1;
> >> >             MPI_Send(&string, 50, MPI_INT, rnum, rnum, MPI_COMM_WORLD);
> >> >             count++;
> >> >
> >> >             printf("\n process %d sends message to process %d", rank,
> >> > rnum);
> >> >
> >> >             //MPI_Bcast(&count, 40, MPI_INT, rank, MPI_COMM_WORLD);
> >> >             if(string==n)
> >> >             {
> >> >                 printf("\n\n Messages reached");
> >> >                 flag=1;
> >> >
> >> >             }
> >> >
> >> >         }
> >> >         else
> >> >             flag=0;
> >> >         }
> >> >
> >> >
> >> >
> >> >
> >> > thank you.
> >> >
> >> > _______________________________________________
> >> > mvapich-discuss mailing list
> >> > mvapich-discuss at cse.ohio-state.edu
> >> > http://mail.cse.ohio-state.edu/mailman/listinfo/mvapich-discuss
> >> >
> >> >
> >>
> >> Note that the only process that will be exiting is the one that sends
> >> when string == n. All the other processes will keep on executing the
> >> program because they will not find the condition string == n, as
> >> string continues to be incremented.
> >>
> >> I think that an exit condition such as string >= n will do, but you
> >> need to be aware of the exiting processes in order to avoid sending
> >> data to anyone of them.
> >>
> >> Regards,
> >>
> >> --
> >> ---------- .-
> >> VERCELLONE, Juan.
> >> (also known as 1010ad1c97efb4734854b6ffd0899401)
> >
> >
>
> You may also need to check why the MPI_Send and MPI_Recv are sending
> 50 integers of data.
> Is every sending/receiving buffer previously allocated?
>
> --
> ---------- .-
> VERCELLONE, Juan.
> (also known as 1010ad1c97efb4734854b6ffd0899401)
>
> _______________________________________________
> mvapich-discuss mailing list
> mvapich-discuss at cse.ohio-state.edu
> http://mail.cse.ohio-state.edu/mailman/listinfo/mvapich-discuss



More information about the mvapich-discuss mailing list