bug-parallel
[Top][All Lists]
Advanced

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

GNU Parallel Bug Reports Auto-detection of available CPU cores


From: Johannes Dröge
Subject: GNU Parallel Bug Reports Auto-detection of available CPU cores
Date: Mon, 23 Feb 2015 16:58:22 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

Hi Ole and GNU parallel devs,

I found another issue with the CPU detection on recent Linux:
The number of jobs should be set to the number of _usable_ cores, which does 
not seem to be detected correctly on recent Linux systems. For instance, try 
the following:

while true; do echo; done | taskset -c 1 parallel 'cat /dev/zero > /dev/null'&

Then do

pgrep cat | wc -l

There will be many jobs spawned. However, they will all be run on a single core 
(visible using e.g. top) because Linux cpusets/taskset pins processes to 
physical cores.
Here is a command line which is not really nice but works for the detection of 
allowed CPU cores:

grep -m 1 '^Cpus_allowed:' /proc/self/status | cut -f 2 | tr -d ',' | tr 
'[:lower:]' '[:upper:]' | xargs echo "obase=2; ibase=16;" | bc | tr -d -c '1' | 
wc -c

Info: I'm using the latest version of GNU parallel (20150122) on 64 bit Linux, 
Debian 7.

Gruß Johannes

-- 
Johannes Dröge, M.Sc.
Algorithmic Bioinformatics, Heinrich Heine University Düsseldorf
25.12.01.50, Universitätsstraße 1, 40225 Düsseldorf, Germany
PGP: http://keys.fungs.de/6ea5e4.asc (55F2720303A7F236A94666F20E2360727A6EA5E4)
Web: algbio.cs.uni-duesseldorf.de | Tel/Fax: +49 211 81-12644/13464



Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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