[torquedev] processor affinity

Menshutin Anton may at chg.ru
Sat Jun 2 07:02:12 MDT 2007

Hi list,

I found that there is no processor affinity in torque. Jobs assigned to run
on some cpu's selected by scheduler, could also run on other cpus on this
node. This means that if user lunches more processes or threads on a node
than he has requested, his processes will span over other cpus according to
the operating system scheduling policy. Thus he can get more cpu resources
than he should. Its clear that this is undesired behavior.
Nevertheless, starting from linux kernel 2.6 there is a system call
sched_setaffinity() which enables programmer to tell OS scheduler not to use
some cpus. So this is thing one have to add to torque. 

This property is inherited by child process. It is obvious that setting it
after fork() and before exec() will be enough. The only thing I don't know -
where can I get info about cpus assigned to me by scheduler. 
Qstat shows this info in exec_host attribute, and I suppose I can get this
string, parse it, find out localhostname and get CPUs numbers. But may be
there is a better way for getting this info? 

I'm asking for help from torque-dev mailing list :) Given an advice, I could
try to implement and test it myself or may be anybody could send me a patch?


More information about the torquedev mailing list