Two notes. First, numpy
supports multithreading, and this can give you a speed boost in multicore environments! On Linux, I used top
to verify that my numpy
was indeed using multithreading, which it was. Second, multithreading can hurt performance when you’re running multiple Python / numpy
processes at once. I was running into this issue, and got significant boost by limiting the number of numpy
threads per process, in my case using import mkl; mkl.set_num_threads(1)
. The general performance rule of thumb is to aim for the total number of threads running to match the number of cores.