Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

Using threading in MKL

Heo__Jun-Yeong
Beginner
233 Views

Hello, 

I'm frequently using lots of routines in MKL

But, I'm always confused that the MKL routines automatically using multiple threads

when I do not set specific number of threads using 'MKL_SET_NUM_THREADS' 

There are lots of routines, BLAS, LAPACK, PARDISO, etc...

I think PARDISO automatically using multiple threads, but I can't sure about the rest of the routines

 

Or is it different when the version of MKL changes...?

Or the compiler options affect the routines...?

(I always link the mkl with below , i.e. for static)

MKLSTATIC = -Wl,--start-group $(MKLPATH)/libmkl_intel_lp64.a \
$(MKLPATH)/libmkl_intel_thread.a $(MKLPATH)/libmkl_core.a \
-Wl,--end-group -openmp -lpthread

 

Help would be greatly appreciated.

 

 

0 Kudos
3 Replies
jimdempseyatthecove
Black Belt
219 Views

MKL has two libraries from which you can select.

(the following is not a grammatical error)

 

MKL single-threaded: which you link with a multi-threaded application (or single threaded when MKL internal parallelization is not desired)

MKL multi-threaded: which you typically link into a single-threaded application and when MKL internal parallelization is desired)

With careful programming, you can use a multi-threaded application together with multi-threaded MKL.. HOWEVER it is the programmer's responsibility to avoid over-subscription of available hardware threads.

Jim Dempsey

JohnNichols
Valued Contributor II
210 Views

Jim:

Minor point on grammar, traditionally I think there should be a comma after However, 

JMN

jimdempseyatthecove
Black Belt
208 Views

And minor point on grammar, don't end a sentence with a comma.

Jim Dempsey

Reply