0

I am implementing a simple version for matrix per matrix multiplication and matrix per vector multiplication with openblas with dgemm and dgemv. I see that openblas is only running on one core.

I tried adding the -lpthread for compilation but that did not make it work.

The way I am calling dgemm and dgemv is simple:

cblas_dgemv(order, trans, m, n, alpha, a, lda, x, incx, beta, y, incy);
cblas_dgemm(M, N, K, alpha, A, 1, M, B, 1, K, beta, C, 1, M);

Has anyone successfully run openblas on multiple cores?

Zonta01
  • 1
  • 2

1 Answers1

0

have you tried setting the number of threads with environment variables?

export OMP_NUM_THREADS=4

if this does not work, you can set the number of threads openblas is using via the following function:

 void openblas_set_num_threads(int num_threads);

cf. https://github.com/xianyi/OpenBLAS#set-the-number-of-threads-on-runtime

stefan0xC
  • 337
  • 5
  • 11