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.
6590 Discussions

how to limit the CPU utilization when MKL is running

Serjio
New Contributor I
558 Views

When I use MKL 2021.2.0 functions for calculating my Intel Core i7-9750H CPU is 100% loaded (all cores). What tools are there to manage CPU utilization?

 

 

0 Kudos
1 Solution
BrenoA
Novice
514 Views

Hello Serjio,

 

Additionally to what Shanmukh wrote, you could try specifying the number of OpenMP (or MKL) threads.

 

This can be done through environment variables or by using certain functions. This link to an Intel Developer Guide explains this. And this link shows more practical information.

 

Additional tips for setting the number of threads locally (you might not need the folder locations if you set the environment variables or use Visual Studio, but I have written them for reference):

`MKL_Set_Dynamic(int flat)` and `MKL_Set_Num_Threads(int nt)` can be found in mkl_service.h (in the folder .\IntelOneAPI\mkl\latest\include).

`omp_set_dynamic(int)`, `omp_set_num_threads(int)` and `kmp_set_warnings_off()` (you'll may eventually find out why this last one is useful hehehe) can be found in omp.h (in the folder .\IntelOneAPI\compiler\latest\windows\compiler\include).

 

Best regards,

Breno

View solution in original post

5 Replies
ShanmukhS_Intel
Moderator
530 Views

Hi,


Thanks for reaching out to us.


We suggest you to use latest version of oneMKL(2021.3) and check if the issue persists.


In addition, You can limit cpu utilization by running the code in sequential mode of oneMKL.


Below is the link for setting oneMKL in sequential mode.


https://software.intel.com/content/www/us/en/develop/articles/intel-math-kernel-library-intel-mkl-co...


Best Regards,

Shanmukh.SS


Kirill_V_Intel
Employee
516 Views

Hi!

Depending on what kind of functionality you're using form oneMKL, there are different tools.

 

For OpenMP:

See https://software.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/... with various service routines which can be used. E.g., you can limit all MKL calls to a fixed number of threads and then, by pinning threads to a subset of CPUs limit the CPU usage.

For TBB: refer to TBB documentation, there are things like tbb arenas and which can help set the max concurrency limit.

For MPI (used for cluster components): controls are on the side of the application calling MKL (# MPI processes + potentially if it is MPI/OpenMP, see the OpenMP part).

 

Best,
Kirill

 

BrenoA
Novice
515 Views

Hello Serjio,

 

Additionally to what Shanmukh wrote, you could try specifying the number of OpenMP (or MKL) threads.

 

This can be done through environment variables or by using certain functions. This link to an Intel Developer Guide explains this. And this link shows more practical information.

 

Additional tips for setting the number of threads locally (you might not need the folder locations if you set the environment variables or use Visual Studio, but I have written them for reference):

`MKL_Set_Dynamic(int flat)` and `MKL_Set_Num_Threads(int nt)` can be found in mkl_service.h (in the folder .\IntelOneAPI\mkl\latest\include).

`omp_set_dynamic(int)`, `omp_set_num_threads(int)` and `kmp_set_warnings_off()` (you'll may eventually find out why this last one is useful hehehe) can be found in omp.h (in the folder .\IntelOneAPI\compiler\latest\windows\compiler\include).

 

Best regards,

Breno

ShanmukhS_Intel
Moderator
471 Views

Hi,


Reminder:

Has the solution provided helped? Could you please confirm whether we could close this thread from our end.


Best Regards,

Shanmukh.SS


ShanmukhS_Intel
Moderator
435 Views

Hi,


Thanks for accepting the solution.

Please raise a new thread if you have any other question as this thread will no longer be monitored.


Best Regards,

Shanmukh.SS


Reply