<SYNC ALL Example Program>
Program sync_all_example
Implicit None
Real :: a[*]
Integer i
! The first image will set the value of the coarray A on every image.
If (This_Image()==1) Then
Do i = 1, Num_Images()
a[i] = i**2
End Do
End If
! Wait for image one to finish.
Sync All
! Check the results.
If (a/=This_Image()**2) Error Stop 'FAILed'
! Wait for everyone to finishing checking.
Sync All
! The last image will report success.
If (This_Image()==Num_Images()) Print *,'ok'
End Program
■ Execution Results
ok