[Top][All Lists]
[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: |
Giuseppe Scrivano |
Subject: |
Re: [PATCH] core-count: A new program to count the number of cpu cores |
Date: |
Mon, 26 Oct 2009 00:45:53 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
Bruno Haible <address@hidden> writes:
> This program (and the underlying gnulib 'nproc' module) is IMO too simplistic.
>
> First of all, is the program meant to be a hardware inspection tool (like
> "hwinfo --cpu")? Or is meant to be an auxiliary program for helping shell
> scripts that want to dispatch tasks onto a maximum number of processors?
No, it should not be a hardware inspection tool but a portable tool to
help shell scripts to have an idea of how many processes can be executed
at the same time. If we get too much into details then we loose
portability (at least at a cheap price).
> If it is meant as a tool for helping the parallelization of tasks at the
> shell script level, then it needs to take into account
> 1) the fact that the current process may be limited to a certain subset
> of the available CPUs. See the Linux/NetBSD function
> pthread_setaffinity_np [5][6] and the IRIX notion of a CPU that is
> available only to root processes [7].
Probably it is better to add an option, making a difference between the
number of "real" and "effective" cores. Where it is not possible to
know correctly the latter, they'll coincide.
> 2) the wish of users to not use all processors at once. Users may want to
> save 1 CPU for their GUI interactions. This can most comfortably be
> done through an environment variable, such as
> OMP_NUM_THREADS. [8]
What about leave to the user the decisione to use less threads/processes
than core-count reports?
For example, assuming that `sort' will soon get the --threads option and
an user decides to use all cores except one to sort a file, then it can
be done as:
sort --threads="$(($(core-count) - 1))" huge_file
Cheers,
Giuseppe
- Re: [PATCH] md5: accepts a new --threads option, (continued)
- Re: [PATCH] md5: accepts a new --threads option, Giuseppe Scrivano, 2009/10/25
- Re: [PATCH] md5: accepts a new --threads option, Jim Meyering, 2009/10/25
- Re: [PATCH] md5: accepts a new --threads option, Jim Meyering, 2009/10/25
- [PATCH] core-count: A new program to count the number of cpu cores (was: [PATCH] md5: accepts a new --threads option), Giuseppe Scrivano, 2009/10/25
- Re: [PATCH] core-count: A new program to count the number of cpu cores (was: [PATCH] md5: accepts a new --threads option), Pádraig Brady, 2009/10/25
- Re: [PATCH] core-count: A new program to count the number of cpu cores, Bruno Haible, 2009/10/25
- Re: [PATCH] core-count: A new program to count the number of cpu cores,
Giuseppe Scrivano <=
- Re: [PATCH] core-count: A new program to count the number of cpucores, Gilles Espinasse, 2009/10/26
- Re: [PATCH] core-count: A new program to count the number of cpucores, Pádraig Brady, 2009/10/26
- Re: [PATCH] core-count: A new program to count the number of cpucores, Paolo Bonzini, 2009/10/26
- Re: [PATCH] core-count: A new program to count the number of cpucores, Giuseppe Scrivano, 2009/10/26
- Re: [PATCH] core-count: A new program to count the number of cpucores, Bruno Haible, 2009/10/26
- Re: [PATCH] core-count: A new program to count the number of cpucores, Pádraig Brady, 2009/10/27
- Re: [PATCH] core-count: A new program to count the number of cpu cores, Bruno Haible, 2009/10/26
- Re: [PATCH] core-count: A new program to count the number of cpu cores, Giuseppe Scrivano, 2009/10/27
- Re: [PATCH] core-count: A new program to count the number of cpu cores, Paolo Bonzini, 2009/10/27
- Re: [PATCH] core-count: A new program to count the number of cpu cores, Pádraig Brady, 2009/10/27