oh! it works now. Thanks a lot and sorry about my negligence.

2013/3/1 Ake Sandgren <ake.sandg...@hpc2n.umu.se>

> On Fri, 2013-03-01 at 01:24 +0900, Pradeep Jha wrote:
> > Sorry for those mistakes. I addressed all the three problems
> > - I put "implicit none" at the top of main program
> > - I initialized tag.
> > - changed MPI_INT to MPI_INTEGER
> > - "send_length" should be just "send", it was a typo.
> >
> >
> > But the code is still hanging in sendrecv. The present form is below:
> >
>
> "tag" isn't iniitalized to anything so it may very well be totally
> different in all the processes.
> ALWAYS initialize variables before using them.
>
> > main.f
> >
> >
> >   program   main
> >
> >   implicit none
> >
> >   include  'mpif.h'
> >
> >   integer me, np, ierror
> >
> >   call  MPI_init( ierror )
> >   call  MPI_comm_rank( mpi_comm_world, me, ierror )
> >   call  MPI_comm_size( mpi_comm_world, np, ierror )
> >
> >   call sendrecv(me, np)
> >
> >   call mpi_finalize( ierror )
> >
> >   stop
> >   end
> >
> > sendrecv.f
> >
> >
> >   subroutine sendrecv(me, np)
> >
> >   include 'mpif.h'
> >
> >   integer np, me, sender, tag
> >   integer, dimension(mpi_status_size) :: status
> >
> >   integer, dimension(1) :: recv, send
> >
> >   if (me.eq.0) then
> >
> >      do sender = 1, np-1
> >         call mpi_recv(recv, 1, mpi_integer, sender, tag,
> >  &           mpi_comm_world, status, ierror)
> >
> >      end do
> >   end if
> >
> >   if ((me.ge.1).and.(me.lt.np)) then
> >      send(1) = me*12
> >
> >      call mpi_send(send, 1, mpi_integer, 0, tag,
> >  &        mpi_comm_world, ierror)
> >   end if
> >
> >   return
> >   end
>
>
>
> _______________________________________________
> users mailing list
> us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/users
>

Reply via email to