NAME
nproc
—
get processor count
SYNOPSIS
nproc |
[-a ] [-i
IGN] |
DESCRIPTION
Writes the number of available CPUs, followed by a newline, to the standard output stream. This can be modeled as max(cpus - IGN, 1).
OPTIONS
-a
,--all
- Writes the number of configured CPUs, which may be more than the available
ones if non-default CPU affinity is configured. This corresponds to the
_SC_NPROCESSORS_CONF
sysconf(3) value. -i
,--ignore
=IGN- Ignore (subtract) up to this many CPUs, if available (default 0).
ENVIRONMENT
Without -a
:
OMP_NUM_THREADS
- Overrides the CPU count. Must be ≥1; ignored if invalid.
OMP_THREAD_LIMIT
- Limits the CPU count to no more than the value. Must be ≥1; ignored if invalid.
SEE ALSO
cpuset(1), taskset(1), cpuset_getaffinity(2), pthread_getaffinity_np(3), sysconf(3)
STANDARDS
Compatible with the GNU system. The short flags are an extension.