Determining number of cores on a system

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Determining number of cores on a system

James C. Sutherland
Is there a way in CMake to determine the number of shared-memory cores on a system?
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Determining number of cores on a system

Eric Noulard
2009/11/27 James C. Sutherland <[hidden email]>:
> Is there a way in CMake to determine the number of shared-memory cores on a system?

I don't know but I discover recently a tiny tool call hwloc
which may help for that:

http://www.open-mpi.org/projects/hwloc/

It is [unfortunately] using autotools :-) but claims [I did only test
it on Linux]
to be quite portable:

>>>>>>>>>>>>>>>>>
hwloc supports the following operating systems:

  * Linux (including old kernels not having sysfs topology information, with
 knowledge of cpusets, offline cpus, and Kerrighed support)
  * Solaris
  * AIX
  * Darwin
  * OSF/1 (aka. Tru64)
  * HP-UX
  * Windows
  * For other OSes, only the number of processors is available for now.
>>>>>>>>>>>>>>>>>

It may be used with CMake because:

1) there is a library/API
    http://www.open-mpi.org/projects/hwloc/doc/v0.9.2/#interface

2) The license is BSD-like
    http://www.open-mpi.org/projects/hwloc/license.php

However I don't if it worth a new feature in CMake?
execute_process(.. hwloc-ls...) + string(...)  may do the job.


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

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake