CPU Detection#

sage.parallel.ncpus.ncpus()[source]#

Return the number of available CPUs in the system.

ALGORITHM: os.sched_getaffinity() or os.cpu_count()

EXAMPLES:

sage: sage.parallel.ncpus.ncpus()  # random output -- depends on machine
2
>>> from sage.all import *
>>> sage.parallel.ncpus.ncpus()  # random output -- depends on machine
2