Thread Affinity Interface (Linux* and Windows*)
The Intel® runtime library has the ability to bind OpenMP* threads to physical processing units. The interface is controlled using the
environment variable. Depending on the system (machine) topology, application, and operating system, thread affinity can have a dramatic effect on the application speed.
Thread affinityrestricts execution of certain threads (virtual execution units) to a subset of the physical processing units in a multiprocessor computer. Depending upon the topology of the machine, thread affinity can have a dramatic effect on the execution speed of a program.
Thread affinity is supported on Windows* systems and versions of Linux* systems that have kernel support for thread affinity
, but is not supported by.
The Intel OpenMP runtime library has the ability to bind OpenMP* threads to physical processing units. There are three types of interfaces you can use to specify this binding, which are collectively referred to as the Intel OpenMP Thread Affinity Interface:
- The high-level affinity interface uses an environment variable to determine the machine topology and assigns OpenMP* threads to the processors based upon their physical location in the machine. This interface is controlled entirely by theKMP_AFFINITYenvironment variable .
- The mid-level affinity interface uses an environment variable to explicitly specifies which processors (labeled with integer IDs) are bound to OpenMP* threads. This interface provides compatibility with the gcc*environment variable, but you can also invoke it by using theGOMP_AFFINITYenvironment variable. TheKMP_AFFINITYenvironment variable is supported on Linux* systems only, but users on Windows* or Linux* systems can use the similar functionality provided by theGOMP_AFFINITYenvironment variable.KMP_AFFINITY
- The low-level affinity interface uses APIs to enable OpenMP* threads to make calls into the OpenMP* runtime library to explicitly specify the set of processors on which they are to be run. This interface is similar in nature tosched_setaffinityand related functions on Linux* systems or toSetThreadAffinityMaskand related functions on Windows* systems. In addition, you can specify certain options of theenvironment variable to affKMP_AFFINITY