I am trying to:
-
Run 16 copies concurrently with processor pinning (2 copies per core)
-
Run 8 copies concurrently with processor pinning (2 copies per core) and flipping processor core to the furthest core after certain function say function 1 finishes.
The problem I am facing is how to select the farthest processor.
Some friends suggested to use sched_getaffinity and sched_setaffinity but I count not find any good examples.
To use sched_setaffinity to make the current process run on core 7 you do this:
See http://linux.die.net/man/2/sched_setaffinity & http://www.gnu.org/software/libc/manual/html_node/CPU-Affinity.html for more info.