Block construct and sync all behavior

Damian Rouson damian@sourceryinstitute.org
Tue Oct 21 03:19:00 GMT 2014


The program and output below seem to show that the "sync all” is not serving as a barrier.  I would have expected that b oth “Now image…” lines would appear at the end of the output.  If however, I uncomment the shown “block” and “end block”, I get the behavior I expected.  Is this behavior correct?  Does it relate in some way to buffering?  

FYI, I’m using GNU Fortran (GCC) 5.0.0 20140917 (experimental).

Damian

$ cat print-order.f90 
  implicit none
  integer :: i
 !block
  do i=1,10
    print *,"Image",this_image(),"is on loop iteration",i
  end do
  sync all
 !end block
  print *,"Now image",this_image(),"is done looping.”
end

$ mpif90 -fcoarray=lib print-order.f90 -lcaf_mpi

$ mpirun -np 2 ./a.out
 Image           1 is on loop iteration           1
 Image           1 is on loop iteration           2
 Image           1 is on loop iteration           3
 Image           1 is on loop iteration           4
 Image           1 is on loop iteration           5
 Image           1 is on loop iteration           6
 Image           1 is on loop iteration           7
 Image           1 is on loop iteration           8
 Image           1 is on loop iteration           9
 Image           1 is on loop iteration          10
 Now image           1 is done looping.
 Image           2 is on loop iteration           1
 Image           2 is on loop iteration           2
 Image           2 is on loop iteration           3
 Image           2 is on loop iteration           4
 Image           2 is on loop iteration           5
 Image           2 is on loop iteration           6
 Image           2 is on loop iteration           7
 Image           2 is on loop iteration           8
 Image           2 is on loop iteration           9
 Image           2 is on loop iteration          10
 Now image           2 is done looping.




More information about the Fortran mailing list