I have two dlls that link against the static mkl libraries. One of the dlls links against the sequential version and the other against the multi-threaded version. Those two dlls are then loaded in to the same process. Does anybody know whether this is safe to do please?
- Parallel Computing
>>To be honest, I do not understand why threaded and non-threaded versions of MKL are used at the same time. It looks like some legacy issue in your project.
There are perfectly good reasons to use both at the same time.
When an application has, at any point in time, large matrix(s) that can be processed by MKL and when there is no other threaded activity going on in the application, then you would want to use the multi-threaded version of MKL.
Conversely, when an application is multi-threaded and performing parallel activities in different sections of the code (iow not on same large matrix(s)), then the preferred route would be to have MKL use only the calling thread context as opposed to creating a new thread pool and oversubscribing.
You can also consider using mkl_set_dynamic(0) to inhibit nested parallelism, and/or use mkl_set_num_threads(n) with dynamic to control the degree of parallization (though I've read posts indicating issues with mkl_set_num_threads(n)).