PDA

View Full Version : Bug in cpu detection


mbouchar
06-10-2008, 10:13 AM
PTS 1.0.0 incorrectly reports the number of available cpus on one of my test machines. What is strange is that the number of cores is ok.

I get:
Processor: 5 x Quad-Core AMD Opteron 8356 @ 2.30GHz (Total Cores: 16)
While I should have:
Processor: 4 x Quad-Core AMD Opteron 8356 @ 2.30GHz (Total Cores: 16)

It looks like PTS is using more than one method for cpu detection and that one of them reports bad data.

Michael
06-10-2008, 11:15 AM
All the CPU detection is done through /proc/cpuinfo. Can you post the full output of cat /proc/cpuinfo ?

mbouchar
06-10-2008, 01:56 PM
Here is a link to my cpuinfo

cpuinfo.txt (http://rad.bioinfo.ulaval.ca/Members/mbouchar/.personal/cpuinfo.txt/at_download/file)

It seems that the physical ids are starting from 1 instead of 0. The PTS code in pts-core/functions/pts-functions_system_cpu.php -> processor_string is taking the last physical id + 1.

I don't know if this kind of setup happens a lot of times, but a fix would be to count the number of unique physical ids. It is probably the safest method.

Michael
06-10-2008, 03:00 PM
I thought that might have been what the problem was. Check out git to see if it's fixed, or just try:

$physical_cpu_count = count(array_unique($physical_cpu_ids));

mbouchar
06-10-2008, 03:10 PM
it's fixed! :)