Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Multiprocess CPU count

The multiprocessing package makes it easy to run some function many times in parallel.

Running processes in parallel can reduce the overall runtime of the process. Generally one would think that the more we run in parallel the faster the whole process will end, but creating the parallel processes has some overhead and the number of CPUs the computer has also puts a limitation on the paralellizm that might be worth it.

import multiprocessing as mp
print(mp.cpu_count())