Skip to content Skip to sidebar Skip to footer

Numpy Dot Operation Is Not Using All Cpu Cores

I am doing numpy dot product on two matrices (Let us assume a and b are two matrices). When the shape of a is (10000, 10000) and shape of b is (1, 10000) then the numpy.dot(a, b.T

Solution 1:

Numpy dot operation is not using all cpu cores

numpy.show_config() is clearly showing that it is using OpenBLAS at underline level.

So OpenBLAS is the actual one that is responsible for parallel computation.

But in sgemm OpenBLAS won't parallelize the computation up to certain threshold (In your case the row size of b is 2 to 15).

As a workaround, you can change the threshold value (GEMM_MULTITHREAD_THRESHOLD) in sgemm file and compile the OpenBLAS with numpy

Change the GEMM_MULTITHREAD_THRESHOLD value from 4 to 0 to parallelize all the sgemm computations.

Post a Comment for "Numpy Dot Operation Is Not Using All Cpu Cores"