[Omp] Re: critical directive or openmp_*_lock library routines?
Shah, Sanjiv
sanjiv.shah at intel.com
Fri Jun 30 04:44:49 PDT 2006
Correct, you have to name it uniquely to guarantee it doesn't overlap
with some other. Also, you can embed omp_lock variables in data
structures but you cannot embed the critical name into any data
structure.
OTOH, some people find the global nature of critical very convenient.
Sanjiv
--
Sanjiv, 217-403-4244
-----Original Message-----
From: omp-bounces at openmp.org [mailto:omp-bounces at openmp.org] On Behalf
Of Daniel Franke
Sent: Friday, June 30, 2006 6:43 AM
To: omp at openmp.org
Subject: [Omp] Re: critical directive or openmp_*_lock library routines?
Sanjiv,
> There should be no performance difference between using CRITICAL and
> omp_lock. However, CRITICAL is global across the program whereas with
> omp_locks, you can control who else has access to that lock.
"critical across the program" means, that critical blocks will never
ever be executed in parallel even when completely unrelated? THIS is
meant by "A thread waits at the beginning of a critical section until
no other thread is executing a critical section with the same name.
All unnamed CRITICAL directives map to the same name" (from the
standard, v2.0, section 2.5.2)?!
Therefore, if I want to use a critical section to guard a variable, I
have to name it _uniquely_ or should otherwise use a private mutex
within the module. I think, I will go for the latter.
Thanks for clarification!
Daniel
_______________________________________________
Omp mailing list
Omp at openmp.org
http://openmp.org/mailman/listinfo/omp
More information about the Omp
mailing list