检测是否在 Visual Studio 项目的属性中启用了英特尔 MKL [英] Detecting if Intel MKL is enabled in Visual Studio project's properties

查看:42
本文介绍了检测是否在 Visual Studio 项目的属性中启用了英特尔 MKL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开展一个项目,其中英特尔 MKL 很不错,但并非在所有目标平台上都可用,因此我必须检查其是否存在以相应地进行操作.

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.

我已在我的 Visual Studio 项目的属性中启用了 Intel Performance Libraries,如 使用 Microsoft* Visual C++* 编译和链接英特尔® Math Kernel Library 和在 英特尔® 数学内核库(英特尔® MKL)2018 入门 但我没有得到 使用预定义的预处理器符号进行英特尔® MKL 版本相关编译,例如__INTEL_MKL__ 未定义.

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.

有什么想法可以让我拥有这些吗?或者任何其他检测英特尔 MKL 的方法?

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

推荐答案

我找到了一种很好的折衷方案,但不是很优雅.

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

显然我们可以在构建事件中检查属性页设置的值.在发现一个名为 UseIntelMKL 的宏后,我决定将 config.h 相应地绑定到它的值,并使用此 config.h<中定义的预处理器指令/code> 代替.

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.

这里大致是充当预构建事件的脚本.我基本上是在 config-mkl.h 中自己定义 __INTEL_MKL__ .

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
)

这篇关于检测是否在 Visual Studio 项目的属性中启用了英特尔 MKL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆