bug-coreutils
[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: Pádraig Brady
Subject: Re: [PATCH] core-count: A new program to count the number of cpu cores
Date: Wed, 04 Nov 2009 23:19:49 +0000
User-agent: Thunderbird 2.0.0.6 (X11/20071008)

Giuseppe Scrivano wrote:
> Subject: [PATCH] nproc: A new program to count the number of processors

s/number of/available/

> 
> * AUTHORS: Add my name.
> * NEWS: Mention it.
> * README: Likewise.
> * bootstrap.conf (gnulib_modules): Add nproc.
> * doc/coreutils.texi (nproc invocation): Add nproc info.
> * po/POTFILES.in: Add src/nproc.c.
> * src/Makefile.am (EXTRA_PROGRAMS): Add nproc.
> * src/nproc.c: New file.

* man/.gitignore: Exclude nproc.1
* src/.gitignore: Exclude nproc

> address@hidden nproc invocation
> address@hidden @command{nproc}: Print the number of processors

s/processors/available processors/

> +
> address@hidden nproc
> address@hidden Print the number of processors
> address@hidden system information, printing
> +

> address@hidden prints the number of processors.  It is not a hardware
> +inspection tool but a portable way to get how many processes
> +potentially can be executed in parallel.  The result is guaranteed  to
> +be a positive number greater than zero.  Synopsis:

@command{nproc} prints the number of processing units available
to the current process.  The result is guaranteed to be greater than zero.


> address@hidden --all
> address@hidden --all
> +Print the number of installed processors.

Print the number of installed processors on the system which may
be greater than is available to the current process.



I'm always wary about adding options.
How about we drop the following 2 options and just do
NPROC_CURRENT_OVERRIDABLE by default. We can document
here that we honor OMP_NUM_THREADS and in the unlikely
event it is set and we want to ignore it, one can always
do `OMP_NUM_THREADS= nproc`.

> 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



The other option we discussed that might be good to add
just because it would be required often and is awkward
to do in shell is --ignore (I'm not sure about the name).

@item address@hidden
@opindex --overridable
The number of processing units to disregard if possible.

thanks!
Pádraig.




reply via email to

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