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

Nested OMP on Xeon Phi using OMP4

james_B_8
Beginner
509 Views

Xeon Phi has 60 cores and 4 threads per core. I am writing an experiment that will have 1 master thread on each core, and each of these will spawn  4 slave threads.

Looking at the manual https://software.intel.com/en-us/node/512835 it seems that I want to set the envars:

MIC_OMP_NESTED=TRUE
MIC_OMP_PROC_BIND="spread, close"
MIC_OMP_NUM_THREADS=60

Is this correct? I've tested this and it doesn't die... Is there a way I can get the runtime to spitout affinity debug info about where it is actually placing things so I can be certain?

Cheers,

James

0 Kudos
3 Replies
TimP
Honored Contributor III
509 Views

If you want to see whether spread or close took effect, you could set MIC_KMP_AFFINITY=verbose.  Are you serious about wanting to set both at the same time?

One might guess that your intentions align with OpenMP 4 teams concept.  OMP_NESTED doesn't have good affinity options.

0 Kudos
james_B_8
Beginner
509 Views

Thanks.

KMP_AFFINITY=verbose does indeed output verbose info for OMP_PROC_BIND.

I think it's working with the envars in my OP. Looking at the case of 2 master threads each spawning 2 slaves I get:

OMP: Info #242: KMP_AFFINITY: pid 50593 thread 0 bound to OS proc set {1}
...
OMP: Info #242: OMP_PROC_BIND: pid 50593 thread 1 bound to OS proc set {119}
...
OMP: Info #242: OMP_PROC_BIND: pid 50593 thread 2 bound to OS proc set {2}
OMP: Info #242: OMP_PROC_BIND: pid 50593 thread 3 bound to OS proc set {120}
OMP: Info #242: OMP_PROC_BIND: pid 50593 thread 2 bound to OS proc set {120}
OMP: Info #242: OMP_PROC_BIND: pid 50593 thread 3 bound to OS proc set {2}
OMP: Info #242: OMP_PROC_BIND: pid 50593 thread 2 bound to OS proc set {2}
OMP: Info #242: OMP_PROC_BIND: pid 50593 thread 3 bound to OS proc set {120}
OMP: Info #242: OMP_PROC_BIND: pid 50593 thread 2 bound to OS proc set {120}
OMP: Info #242: OMP_PROC_BIND: pid 50593 thread 3 bound to OS proc set {2}
OMP: Info #242: OMP_PROC_BIND: pid 50593 thread 2 bound to OS proc set {2}
OMP: Info #242: OMP_PROC_BIND: pid 50593 thread 3 bound to OS proc set {120}
OMP: Info #242: OMP_PROC_BIND: pid 50593 thread 2 bound to OS proc set {120}

0 and 1 are the 'masters' and threads 2 and 3 are the 'slaves' here. It thread numbering for the slaves is a bit tricky here. It seems that they are bound to the OS proc next to the OS proc of their parent. Where they end up depends entirely on which master spawns them first. This seems sensible to me.

I will try out omp teams.

Cheers,

james

0 Kudos
jimdempseyatthecove
Honored Contributor III
509 Views

James,

Try:

MIC_OMP_NESTED=TRUE
MIC_OMP_PROC_BIND="spread, close"
MIC_OMP_NUM_THREADS=60,4

Jim Dempsey

0 Kudos
Reply