Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6956 Discussions

Problem in using threaded BLAS kernels

jackyjngwn
Beginner
218 Views

Hi,

I am trying to use the parallel version of sgemm, but no matter how many threads I set to use, the program runs on one core only (on a 12-core westmere). Can anyone help me?

I am using Intel Compiler 11.1.073, and my makefile is:
icc -o blassgemm blassgemm.c -openmp -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_lapack -lmkl_core -liomp5 -lpthread

I set the number of threads using mkl_set_num_threads.

Thanks,
Jacky

0 Kudos
5 Replies
VipinKumar_E_Intel
218 Views
Can you also tell us what are the values for the thread control env variables like, MKL_SET_NUM_THREADS, MKL_DYNAMIC etc?
0 Kudos
jackyjngwn
Beginner
218 Views
I didn't set MKL_SET_NUM_THREADS. Instead, I set OMP_NUM_THREADS to 4 and in the program I used mkl_set_num_threads(4).

Do I still need to set MKL_SET_NUM_THREADS and MKL_DYNAMIC? Thanks.

0 Kudos
TimP
Honored Contributor III
218 Views
If you leave MKL_DYNAMIC unset, MKL will be limited to 1 thread per core, as this normally gives best performance. If your problem isn't large enough to use all cores, MKL would automatically choose a smaller number. When you call omp_set_num_threads or mkl_set_num_threads in your program, that over-rides the environment variable.
0 Kudos
Gennady_F_Intel
Moderator
218 Views
what is the task size are you trying to solve?
0 Kudos
jackyjngwn
Beginner
218 Views

That seems to solve my problem. Thanks a lot!

0 Kudos
Reply