Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Compiling Application in Debug (/MTd) with MKL

Nathan_K_6
Beginner
1,072 Views

I am using MS Studio 2015 and incorporating the MKL (2017) library.  Everything compile fine when code generation is in release mode:

     Configuration Properties>C/C++>Code Generation>Runtime Library = /MT

However, it seems impossible to correctly build and link a debug version of the application.  Where the runtime is set to debug

    Configuration Properties>C/C++>Code Generation>Runtime Library = /MTd

This results in link errors related to debug symbols:

error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in ...
error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in ...

Other libraries (such as the TBB library) supply _debug versions of the library just for this reason. For example, the TBB has these libraries:tbb.lib and tbb_debug.lib.

I don't find and _debug versions of the MKL libraries.  Are they available or is there some other way to properly link an application in debug mode with the MKL.

 

 

 

0 Kudos
2 Replies
Zhen_Z_Intel
Employee
1,070 Views

Hi Nathan,

I used MKL2017 & ICC 2017 integrated in the VS2015. But I could not reproduce your problem even I changed runtime lib to MTd. I just wonder how you link and compile your MKL lib, did you also used other Intel library except MKL? Did you link libs manually or automatically?

For your problem, I searched that some one has similar problem but not using Intel MKL. It probably problem of VS. Normally, 2 is for debug & 0 for release. But for some version of VS, The default value of _ITERATOR_DEBUG_LEVEL might be different, depending on configuration. Did you also change the configuration to "Debug" when you set to use multi-thread debug runtime library? There's a method that you could set  _ITERATOR_DEBUG_LEVEL=2 in Configuration Properties / C,C++ / Preprocessor / Preprocessor Definitions. Please have a try with it.

Best regards,
Fiona

0 Kudos
Nathan_K_6
Beginner
1,070 Views

Thanks for the feedback...

Based on what you said I created a new basically empty solution and found that you are quite right.  The MKL compile and links with the application in both release and debug modes.

So I went back to the main application and I removed libraries one at a time to find what was conflicting with MKL in the debug link.   It turns out in my case it was the MS Parallel Patterns Library.  Since I have access to TBB as I switch to this library and the link errors were resolved.

 

0 Kudos
Reply