Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

KMP_AFFINITY for nested parallelism



We have encountered a problem, and we would really appreciate your help: 

We are trying to use openMP to implement two levels of parallelism in our system. In the first level, two threads are produced. Then, each of those two threads, produce 32 threads of their own (the total number of threads in the system is 64). We want our system to function in a way that the 32 threads produced by parent0 have affinity = compact; the 32 threads produced by parent1 also have affinity = compact; but the two sets of threads are distant from each other. 

In this case, we cannot use proc_list + KMP_AFFINITY, because we don't know which threads are produced by the same parent. If there is a way that a parent thread could choose which child threads it is going to produce, the problem will be solved. For example if threads0 could define the set of {thread2, thread3, ..., thread33} as its set of child threads, then we could assign them to nearby cores, using proc_list + KMP_AFFINITY. Is such a thing possible? And if yes, how can we do it?

If there is also any other way to solve our problem, we will really appreciate your help. 

Thank you very much



0 Kudos
1 Reply
Black Belt

If you are using levels in the traditional sense, each thread of level 0 would have its own thread pool for its level 1. IOW are you intending for each thread in level 0 to have an exclusive pool of 2 threads?

Or just what are you expecting with your partitioning.

Jim Dempsey