Sorry for that, here is the attachement!
Peter
----- Original Message -----
> Peter --
>
> Somewhere along the way, your attachment got lost. Could you re-send?
>
> Thanks.
>
>
> > On Feb 10, 2016, at 5:56 AM, Peter Wind <[email protected]> wrote:
> >
> > Hi,
> >
> > Under fortran, MPI_Win_allocate_shared is called with a window size of zero
> > for some processes.
> > The output pointer is then not valid for these processes (null pointer).
> > Did I understood this wrongly? shouldn't the pointers be contiguous, so
> > that for a zero sized window, the pointer should point to the start of the
> > segment of the next rank?
> > The documentation explicitly specifies "size = 0 is valid".
> >
> > Attached a small code, where rank=0 allocate a window of size zero. All the
> > other ranks get valid pointers, except rank 0.
> >
> > Best regards,
> > Peter
> > _______________________________________________
> > users mailing list
> > [email protected]
> > Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users
> > Link to this post:
> > http://www.open-mpi.org/community/lists/users/2016/02/28485.php
>
>
> --
> Jeff Squyres
> [email protected]
> For corporate legal information go to:
> http://www.cisco.com/web/about/doing_business/legal/cri/
>
> _______________________________________________
> users mailing list
> [email protected]
> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users
> Link to this post:
> http://www.open-mpi.org/community/lists/users/2016/02/28486.php
>
program sharetest
! test zero size segment.
! run on at least 3 cpus
! mpirun -np 4 a.out
use mpi
use, intrinsic :: iso_c_binding,
implicit none
integer, parameter :: nsize = 20
integer, pointer :: array(:)
integer :: num_procs
integer :: ierr
integer :: irank, irank_group
integer :: win
integer :: disp_unit
type(c_ptr) :: cp1
type(c_ptr) :: cp2
integer(MPI_ADDRESS_KIND) :: win_size
integer(MPI_ADDRESS_KIND) :: segment_size
call MPI_Init(ierr)
call MPI_Comm_size(MPI_COMM_WORLD, num_procs, ierr)
call MPI_Comm_rank(MPI_COMM_WORLD, irank, ierr)
disp_unit = sizeof(1)
win_size = irank*disp_unit
call MPI_Win_allocate_shared(win_size, disp_unit, MPI_INFO_NULL, MPI_COMM_WORLD, cp1, win, ierr)
! write(*,*)'rank ', irank,', pointer ',cp1
call c_f_pointer(cp1, array, [nsize])
77 format(4(A,I3))
if(irank/=0)then
array(1)=irank
CALL MPI_BARRIER(MPI_COMM_WORLD, ierr)
if(irank/=num_procs-1)then
print 77, ' rank', irank, ': array(1)', array(1),' shared with next rank: ',array(irank+1)
else
print 77, ' rank', irank, ': array(1)', array(1),' shared with previous rank: ',array(0)
endif
CALL MPI_BARRIER(MPI_COMM_WORLD, ierr)
else
CALL MPI_BARRIER(MPI_COMM_WORLD, ierr)
CALL MPI_BARRIER(MPI_COMM_WORLD, ierr)
if(.not.associated(array))then
print 77, 'zero pointer found, rank', irank
else
print 77, ' rank', irank, ' array associated '
print 77, ' rank', irank, ': array(1) ', array(1),' shared with next rank: ',array(irank+1)
endif
endif
call MPI_Finalize(ierr)
end program sharetest