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 |
---|
The Intel® Integrated Performance Primitives (Intel® IPP) library contains functions that are more highly optimized for Intel microprocessors than for other microprocessors. While the functions in the Intel® IPP library offer optimizations for both Intel and Intel-compatible microprocessors, depending on your code and other factors, you will likely get extra performance on Intel microprocessors. While the paragraph above describes the basic optimization approach for the Intel® IPP library as a whole, the library may or may not be optimized to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include Intel® Streaming SIMD Extensions 2 (Intel® SSE2), Intel® Streaming SIMD Extensions 3 (Intel® SSE3), and Supplemental Streaming SIMD Extensions 3 (Intel® 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. Intel recommends that you evaluate other library products to determine which best meets your requirements. |
Copyright © 2000 - 2010, Intel Corporation. All rights reserved.