program main
implicit none
include 'mpif.h'
integer i, send_buf, recv_buf, nprocs, rank, namelen, ierr, req
character (len=MPI_MAX_PROCESSOR_NAME) :: name
integer stat(MPI_STATUS_SIZE)
INTEGER :: bsend_size
CHARACTER, dimension (:), allocatable :: bsend_buffer
call MPI_INIT (ierr)
call MPI_COMM_SIZE (MPI_COMM_WORLD, nprocs, ierr)
call MPI_COMM_RANK (MPI_COMM_WORLD, rank, ierr)
call MPI_GET_PROCESSOR_NAME (name, namelen, ierr)
if (rank.eq.0) then
bsend_size = nprocs*(1*MPI_INTEGER + MPI_BSEND_OVERHEAD)
allocate(bsend_buffer(bsend_size))
call MPI_Buffer_attach(bsend_buffer, bsend_size, ierr)
do i = 0, nprocs - 1
send_buf = i*10
call MPI_BSEND (send_buf, 1, MPI_INTEGER, i, 1, MPI_COMM_WORLD, ierr)
enddo
! attached buffer always need to be detached after use
call MPI_Buffer_detach(bsend_buffer, bsend_size, ierr)
deallocate(bsend_buffer)
end if
call MPI_RECV (recv_buf, 1, MPI_INTEGER, 0, 1, MPI_COMM_WORLD, stat, ierr)
print *, 'Hello world: rank ', rank, 'received', recv_buf
call MPI_BARRIER(MPI_COMM_WORLD, ierr)
call MPI_FINALIZE (ierr)
end
Is anyone aware of a known issue with this type of calls?
Thank you!
Pietro Ghillani
Link Copied
For more complete information about compiler optimizations, see our Optimization Notice.