Community
cancel
Showing results for 
Search instead for 
Did you mean: 
125 Views

Detecting if Intel MKL is enabled in Visual Studio project's properties

Hello all,

I am working on a project where Intel MKL is nice to have, but not available on all the targeted platforms, so I have to check for its presence to behave accordingly.

I have enabled the Intel Performance Libraries in my Visual Studio project's properties, as explained in Compiling and Linking Intel® Math Kernel Library with Microsoft* Visual C++* and in Intel® Math Kernel Library (Intel® MKL) 2018 Getting Started but I'm not getting any of the preprocessor definitions described in Using Predefined Preprocessor Symbols for Intel® MKL Version-Dependent Compilation, e.g. __INTEL_MKL__ is not defined.

Any ideas how I can have these defined? Or any other means to detect Intel MKL?

Please note that I don't use any intermediary build tool like Cmake.

Thanks in advance.
0 Kudos
2 Replies
125 Views

I found a way that is a good compromise yet not very elegant.

Apparently we can check values of Property Pages settings in Build Events. After discovering a macro named UseIntelMKL I decided to tie a config.h to the value of it accordingly, and use the preprocessor directives defined in this config.h instead.

Here is roughly the script that acts as Pre-build Event. I am basically defining __INTEL_MKL__myself in config-mkl.h.

if "$(UseIntelMKL)"=="Parallel" (
  xcopy /Y /I $(ProjectDir)config-mkl.h $(ProjectDir)config.h
) else (
  xcopy /Y /I $(ProjectDir)config-nomkl.h $(ProjectDir)config.h
)

I'd still appreciate if someone knows a more elegant way.

Jing_X_Intel
Employee
125 Views

Hi,

Thank you for this concern.

You will get those predefined environment variables if you have included "mkl.h" in the souce code.

Your config.h is a good try.

I'll escalate this request to our engineer team.

Thank you.

Reply