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 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

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

Laisser un commentaire

Veuillez ouvrir une session pour ajouter un commentaire. Pas encore membre ? Rejoignez-nous dès aujourd’hui