Controlling Thread Allocation
Controlling Thread Distribution
To Assign This Number of Threads ...
... Use This Setting
Controlling Thread Bindings
- compact: sequentially distribute the threads among the cores that share the same cache.
- scatter: distribute the threads among the cores without regard to the cache.
OpenMP Threads on Core 0
OpenMP Threads on Core 1
0, 1, 2
3, 4, 5
0, 2, 4
1, 3, 5
Determining the Best Setting
- Ensure that your OpenMP code is working properly before using these environment variables.
- Establish a baseline with your current OpenMP code to compare to the performance when you allocate the threads to a processor.
- Measure the performance of distributing one, two, three, or four threads per core by use theKMP_HW_SUBSETvariable.
- Measure the performance of binding the threads to the cores by using theKMP_AFFINITYvariable.