OpenMP KMP_AFFINITY with proclist

OpenMP KMP_AFFINITY with proclist

Hi All,

I am trying to understand how "proclist" works with KMP_AFFINITY. I run a benchmark with following environment variables:

export KMP_AFFINITY=verbose,grianularity=fine,proclist=[0,{10,12,13}],explicit
export OMP_NUM_THREADS=4

The system I have has 64 cores (256 threads) and for above settings, threads should be as following:

Thread 0 -> Core 0
Thread 1,2,3 -> Core 10,12,13 or any one of these three cores should be used by thread 1,2, and 3

However, I see following log from OpenMP:

OMP: Info #247: KMP_AFFINITY: pid 23537 tid 23537 thread 0 bound to OS proc set {0}
OMP: Info #247: KMP_AFFINITY: pid 23537 tid 23538 thread 1 bound to OS proc set {13}
OMP: Info #247: KMP_AFFINITY: pid 23537 tid 23540 thread 3 bound to OS proc set {13}
OMP: Info #247: KMP_AFFINITY: pid 23537 tid 23539 thread 2 bound to OS proc set {0}

Can anyone please explain why only core 0 and 13 is being used?

Thanks.

Chetan Arvind Patil
8 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Dear Chetan,

To allow OpenMP* thread ID 1-3 to "float" between OS proc ID  10-13,
please set KMP_AFFINITY="granularity=fine,proclist=[0,{10,12,13},{10,12,13},{10,12,13}],explicit"

Regards,
Krishnaprasad 

Hi Krishnaprasad,

I get following log:

OMP: Info #247: KMP_AFFINITY: pid 37808 tid 37808 thread 0 bound to OS proc set {0}
OMP: Info #247: KMP_AFFINITY: pid 37808 tid 37817 thread 1 bound to OS proc set {10,12,13}
OMP: Info #247: KMP_AFFINITY: pid 37808 tid 37818 thread 2 bound to OS proc set {10,12,13}
OMP: Info #247: KMP_AFFINITY: pid 37808 tid 37819 thread 3 bound to OS proc set {10,12,13}

To which cores are thread 1, 2 and 3 are mapped? What's the criteria here?

When you say float, does that mean thread 1, 2 and 3 can switch from one core to another during its lifetime?

Thanks.

Chetan Arvind Patil

Dear Chetan,

By explicitly specifying Proc ID's, you are assigning OpenMP* threads to the processors based upon their physical location in the machine.

KMP_AFFINITY="granularity=fine,proclist=[0,{10,12,13},{10,12,13},{10,12,13}],explicit"

The above flag set the OpenMP* thread ID 0 to run exclusively on OS proc ID 0 only.  All other OpenMP* threads ID 1-3 could run on any of the OS proc ID's 10,12 or 13.

So I hope you are clear on Explicitly Specifying OS Processor IDs.

For more details, please refer below link:
https://software.intel.com/en-us/node/522691#EXPLICITLY_SPECIFYING_OS_PR...

Regards,
Krishnaprasad 

Dear Chetan,

Hope the information shared was helpful.

So if you don't have any more questions may I close this thread?

 

Regards,

Krishnaprasad 

 

Hi Krishnaprasad,

Yes, please.

Thanks.

Chetan Arvind Patil

Hi Krishnaprasad,

How will the proclist be when I want to assign two threads to same core or four threads to same core? As the number of threads per core supported in four. I don't think proclist takes number beyond 0 to 63? 

I want to map thread 1,2,3,4 to core 0 which has IDs: 0, 64, 128, 192?

Thanks.

Chetan Arvind Patil
Best Reply

Hi Chetan,

Following are two methods to map thread to a specific core/ proc_list

1. Using KMP_AFFINITY environment variable
 export KMP_AFFINITY='proclist=[0, 64, 128, 192],explicit'
 The above code will assign thread ID 0 to proc_id 0, thread ID 2 to proc_id 64 and so on.

2. OR using OMP_PLACES environment variable
 The OMP_PLACES environment variable allows you to specify groups of cores on which you’d like your threads to be bound
 export OMP_PLACES='{0}'
 This will allow OpenMP threads to run on cores 0.

I hope your query has been answered.
Since this is a closed thread, for further queries please start a new one.

Thanks and Regards,
Krishnaprasad T

Leave a Comment

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