Are you using OpenMP with the Intel Composer XE 2013 Update 2 for Intel(R) Xeon Phi Coprocessors?
Did you know there is a new environment variable to control thread affinity and topology on Phi in the Composer XE 2013 Update 2 compiler (18.104.22.168)? It was in the Release Notes for Composer XE 2013 Update 2, so surely you read it there. :)
If you did hear about KMP_PLACE_THREADS, also keep in mind IT DOES NOT REPLACE KMP_AFFINITY, rather, it WORKS WITH KMP_AFFINITY.
With KMP_PLACE_THREADS you can easily control thread placement for most common usages WITHOUT resorting to a ghastly EXPLICIT KMP_AFFINITY list. Here's an example stolen from our extensive article on OpenMP Thread affinity, part of our Compiler Methodology masterwork:
example: If we have a 61 core Phi, we decide to use 60 cores for an application, all 4 threads per core. The application is an offload application on the host with 2 processes. We want to use cores 0..29 for process 1. We want to use cores 30..60 for process 2. Here is an example of doing this:
- Process 1 offload environment var setup:
- Process 2 offload environment var setup:
This is how Offset can be used to effectively partition the Phi cores and prevent processes from colliding on the same cores. If you've tried to do something similar with explicit lists and KMP_AFFINITY you will appreciate the simplicity of this new solution.
Remember, KMP_PLACE_THREADS is only available in Composer XE 2013 Update 2 (Version 22.214.171.124 Build 20130121) and newer. It is not present in older compilers. This variable only affects the OpenMP runtime for Phi, either native or offload.
For all the details, visit the full article on OpenMP Thread Affinity.
Thanks for reading!