Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29262 Discussions

OpenMP thread number AND MKL thread number

britz0907
Beginner
497 Views

Hello.

I've run openmp code using 8 cores, and I've compiled with -mkl tag.

My openmp code calculates simultaneously each job.(calculation of each thread contain MKL function - dgemm)

Then, I wonder how MKL thread is generated for openmp job.

For example, I use 8 omp_threads for 8 cores(8 calculation run simultaneously, and 8 MKL function run simultaneously)

  => How MKL thread number is generated?(I know that MKL is based on OpenMP threads.)

Only one mkl thread per each one omp thread? 

(I've checked this using VTUNE, and it's look like mkl is generated only thread each openmp thread in this case.)

0 Kudos
3 Replies
TimP
Honored Contributor III
497 Views

If you call MKL from an OpenMP parallel region, but don't set OMP_NESTED, the MKL functions will not generate additional threads.  You could have used the -mkl sequential link option.

0 Kudos
britz0907
Beginner
497 Views

Thank Tim

I've compiled only using -mkl(using parallel studio 2013), and I didn't use OMP_NESTED keyword in my codes.

You mean that my case 

-mkl is equal to mkl=sequential  ??

0 Kudos
TimP
Honored Contributor III
497 Views

No, -mkl defaults to threaded.  If you want sequential, you must specify it. 

As I said, the OpenMP library itself should prevent threaded MKL from starting additional threads inside a parallel region unless OMP_NESTED is set.  So it should not make a great deal of difference.

0 Kudos
Reply