[Omp] atomic and flush
Maria Jose Martin Santamaria
mariam at udc.es
Tue Nov 16 08:56:08 PST 2004
Ok. Doubt solved. Thanks all for the help!.
María
Eric Duncan wrote:
>As Larry Meadows has also pointed out, it is more than likely to be a compiler issue.
>
>I just looked at the OpenMP spec again and you are correct that the wording could be more clear on this issue. I will bring it up again at the OpenMP 2.5 spec discussion.
>
>The only real indication that a flush is not needed is that it says that an implementation can replace atomic with critical. critical regions do imply a flush at entry and exit.
>
>I hope that helps.
>
>----- Original Message -----
>From: Maria Jose Martin Santamaria <mariam at udc.es>
>Date: Tuesday, November 16, 2004 5:40 am
>Subject: Re: [Omp] atomic and flush
>
>
>
>>This is a problem I had two years ago and I do not remember the
>>compiler
>>I used. I only remember that I run my programs in a Origin 2000.
>>
>>Really my doubt is if it is necessary or not to include a flush
>>directive when using a ATOMIC directive.
>>
>>I have not found in the spec any mention about implicit FLUSH
>>associated
>>with the ATOMIC directive. Nothing is said when talking about the
>>atomic
>>directive. Besides, the atomic directive does not appear in the
>>list of
>>directives with implicit flush when talking about the flush directive.
>>
>>Thank for your replies,
>>
>>Maria
>>
>>
>>Mats Brorsson wrote:
>>
>>
>>
>>>According to the spec, there is an implicit flush of number_access
>>>
>>>
>>with>atomic, just as there is a global implicit flush associated
>>with critical.
>>
>>
>>>However, your implementation might be wrong. Try adding a flush
>>>
>>>
>>after the
>>
>>
>>>atomic.
>>>
>>>Mats
>>>
>>>-----Original Message-----
>>>From: Omp-bounces at openmp.org [Omp-bounces at openmp.org] On Behalf Of
>>>Maria Jose Martin Santamaria
>>>Sent: Tuesday, November 16, 2004 1:20 PM
>>>To: omp
>>>Subject: [Omp] atomic and flush
>>>
>>>
>>>I have a parallel program with the following structure (simplified):
>>>
>>>C$OMP PARALLEL SHARED(INDEX,number_access,N)
>>>C$OMP+PRIVATE(i,re,myid,p)
>>>
>>> myid=OMP_GET_THREAD_NUM()
>>> p=OMP_GET_NUM_THREADS()
>>>
>>> do i=myid+1,N,p
>>> re=INDEX(i)
>>> .....
>>>
>>>C$OMP CRITICAL
>>> number_access(re)=number_access(re)+1
>>>C$OMP END CRITICAL
>>> .....
>>>
>>> enddo
>>>
>>>C$OMP END PARALLEL
>>>
>>>If I replace the CRITICAL directive by a ATOMIC directive the
>>>
>>>
>>program
>>
>>
>>>does not work. Could it be due to memory inconsistency?. Should I
>>>
>>>
>>add a
>>
>>
>>>FLUSH directive when using ATOMIC?. If yes, is it always necessary
>>>
>>>
>>to
>>
>>
>>>add a FLUSH directive when using a ATOMIC directive?.
>>>
>>>Thanks in advance for your help,
>>>
>>>María J. Martín
>>>Computer Architecture Group
>>>University of A Coruña
>>>Spain
>>>
>>>
>>>_______________________________________________
>>>Omp mailing list
>>>Omp at openmp.org http://openmp.org/mailman/listinfo/omp_openmp.org
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openmp.org/pipermail/omp/attachments/20041116/3f95745f/attachment.html
More information about the Omp
mailing list