Binds OpenMP threads to OS processors.
IppStatus ippSetAffinity(IppAffinityType aType, int offset);
aType |
Type of affinity settings, the possible values: |
ippAffinityCompactFineCore |
|
ippAffinityCompactFineHT |
|
ippAffinityAllEnabled |
|
ippAffinityRestore |
|
ippTstAffinityCompactFineCore |
|
ippTstAffinityCompactFineHT |
|
offset |
Specified the starting position for thread assignment. |
The function ippSetAffinity is declared in the ippcore.h file. This function sets OpenMP thread affinity for all OpenMP parallel regions in the current context.
Thread affinity is supported only on systems running Windows* OS and those versions of Linux* OS that have kernel support for thread affinity.
The function ippSetAffinity increases performance of the threaded functions on the homogeneous systems. Specifically it is very effective if there are several packages that don't share the same last level cache (LLC), or when hyper threading is enabled. In last case highly optimized functions can't take any advantage from HT because of sharing the same hardware resources.
Once the function ippSetAffinity sets affinity for a number of threads equal to number of OS processors [ICCC] on the machine, then each thread remains bound to the corresponding OS processor, unless reset via a subsequent call to ippSetAffinity.
This function use Intel OpenMP low-level affinity API, and it takes effect if OMP_AFFINITY environment variable is not set to disabled.
In accordance with the values of the parameter aType, the following thread affinity types are possible:
ippAffinityCompactFineCore - if HT is enabled, and OMP parallel regions don't use all available OpenMP threads, the adjacent threads use the shared cache on two cores and do not compete for resources on the same core leaving other core not used. This is equal to the following OpenMP settings: KMP_AFFINITY=granularity=fine,compact,1,offset [ICCC]. If HT is disabled, two adjacent threads are bound to cores with shared cache.
ippAffinityCompactFineHT - OpenMP thread <n>+1 is assigned to the free thread from the OS thread context closest to those OS thread context, where the OpenMP thread <n> is assigned. This is equal to the following OpenMP settings: KMP_AFFINITY=granularity=fine,compact,0,offset [ICCC].
ippAffinityAllEnabled - all OpenMP threads have access to all OS processors. This is equal to the following OpenMP settings: KMP_AFFINITY=respect [ICCC].
ippAffinityRestore - sets thread affinity, which is set before machine topology initialization.
ippTstAffinityCompactFineCore - test mode for the affinity type ippAffinityCompactFineCore.
ippTstAffinityCompactFineHT - test mode for the affinity type ippAffinityCompactFineHT
ippStsNoErr |
Indicates that OPenMP thread affinity is set. |
ippStsLLADisable |
Indicates a warning that the OpenMP Low Level Affinity is disabled. |
ippStsNotSupportedCpu |
Indicates a warning that the processor is not supported, or the operating system does not support thread affinity. |
Optimization Notice |
---|
Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice. Notice revision #20110804 |
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.