Re: [PATCH] core-count: A new program to count the number of cpu cores (original) (raw)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
From: | Bruno Haible |
---|---|
Subject: | Re: [PATCH] core-count: A new program to count the number of cpu cores |
Date: | Sun, 25 Oct 2009 22:41:00 +0100 |
User-agent: | KMail/1.9.9 |
Giuseppe Scrivano wrote:
I went for `core-count'. This is the first version of the new program, it is a simple wrapper around the gnulib nproc module
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?
If it is meant to be a hardware inspection tool, then it should IMO try to reflect current multiprocessing hardware architectures. I mean the fact that a computer's central unit can have several thread execution units, combined at three different levels:
- Several CPU modules in a single computer,
- Several CPU chips in a single package (multi-chip module [2]),
- Several execution cores on a single chip (multi-core [3]),
- Several thread execution units per CPU core (hyper-threading [4]). See the first paragraph of [1].
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
- 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].
- 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] An implementation that considers 1) and 2) can be found in OpenMP. So, why not simply use the function omp_set_num_threads() that is provided by GCC in its libgomp library (in a compiler agnostic way through the AC_OPENMP macro of Autoconf)?
Bruno
[1] http://en.wikipedia.org/wiki/Multiprocessing [2] http://en.wikipedia.org/wiki/Multi-chip_module [3] http://en.wikipedia.org/wiki/Multi-core_(computing) [4] http://en.wikipedia.org/wiki/Hyper-threading [5] http://www.kernel.org/doc/man-pages/online/pages/man3/pthread_setaffinity_np.3.html [6] http://www.daemon-systems.org/man/pthread_getaffinity_np.3.html [7] http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?cmd=getdoc&coll=0650&db=man&fname=2%20sysmp [8] http://gcc.gnu.org/onlinedocs/libgomp/OMP_005fNUM_005fTHREADS.html
- Re: [PATCH] md5: accepts a new --threads option, (continued)
* Re: [PATCH] md5: accepts a new --threads option, Jim Meyering, 2009/10/18
* Re: [PATCH] md5: accepts a new --threads option, Giuseppe Scrivano, 2009/10/18
* Re: [PATCH] md5: accepts a new --threads option, Jim Meyering, 2009/10/18
* Re: [PATCH] md5: accepts a new --threads option, Giuseppe Scrivano, 2009/10/18
* Re: [PATCH] md5: accepts a new --threads option, Jim Meyering, 2009/10/18
* 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 <=
* Re: [PATCH] core-count: A new program to count the number of cpu cores, Giuseppe Scrivano, 2009/10/25
* 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
- Prev by Date:Re: [PATCH] core-count: A new program to count the number of cpu cores (was: [PATCH] md5: accepts a new --threads option)
- Next by Date:Re: [PATCH] core-count: A new program to count the number of cpu cores
- Previous by thread:Re: [PATCH] core-count: A new program to count the number of cpu cores (was: [PATCH] md5: accepts a new --threads option)
- Next by thread:Re: [PATCH] core-count: A new program to count the number of cpu cores
- Index(es):