[Omp] atomic and flush
Meadows, Lawrence F
lawrence.f.meadows at intel.com
Tue Nov 16 07:05:57 PST 2004
Your code should work with atomic if this is the only access to
the number_access array within the parallel region. Flush should
not be required. It may be a compiler problem.
Regards, Larry
>-----Original Message-----
>From: Omp-bounces at openmp.org [mailto:Omp-bounces at openmp.org]
>On Behalf Of Maria Jose Martin Santamaria
>Sent: Tuesday, November 16, 2004 4:20 AM
>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
>
More information about the Omp
mailing list