- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have an application that currently uses MKL that I am making multicore ready with the addition of OpenMP. This application is built on Windows using the Microsoft VC++ compiler and on Linux using the GCC compiler. I have found some information on threading and MKL, but it is less than clear what the ramifications are and what the proper course of action should be.
I don't really need to have the MKL routines threaded. I do need to know what MKL routines are not thread safe so I can synchronize access to those. Does the non-threaded version of MLK work correctly with threaded applications that are not built with the Intel compiler? Incorrect answers or program failure is not an acceptable option.
From the MKL product page:
All Intel MKL functions are thread-safe. A non-threaded version of Intel MKL is also available
From the MKL issues page:
The Intel Math Kernel Library is designed and compiled for thread safety so it can be called from programs that are threaded. Calling Intel MKL routines that are threaded from multiple application threads can lead to conflict (including incorrect answers or program failures), if the calling library differs from the Intel MKL threading library.
From the MKL forum:
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, let's make sure that we use common terms. Thread-safety means that each instance thread has its own set of parameters which will not be affected by the operations of other threads. For instance, if you have a for loop over i, and you thread it, you want to make sure that each thread has its own copy of iand that each thread changes i only for itself.
But there is no assurance that when you run threaded you can expect the same answers as when you run sequentially. However, for a vector function such as vcExp there should be no threading dependencies since all of the computation of the complex exponential of the input will be completed on a single thread.
Can you provide an example of the code where you noticed this issue so we can try it out?
Thanks,
Bruce
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you are threading your application and using a compiler other than the Intel compiler at the current time you will want to use the sequential version of MKL. The downside to this is that if you call a threaded MKL function from a non-threaded section of you code, you will not see the parallel benefits of the threaded MKL code you would normally expect. On the other hand, if you call MKL for threaded regions, everything will work just fine. And you will not have issues that can arise from having two runtime libraries (compiler threading library and libguide) each supplying the OpenMP functions called from your program and MKL. Furthermore the number of threads created will not get out of hand since only one threading library is performing that task.
MKL 10.0 will have a solution to this issue that will allow you to thread your application using some non-Intel compilers and still use threaded MKL.
Bruce

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page