[cmake-developers] Fixing ProcessorCount.cmake

Bill Hoffman bill.hoffman at kitware.com
Mon Nov 8 15:46:21 EST 2010


On 11/8/2010 3:30 PM, Rolf Eike Beer wrote:
> Am Montag, 8. November 2010 schrieb Bill Hoffman:
>> On 11/8/2010 1:55 PM, Rolf Eike Beer wrote:
>>> Am Montag, 8. November 2010 schrieb David Cole:
>>>> Hi Rolf,
>>>>
>>>> Can you update to a CMake based on 'next' and try the commit I made this
>>>> morning on a QNX machine? (based on your patch, thank you for that...)
>>>
>>> Still needs some tweak, as the output is:
>>>
>>> getconf: Can't find _NPROCESSORS_ONLN
>>> ProcessorCount: using getconf '/usr/bin/getconf'
>>> ProcessorCount: using pidin '/bin/pidin'
>>> processor_count='1'
>>>
>>> Patch attached.
>>>
>>> Eike
>>
>> I wonder if we could create a test for this that called the
>> SystemInformation class and compared its results with this script.  I
>> bet it would fix bugs in both the script and SystemInformation.
>
> It would show up for sure places where at one place this is divided into
> physical and logical cores and just "cpus" on the other hand.
>
On my machine I get this:

    CMake.ProcessorCount

180: ProcessorCount: using environment variable
180: processor_count='4'

  kwsys.testSystemInformation

11: GetNumberOfLogicalCPU: 1
11: GetNumberOfPhysicalCPU: 4

So, if we had a test that just ran:
  kwsys.testSystemInformation

And pulled out the GetNumberOfPhysicalCPU value and did a compare, they 
"should" be consistent.  If they are not, then one of them will need 
fixing...

-Bill





More information about the cmake-developers mailing list