← Back to team overview

yade-dev team mailing list archive

cpu affinity problem

 

Hi there,

I just tried to find out what is not working at my machine in parallel mode (using yade -jN). First thing I recognized is different MHz for my CPUs are used:

me@debian ~/YADE/build >less /proc/cpuinfo | grep MHz
cpu MHz         : 3167.68
cpu MHz         : 2000.0
cpu MHz         : 2000.0
cpu MHz         : 2000.0
cpu MHz         : 2000.0
cpu MHz         : 2000.0
cpu MHz         : 2000.0
cpu MHz         : 2000.0

I disabled GV1/GV3 and C mode for CPU performance in BIOS:

(I skipped the part where I had to reinstall kde and graphic driver because PC was running for 276 days and there was a kernel update, which broke my graphics module, which leads to black screen when starting kdm, which .... whatever ... )

me@debian ~/YADE/build >less /proc/cpuinfo | grep MHz
cpu MHz         : 3158.704
cpu MHz         : 3158.704
cpu MHz         : 3158.704
cpu MHz         : 3158.704
cpu MHz         : 3158.704
cpu MHz         : 3158.704
cpu MHz         : 3158.704
cpu MHz         : 3158.704

But still the same problem occurs (for new and old versions of yade). So I googled that and it seems to be a problem with cpu affinity.

When I run yade -j4 --performance I see 4 PIDs (threads) running at 1 and the same core the whole time (e.g. PID = {11962,11963,11964,11965} in htop).

Then I tried this ...

me@debian ~/YADE/trunk >taskset -c -p 0 11962
pid 11962's current affinity list: 0
pid 11962's new affinity list: 0
me@debian ~/YADE/trunk >taskset -c -p 1 11963
pid 11963's current affinity list: 0
pid 11963's new affinity list: 1
me@debian ~/YADE/trunk >taskset -c -p 2 11964
pid 11964's current affinity list: 0
pid 11964's new affinity list: 2
me@debian ~/YADE/trunk >taskset -c -p 3 11965
pid 11965's current affinity list: 0
pid 11965's new affinity list: 3

and viola, it is working as expected (at least until one run with X balls is finished, after that PID is changing again and all new PIDs switched back on CPU 0).

So my question is:

How can I set cpu affinity? Do you know a fast-and-dirty way to get rid of this?

Thanks in advance,

cheesed off Christian



Follow ups