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

Min Si msi at il.is.s.u-tokyo.ac.jp
Tue Jun 21 10:53:58 CDT 2016


Hi Christoph,

Thanks for the updates. I think this is the correct solution. In short, 
a=a+1 is not atomic. You have to use an atomic operation in your case, 
thus it needs to be MPI_ACCUMULATE.

Min

On 6/21/16 4:04 AM, C.Friedrich wrote:
> 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

_______________________________________________
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