[Omp] Threadprivate variables and nested parallelism
Jakub Jelinek
jakub at redhat.com
Thu Dec 14 01:38:32 PST 2006
On Thu, Dec 14, 2006 at 10:22:44AM +0100, Dieter an Mey wrote:
> I am afraid that using pointers would badly hurt performance (at least
> in Fortran)
Over a function call which would use a hash table and return a pointer
to the variable, all "hidden" in the implementation?
You need to look how the compiler you are using implements threadprivate.
E.g. GCC implements threadprivate either using ELF TLS (in executables
the vars can be accessed pretty cheaply, say on x86_64 using %fs:offset
or movq offset at got, %rX; %fs:(%rX)), or using pthread_getspecific (at which
point a threadprivate variable access is always through a pointer).
Changing the meaning of threadprivate in a way where you could share
it among nested parallel regions would hurt performance of it whenever ELF
TLS is used, because it would necessarily add one level of indirection (as
TLS is really a thread local storage), exactly what you could do on the
application level, without requiring OpenMP implementation changes.
Jakub
More information about the Omp
mailing list