Community
cancel
Showing results for 
Search instead for 
Did you mean: 
YW
Beginner
116 Views

MKL routines within OMP parallel loop

Hi,

How many threads will an MKL routine (e.g. cblas_sgemm) launches when that routine is included within an OMP parallel loop? Is it the same in both Xeon and Xeon Phi?

Thanks!

0 Kudos
4 Replies
116 Views

Hi,

By default, only 1 thread will be created for MKL, if it's an openmp parallel region. If you want MKL to use multiple threads, you can set MKL_DYNAMIC=false.

--Vipin

YW
Beginner
116 Views

Vipin Kumar E K (Intel) wrote:

Hi,

By default, only 1 thread will be created for MKL, if it's an openmp parallel region. If you want MKL to use multiple threads, you can set MKL_DYNAMIC=false.

--Vipin

Thanks! It seems that the number of running threads is easy to go wild if MKL_NYNAMIC is set to be false, right? Is there a way to control the number of threads (>1 but smaller than a certain number) an MKL routines could launch?

116 Views

 Please refer https://software.intel.com/en-us/node/528380 for more details on various api functions and env. variables to set for calling MKL in a nested region.

--Vipin

 

116 Views

You can also control the threads by setting these. Assuming that the user openmp regions use 60 threads and 4 threads should run dgemm (any mkl function), set these variables at the run time.

#enable nested OpenMP
export OMP_NESTED=TRUE
export OMP_NUM_THREADS=60,4

#OpenMP 4 placement: 4 threads per core do dgemm
export OMP_PLACES=threads
export OMP_PROC_BIND=spread,close

#Enable HOT TEAMS: Intel compiler 15 update 1
export KMP_HOT_TEAMS_MAX_LEVEL=2
export KMP_HOT_TEAMS_MODE=1

 

Reply