bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] core-count: A new program to count the number of cpu cores


From: Bruno Haible
Subject: Re: [PATCH] core-count: A new program to count the number of cpu cores
Date: Thu, 5 Nov 2009 01:54:17 +0100
User-agent: KMail/1.9.9

Giuseppe Scrivano wrote:
> address@hidden --all
> address@hidden --all
> +Print the number of installed processors.
> +
> address@hidden --current
> address@hidden --current
> +Print the number of processors available to the current process.  It
> +may be less than the number of installed processors.
> +If this information is not accessible, then nproc returns the number of
> +installed processors.  By default --current is used.
> +
> address@hidden --overridable
> address@hidden --overridable
> +Print the environment variable @env{OMP_NUM_THREADS} value when it is
> +defined.  If @env{OMP_NUM_THREADS} is not defined then use
> address@hidden

Well, probably I didn't explain my intentions clearly. The intent of
having 3 possible behaviours of the gnulib num_processors function
was not that the nprocs commands would export these 3 behaviours to
the command line. Rather I expected that you would offer the --all
option and choose among --current and --overridable for the case when
no option is passed. The expectation was that your choice among
NPROC_CURRENT and NPROC_CURRENT_OVERRIDABLE depends on
  - the majority vote among coreutils developers (I proposed to
    follow OMP_NUM_THREADS but you may not all be convinced),
  - security considerations, for example when executing as root
    you may want to ignore the environment variable or use its
    value only if it is less than the number of installed processors,
    or similar considerations.

Library APIs often offer more variants and choice than is reasonable
at the command-line level :-)

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]