SHTK_HW_CPUS(3) | Library Functions Manual | SHTK_HW_CPUS(3) |
shtk_hw_ncpus
—
Queries the number of CPUs (threads) in the
machine
shtk_import hw
shtk_hw_ncpus |
The shtk_hw_ncpus
function queries the
number of CPU threads in the machine and prints the total number to
stdout.
If the query fails, or if the function does not know how to get the number from the current operating system, prints 1.
shtk_hw_ncpus
returns 0.
make -j"$(shtk_hw_ncpus)" all
shtk_hw_ncpus
. Generally useful for testing
purposes, but can also be useful to inject greater numbers of parallelism
in applications that do not expose a mechanism to tune such number.shtk_hw_ncpus
first appeared in
shtk
1.7.
February 6, 2017 | Debian |