LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Nick Nevin (njnevin_at_[hidden])
Date: 2003-09-19 07:29:00


On Thu, Sep 18, 2003 at 11:34:02PM +0800, poknam wrote:
> Thank you very much!! It works now.
> Now I want to follow the logic of the program and write my own one. Here's
> the code:
>
> program main
> include 'mpif.h'
> parameter (BUFSIZE = 2048)
> integer ierr, rank
> integer tag, status(MPI_STATUS_SIZE)
> integer size
> real message(BUFSIZE)
> real BUFFER(2048)
> call MPI_INIT(ierr)
> call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)
>
> tag = 0
> if (rank == 0) then
> print *, 'Hello world! I am proc ', rank,
> 1 ', sending to proc 1..'
> size = BUFSIZE * 4 + MPI_BSEND_OVERHEAD
> call MPI_BUFFER_ATTACH(BUFFER, size, ierr)
> call MPI_BSEND(message, BUFSIZE, MPI_REAL,
> 1 1, tag, MPI_COMM_WORLD, ierr)
> call MPI_BUFFER_DETACH(BUFFER, size, ierr)
> else if (rank == 1) then
> call SLEEP(3)
> print *, 'Hello world! I am proc ', rank,
> 1 ', just wake up!!'
> call MPI_RECV(message, BUFSIZE, MPI_REAL,
> 1 0, tag, MPI_COMM_WORLD, status, ierr)
> print *, 'Hello world! Received 1 message ',
> 1 'proc 1!!'
> endif
> print *, 'Proc ', rank, ' finished!!'
> call MPI_FINALIZE(ierr)
> end
>
> Runtime error occur, I've tried changing the value of "size" or the
> dimension of "BUFFER", but the result is the same. Here's the output:
>
> Hello world! I am proc 0, sending to proc 1..
> MPI_Bsend: unclassified: No buffer space available (rank 0, MPI_COMM_WORLD)
> Rank (0, MPI_COMM_WORLD): Call stack within LAM: Rank (0, MPI_COMM_WORLD):
> - MPI_Bsend() Rank (0, MPI_COMM_WORLD): - main()
>
> Can anyone tell me why?? Million thanks.
>
> P.N. Lai

Add the line
      integer BUFSIZE
immediatley after the include 'mpif.h' line otherwise BUFSIZE defaults
to real and this seems to cause the problem.

I recommend in general using implicit none and explicitly declaring the
type of all variables.

-nick