Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
6591 Discussions

Problem in using threaded BLAS kernels

jackyjngwn
Beginner
119 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
119 Views
Can you also tell us what are the values for the thread control env variables like, MKL_SET_NUM_THREADS, MKL_DYNAMIC etc?
jackyjngwn
Beginner
119 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.

TimP
Black Belt
119 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.
Gennady_F_Intel
Moderator
119 Views
what is the task size are you trying to solve?
jackyjngwn
Beginner
119 Views

That seems to solve my problem. Thanks a lot!

Reply