[cmake-developers] Fixing ProcessorCount.cmake

Eric Noulard eric.noulard at gmail.com
Mon Nov 8 13:43:35 EST 2010


2010/11/8 David Cole <david.cole at kitware.com>:
> FYI:
> The output that you see, both directly from ProcessorCount.cmake, and
> indirectly from the tools that it calls to try to determine the processor
> count, will be eliminated shortly (over the next few days)... but for now...
> it is being left in for "dashboard diagnostics" so that I can see what is
> happening on machines that I do not have direct access to.
> Also, if anybody has good suggestions for how to grab this information on
> the following platforms, please do let me know (a patch or even just
> pointers to relevant info in platform documentation):
> - AIX
> - FreeBSD / OpenBSD
> - HP
> - IRIX
> - Sun

If Sun==Solaris then
$ psrinfo -p
should give you the number of physical processor and
$ uname -X | grep NumCPU
the total number of core
see http://www.sunsolarisadmin.com/general/psrinfo-find-number-of-physical-virtual-processors-in-solaris-10/

On IRIX;
$ hinv | grep -i processor
see: http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=hdwr&db=bks&fname=/SGI_EndUser/Octane2_Dual_Head_IG/apa.html

On HP-UX:
$ machinfo | grep -i CPUs | awk '{print $5}'
see : http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=109447626+1289241355098+28353475&threadId=1287278

On FreeBSD:
$ sysctl hw.ncpu

If you want wider support for several platforms there is hwloc:
http://www.open-mpi.org/projects/hwloc/
which does a pretty good job.

hwloc-info --merge
+
some grep and arithmetic should do the job.

but I'm afraid hwloc is not of widespread use unless for platform where
OpenMPI is used.

If using hwloc is not an option then have a look to
"hwloc_fallback_nbprocessors" inside
hwloc/src/topology.c
you'll find some methods used to find the number of CPUs.


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org



More information about the cmake-developers mailing list