[mpich-discuss] Race condition in MPI3 (Fortran, shared memory)

C.Friedrich c.friedrich at fz-juelich.de
Tue Jun 21 04:04:36 CDT 2016


Thank you.

After some research I have been able to solve the problem: MPI_WIN_FENCE
is correct, but an assignment like a=a+1 will always lead to race
conditions. This assignment has to be replaced by calls to
MPI_ACCUMULATE, which is "atomic" by design. So, calls to
MPI_ACCUMULATEs do not have to be separated by "fences". However, we
need fences to separate them from the local store (a=0) before and from
the read (e.g., write(*,*) a) afterwards. In the present case, one could
write

     ...
      b=1
      tdisp=0
      call mpe_win_fence(a,0,Nwin,err)
      do i = 1,10000
        call
mpi_accumulate(b,100,mpi_integer,0,tdisp,100,mpi_integer,mpi_sum,Nwin,err)
      enddo
      call mpe_win_fence(a,0,Nwin,err)
     ...

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     discuss at mpich.org
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss


More information about the discuss mailing list