[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#42044: nproc says "1" on mobile processors
From: |
Adam Borowski |
Subject: |
bug#42044: nproc says "1" on mobile processors |
Date: |
Thu, 25 Jun 2020 19:37:39 +0200 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
Hi!
I'm afraid that `nproc` shows only the number of _currently_ online CPUs,
which on mobile processors tends to be 1 when starting a job. As there's
a need to conserve power, holding cores online when they have nothing to
do would be a waste, thus they constantly get onlined and offlined.
For example, on a 10-core box where the processor consists of three
clusters, 4+4+2 cores, topline graph shows:
(oooo▁▁▁ oo)
(oooo▁ ▁ oo)
(▃ooooooooo)
(oooo▁▁▁▁oo)
(▂ooooooooo)
(oooo▁▁▁ oo)
(oooo▁ ▁ oo)
(oooo▁▁ oo)
(oooo▁ ▁oo)
(oooo▁▁ oo)
(oooo▁ oo)
(1 line = 1 second, "o" means offline core, otherwise it's utilization
level.)
Because of noisy GUI (that eg. draws this very graph), the machine keeps
flipping between onlining just CPU 0, or a cluster of CPU4..7. Thus,
`nproc` will randomly says either "1" or "4", while the user expects to
run her compile with all 10 cores.
I found out that numa_num_task_cpus() from libnuma gets the right answer,
handling both affinity mask and CPUs present-but-currently-offline. But
alas, it doesn't provide a command-line tool, and thousands of scripts
already use nproc, thus switching a tool would be a waste of effort.
Ie, could you please make nproc include all available CPUs rather than
only online ones?
Meow!
--
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ in the beginning was the boot and root floppies and they were good.
⢿⡄⠘⠷⠚⠋⠀ -- <willmore> on #linux-sunxi
⠈⠳⣄⠀⠀⠀⠀
- bug#42044: nproc says "1" on mobile processors,
Adam Borowski <=