multiprocessing.cpu_count
Prev: multiprocessing.Condition | Up: multiprocessing | Next: multiprocessing.current_process
Rel: multiprocessing.active_children, multiprocessing.allow_connection_pickling, multiprocessing.Array, multiprocessing.AuthenticationError
Ref: docs.python.org — multiprocessing.cpu_count
Tags: #public #python3 #stdlib #multiprocessing
Import
import multiprocessing
from multiprocessing import cpu_count
Signature & Overview
multiprocessing.cpu_count()
Returns the number of CPUs in the system
Usage
import multiprocessing as mp
assert mp.cpu_count() >= 1
Gotchas
- Raises
NotImplementedErrorif unknown (unlikeos.cpu_count()which returnsNone).
REPL Inspect
from multiprocessing import cpu_count
help(cpu_count)
Linked from
Related notes
- tuts/python3/stdlib_module/multiprocessing/Condition Linked here; links to this page; shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing/current_process Linked here; links to this page; shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/multiprocessing/active_children Linked here; shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing/allow_connection_pickling Linked here; shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing/Array Linked here; shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing/AuthenticationError Linked here; shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing/Barrier shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing/BoundedSemaphore shared tags: #multiprocessing, #stdlib
- tuts/python3/stdlib_module/multiprocessing/BufferTooShort shared tags: #multiprocessing, #stdlib