OpenMP: implementation of threadprivate directive

OpenMP: implementation of threadprivate directive

Hi, guys,

I tried ICC8.0 and IFC8.0 compiler under Linux to compile C and Fortran code with openmp directive, and found that for each threadprivate variable, there is an explicit barrier operation for its initiation. I just wonder why each threadprivate variable requires one barrier, is one barrier for all threadprivate variables enough. I think the threadprivate directive is not effecient as we expect, can you further optimize it?

2 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

threadprivate should be used for global-lifetime objects. The(se) barriers are enterend only once at thread creation time and should not add significant latency time to the start of your application. Once the thread pool is created these barriers will not be entered again. Also note that as the main thread is initiating the thread pool, each spawned thread will likely make it through the barriers reasonably close to the completion of the creation of the last thread in the thread pool. IOW _beginthread latency may exceed the barriers execution times by already created threads.

Jim Dempsey

www.quickthreadprogramming.com

Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi