Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

How to set thread affinity when using IPP library

yangzhang
Beginner
748 Views

System detail:

Computer we are using is an Intel i7-2600. It is 4 core CPU with hyper thread which give 8 virtual cores. OS is Windows 7.

Issue:

We have an image processing process, We like to run it in upper 6 cores and leave lower 2 cores for device control. I use setAffinity to set image processing process to upper 6 cores. To test the affinity, I use Windows task manager to monitor which core is used. It works as I expected that 6 cores busy when I use C++ code in my algorithm. However when I opptimize my code to use IPP library, it start to use all 8 cores; and ignore my Cpu affinity setting. Is there any way I can set CPU affinity to IPP library? Any help is appreciated.

I have test ippSetAffinity. It does not make difference.

Yang

Abbott Point of Care

0 Kudos
2 Replies
Chao_Y_Intel
Moderator
748 Views


Yang,

The Intel IPP functions are threaded with OpenMP. The affinity setting in the IPP will also impact the IPP. Please check if the following environment setting could work for you:
KMP_AFFINITY=explicit,proclist=[1-6:1],granularity=fine

You can check the following article regarding the these setting
http://software.intel.com/sites/products/documentation/hpc/composerxe/en-us/2011Update/fortran/lin/optaps/common/optaps_openmp_thread_affinity.htm

Thanks,
Chao

0 Kudos
SergeyKostrov
Valued Contributor II
748 Views
>>...However when I opptimize my code to use IPP library, it start to use all 8 cores; and ignore my Cpu affinity setting... This is expected result because OpenMP based processing in IPP library ( for some functions ) takes control of the thread management. However, if you get a list of all threads in the application using Win32 API you could set your own affinities for these threads. There is an example in MSDN on how to do this.
0 Kudos
Reply