for i in `seq 1 8` ; do
(./runProgram &)
done
Dear Fellows, I know how to create parallel processes by creating 8 independent processes, the next thing I am in search for is how to
i-Run 8 copies concurrently with processor pinning (each copy on is own processor core)
ii-Run 16 copies concurrently with processor pinning (2 copies per core)
iii-Run 8 copies concurrently with processor pinning as per “iii” and flipping processor core to the furthest core after a particular function call in the code.
Current configuration of my cpu is 8 cores.it is running Fedora OS. I dont know the process ids in advance.
please suggest.
Thanks in advance.
The easiest way to achieve i and ii is to use the taskset
command:
Case i:
for i in `seq 0 7`; do
taskset -c $i ./runProgram &
done
Case ii:
for i in `seq 0 7`; do
taskset -c $i ./runProgram &
taskset -c $i ./runProgram &
done
Case iii: See the manual pages for sched_getaffinity(2)
and sched_setaffinity(2)
on how to change the pinning in code.