Threaded nad non-threaded MKL functions in same application

Threaded nad non-threaded MKL functions in same application

Hi,

for my application I use a self compiled library. Both (library and application) use MKL functions. Is it possible that the library uses only non-threaded functions and the application only threaded functions? I'd like to avoid to set the number of the threads by hand in the code.

The linking modell is dynamic and everything runs under Win7 x64.

Thank you and best regards,
TJ

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi TJ,

Could you tell which functions are you using in library, which in application.If you don't change the function name in self library or don't import functions manually, it is hard for an exe to discern which mkl function should be from the mkl library linked in your application, which mkl functions should be from your self compiled library.

One quick idea, you may create two self compiled library. one use nno-threaded funtions and the others use threaded functions.Thus you can avoid to set the number of the threads by hand in the code.

Create self custom dll, please refer to mkl user guide.

And MKL threaded functions list:http://software.intel.com/en-us/articles/intel-mkl-threaded-functions/

Best Regards,
Ying

Hi Ying,

thank you for your reply. I want to use the single-threaded version of the BLAS and LAPACK routines in the library. The library is linked to the application. In other parts of this application I want to use the multi-threaded version of the trust region solver.

I will try to handle the issue with a custom dll.

Best regards,
TJ

Hi,

You wrote:
"I'd like to avoid to set the number of the threads by hand in the code" but "want to use the single-threaded version ... and ... multi-threaded version of the trust region solver".

Could you please explain your problem. Why don't use threading control functions, like mkl_set_num_threads, mkl_domain_set_num_threads or corresponding OpenMP functions?
And after linking with threading MKL you may use 1 threadfor sequential computations if needed.

Thanks,
-- Victor

Hi Victor,

I was looking for a simple way to set "once and for all" the number of threads in the different parts of the program.omp_set_num_threads has to be set again at the start of each parallel section --> would bloat the code.

mkl_domain_set_num_threads is a good hint; thank you.

There really a lot of calls to the MKL functions that should be single-threaded. I am not aware of how much overhead is generated, when threading is manually controlled and the functions "have to check" each time, how many threads they may use.

Best regards, TJ

Leave a Comment

Please sign in to add a comment. Not a member? Join today