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 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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

Leave a Comment

Please sign in to add a comment. Not a member? Join today