Threaded nad non-threaded MKL functions in same application
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.
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.
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.
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.
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.