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

我与影子孤独终老i 提交于 2020-08-11 03:00:09

问题


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? Or any other means to detect Intel MKL?


回答1:


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
)


来源:https://stackoverflow.com/questions/51481915/detecting-if-intel-mkl-is-enabled-in-visual-studio-projects-properties

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!