affinity in openmp??

affinity in openmp??

i am a newbie...

can anyone explain me in detail how to set kmp_affinity etc... i am not clear about it..

i just know that it is used to set affinity to threads - cores (processors).. but how to do it?? i dont know..!

i am having a desktop with windows XP SP3 installed on it, also visual studio 2008 and along with it openmp...

also is it possible to set affinity for threads through program at runtime..?? if so how??

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

would cause your Intel OpenMP application to attempt to pair up threads [0,1],[2,3],.... on shared cache. This would usually be a good strategy, provided that it is the only task running.
If you have a HyperThreading enabled, as on quad core I7, and wish to use 1 thread per core, try

The ,1 directs the affinity to use alternate logical processors.

The verbose option gives you all the information about topology discovery and the assignments you requested, including whether it is set to choose any logical processor in a specified group.
You can specifiy a full mapping with the proclist option, e.g.
SET KMP_AFFINITY="proclist=[0,2],explicit,verbose"
for 1 job, and proclist=[1,3] for another, if you wanted to run 2 2-thread jobs on a Q6600 with minimum interference. Note that Q6600 BIOS numbers cores in a checkerboard order; you can see this with verbose.

kmp_set_affinity() is available as a call to libiomp from the application. It takes similar strings to the environment variable strings. Evidently, you would include verbose at first to check it. It would not affect a current parallel region.

The documents on this subject which come with the compiler are important reading.

hi thanks for the help...

but it says :
error C2065: 'KMP_AFFINITY' : undeclared identifier

is there any prerequisite required before writing this statement in my program?? i mean any environment variable to be set explicitly?? if so can you please elaborate it.. please.. as i said i am a newbie so please explain in detail...

- Use Intel compiler- specify the -openmp ( in the case of Linux and Mac OS) or /Qopenmp ( for Windows) compiler option.or- expliciltly add IntelOpenMP* run-time library to your linking path ...perform on non-Intel microprocessors. The

KMP_AFFINITY is an environment variable. I set it in bash, but I assumed you would use SET.
kmp_set_affinity should be resolved in libiomp, if you make the function call. Try the environment variable first.

Leave a Comment

Please sign in to add a comment. Not a member? Join today