Is it worth using a multi-threaded blas implementation along with multiprocessing in Python?

Suppose I have a 16-core machine and an awkwardly parallel program. I use a lot of numpy-dot products and adding numpy arrays, and if I hadn't used multiprocessing, it would not be easy: make sure numpy is built against the blas version that uses multithreading. However, I use multiprocessing, and all cores are constantly running. In this case, is there any benefit from using multi-threaded blases?

Most operations are (blas) type 1, some of them are type 2.

+5
source share
2 answers

You might need to be a little careful in assuming your code is actually being used by multithreaded BLAS calls. Relatively few numpy statements actually use basic BLAS, and relatively few BLAS calls are actually multi-threaded. numpy.dotuses BLAS dot, gemvor gemm, depending on the operation, but only gemmusually multithreaded of them , because rarely is there any performance advantage for O (N) and O (N ^ 2) BLAS causes this. If you limit yourself to BLAS level 1 and level 2 actions, I doubt that you are actually using multi-threaded BLAS calls, even if you are using a numpy implementation built using Mulithreaded BLAS like Atlas or MKL.

+6

, , , , , .

, , , .

+2

All Articles