Actually, afaik, Win_fence is not the right synchronization method for you approach. As Halim said, you should use passive-target synchronization here. Fence guarantees you that all RMA operations on win originating at a given process and started before the fence call will complete at that process before the fence call return - so it only synchronizes RMA calls - but not multiple accesses to the same are. However, in you example that does NOT avoid that two processes access a at the same time - that why you get your race-condition. Lena On Apr 13, 2016, at 3:08 PM, Halim Amer <[email protected]<mailto:[email protected]>> wrote: Win_sync can only be used within passive target epochs. You could replace the win_fences with win_locks. --Halim On 4/13/16 11:28 AM, C.Friedrich wrote: Thanks for the suggestion! Adding MPI_WIN_SYNC in this way: do i = 1,10000 call mpe_win_fence(a,0,Nwin,err) a = a + 1 call mpi_win_sync(Nwin,err) call mpe_win_fence(a,0,Nwin,err) enddo does not work. The compiled executable either issues the error Fatal error in MPI_Win_sync: Wrong synchronization of RMA calls , error stack: MPI_Win_sync(115)..: MPI_Win_sync(win=0xa0000000) failed MPID_Win_sync(1805): Wrong synchronization of RMA calls or simply dies (without writing the numbers). Perhaps I use it incorrectly... Christoph ------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------ Forschungszentrum Juelich GmbH 52425 Juelich Sitz der Gesellschaft: Juelich Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498 Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender), Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt, Prof. Dr. Sebastian M. Schmidt ------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------ _______________________________________________ discuss mailing list [email protected]<mailto:[email protected]> To manage subscription options or unsubscribe: https://lists.mpich.org/mailman/listinfo/discuss _______________________________________________ discuss mailing list [email protected]<mailto:[email protected]> To manage subscription options or unsubscribe: https://lists.mpich.org/mailman/listinfo/discuss _______________________________________________ discuss mailing list [email protected] To manage subscription options or unsubscribe: https://lists.mpich.org/mailman/listinfo/discuss