parallel: No need to 'cat /proc/cpuinfo' when you can just open.

This commit is contained in:
Ole Tange 2014-05-23 19:57:04 +02:00
parent c105e6ee1a
commit 1f43b57e64
2 changed files with 13 additions and 29 deletions

View file

@ -14,6 +14,7 @@ Modified => alpha
configure.ac: AC_INIT([parallel], [20100422], [bug-parallel@gnu.org]) configure.ac: AC_INIT([parallel], [20100422], [bug-parallel@gnu.org])
src/parallel: $Global::version = 20100422; src/parallel: $Global::version = 20100422;
README: parallel-20130222 README: parallel-20130222
YYYYMMDD=`yyyymmdd` YYYYMMDD=`yyyymmdd`
perl -i -pe "s/20\d\d\d\d\d\d/$YYYYMMDD/" configure.ac perl -i -pe "s/20\d\d\d\d\d\d/$YYYYMMDD/" configure.ac
perl -i -pe "/version/ and s/20\d\d\d\d\d\d/$YYYYMMDD/" src/parallel perl -i -pe "/version/ and s/20\d\d\d\d\d\d/$YYYYMMDD/" src/parallel
@ -214,43 +215,26 @@ cc:Tim Cuthbertson <tim3d.junk@gmail.com>,
Ryoichiro Suzuki <ryoichiro.suzuki@gmail.com>, Ryoichiro Suzuki <ryoichiro.suzuki@gmail.com>,
Jesse Alama <jesse.alama@gmail.com> Jesse Alama <jesse.alama@gmail.com>
Subject: GNU Parallel 20140522 ('Boko Haram') released Subject: GNU Parallel 20140622 ('Nej') released
GNU Parallel 20140522 ('Boko Haram') has been released. It is available for download at: http://ftp.gnu.org/gnu/parallel/ GNU Parallel 20140622 ('Nej') has been released. It is available for download at: http://ftp.gnu.org/gnu/parallel/
Haiku of the month:
goodbye to xargs
quoting is still a black art
welcome parallel
-- Malcolm Cook
New in this release: New in this release:
* Use --semaphoretimeout to ignore the semaphore lock after a while. * Speeding up grep log queries with GNU Parallel http://www.tripwire.com/state-of-security/incident-detection/speeding-grep-queries-gnu-parallel/
* {%} introduced as job slot replacement string. It has known bugs.
* --slotreplace changes slot replacement string.
* GNU Parallel officially in Solaris 11.2beta https://blogs.oracle.com/alanc/entry/solaris_11_2_changes_to
* GNU Parallel was cited in: A Comparison of Antenna Placement Algorithms http://abhinavjauhri.com/publications/eap.pdf
* Using GNU Parallel on a PBS cluster (nice use of --shebang-wrap) https://docs.it4i.cz/anselm-cluster-documentation/resource-allocation-and-job-execution/capacity-computing
* BioLite uses GNU Parallel: https://bitbucket.org/caseywdunn/biolite
* Isitdown uses GNU Parallel: http://www.isi.edu/~calvin/isitdown.md
* Convert FLAC to MP3 with GNU parallel http://www.blogobramje.nl/posts/Convert_FLAC_to_MP3_with_GNU_parallel/
* JD Edwards Business Function Documentation http://www.azertech.net/content/jd-edwards-business-function-documentation
* Tools of the trade http://blog.eikeland.se/2014/05/01/tools-of-the-trade/
* How I start a bioinformatics project http://nickloman.github.io/2014/05/14/how-i-start-a-bioinformatics-project/
* No:The-Me GNU Parallel http://adityalaghate.in/gnu-parallel.html
* Bug fixes and man page updates. * Bug fixes and man page updates.
GNU Parallel - For people who live life in the parallel lane. GNU Parallel - For people who live life in the parallel lane.
= About GNU Parallel = = About GNU Parallel =
GNU Parallel is a shell tool for executing jobs in parallel using one or more computers. A job is can be a single command or a small script that has to be run for each of the lines in the input. The typical input is a list of files, a list of hosts, a list of users, a list of URLs, or a list of tables. A job can also be a command that reads from a pipe. GNU Parallel can then split the input and pipe it into commands in parallel. GNU Parallel is a shell tool for executing jobs in parallel using one or more computers. A job is can be a single command or a small script that has to be run for each of the lines in the input. The typical input is a list of files, a list of hosts, a list of users, a list of URLs, or a list of tables. A job can also be a command that reads from a pipe. GNU Parallel can then split the input and pipe it into commands in parallel.

View file

@ -3599,7 +3599,7 @@ sub no_of_cpus_gnu_linux {
$no_of_cpus = 0; $no_of_cpus = 0;
$no_of_cores = 0; $no_of_cores = 0;
my %seen; my %seen;
open(my $in_fh, "-|", "cat /proc/cpuinfo") || return undef; open(my $in_fh, "<", "/proc/cpuinfo") || return undef;
while(<$in_fh>) { while(<$in_fh>) {
if(/^physical id.*[:](.*)/ and not $seen{$1}++) { if(/^physical id.*[:](.*)/ and not $seen{$1}++) {
$no_of_cpus++; $no_of_cpus++;
@ -3618,7 +3618,7 @@ sub no_of_cores_gnu_linux {
my $no_of_cores; my $no_of_cores;
if(-e "/proc/cpuinfo") { if(-e "/proc/cpuinfo") {
$no_of_cores = 0; $no_of_cores = 0;
open(my $in_fh, "-|", "cat /proc/cpuinfo") || return undef; open(my $in_fh, "<", "/proc/cpuinfo") || return undef;
while(<$in_fh>) { while(<$in_fh>) {
/^processor.*[:]/i and $no_of_cores++; /^processor.*[:]/i and $no_of_cores++;
} }