We are using some systems with 2cpu's with 6 cores/12 threads each so 24 threads in total, for quite a lot of multitread simulations. Because the problem doesnt scale perfectly, i usualy run 4 problems in parralel, of 5 threads each. to have 4 cores left to run the 4 threads, that are starting the the simulations and pre- and postprocessing. I noticed some strange performance differences for identical simulations.
My idea was that by using affinity i could maybe regulate the performance a bit more, guiding the process not to be split over 2 cpu's, so that the problem doesnt get spread over different parts of the cache and memory, but remains fixed to a single cpu, or set of cores on the cpu.
I know how to set the affinity in the task manager, once the process is running, but i like to set it in a batch file.
for example:
start /affinity HEXNUM myprog3.exe
where HEXNUM is for example: 1F000 (the hex representation of 011111000000000000
if the aim was to run it on core:0,1,2,3,4 of cpu2
or HEXNUM 1F the hex represenation of 011111 if the aim is to run it on core 0,1,2,3,4 of cpu1.
But some how it does not seem to work, how i expect: when i start a simulation on 5 threads whithout affinity specification, the process takes 20-21% of cpu. when i start 5 treads, with affinity to 6 cores's it works also, but when i start 5 treads with affinity to 5 cores. it only takes 13% and if i look in the task manager, (windows 7 64 pro) it looks like it is only using core 1,3,5.
is there some problem using a uneven number of cores for the affinity specification? or am i doing something in the wrong way?
Are there any people that have experience using affinity specification, that managed to get some performance gains? What strategies did you use?