<SYNC MEMORY Example Program>

Program sync_memory_example
  Integer :: value[*]
  If (This_Image()==1) Then
    value = 123
    ! Segment break before the synchronisation.
    Sync Memory
    ! Use the filesystem to synchronise.
    Open(13,File='u2.tmp',Status='New')
    Close(13)
  End If
  If (This_Image()==Num_Images()) Then
    ! Wait for the first image to create the file.
    Do
      Open(17,File='u2.tmp',Status='Old',Err=100)
      Exit
100   Continue
    End Do
    ! Segment break after the synchronisation.
    Sync Memory
    If (value[1]==123) Then
      Print *,'ok'
    Else
      Print *,'FAIL',value[1]
    End If
    Close(17,Status='Delete')
  End If
End Program

■ Execution Results

  ok