[Ecls-list] CPU count
Matthew Mondor
mm_lists at pulsar-zone.net
Fri Mar 22 17:03:51 UTC 2013
On Fri, 22 Mar 2013 12:52:19 -0400
Matthew Mondor <mm_lists at pulsar-zone.net> wrote:
> On Fri, 22 Mar 2013 11:46:16 +0530
> Vijay Mathew <vijay.the.lisper at gmail.com> wrote:
>
> > Is there a function in ECL to find the number of processors?
>
> Not that I know, although it's often a good idea to provide a
> configuration knob such that the user of the software can decide how
> many threads to use.
>
> If we want to add such functionality, it's OS-specific, but it seems
> that today several systems support sysconf(3) with _SC_NPROCESSORS_CONF
> and _SC_NPROCESSORS_ONLN (I just verified on NetBSD and Linux though).
I forgot to mention it, but another complexity is that thread to CPU
affinity configuration is also OS-specific. Several systems appear to
support pthread_setaffinity_np(3) but it's an unofficial extension
(hence the _np suffix). The interface to manipulate cpuset_t also
appears to vary (I have cpuset(3) on NetBSD and cpuset(7) on Linux, and
they differ).
--
Matt
More information about the ecl-devel
mailing list