检测是否在 Visual Studio 项目的属性中启用了 Intel MKL
Detecting if Intel MKL is enabled in Visual Studio project's properties
我正在从事一个项目,其中英特尔 MKL 很不错,但并非在所有目标平台上都可用,因此我必须检查它是否存在以相应地运行。
我在 Visual Studio 项目的属性中启用了 Intel Performance Libraries
,如 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 中所述,例如__INTEL_MKL__
未定义。
有什么想法可以让我拥有这些吗?或者任何其他检测英特尔 MKL 的方法?
我找到了一个很好的折衷方法,但不是很优雅。
显然我们可以在 Build Events 中检查 属性 页面设置的值。在发现名为 UseIntelMKL
的宏后,我决定将 config.h
相应地绑定到它的值,并改用此 config.h
中定义的预处理器指令。
这里大致是充当Pre-build Event
的脚本。我基本上是在 config-mkl.h
.
中自己定义 __INTEL_MKL__
if "$(UseIntelMKL)"=="Parallel" (
xcopy /Y /I $(ProjectDir)config-mkl.h $(ProjectDir)config.h
) else (
xcopy /Y /I $(ProjectDir)config-nomkl.h $(ProjectDir)config.h
)
我正在从事一个项目,其中英特尔 MKL 很不错,但并非在所有目标平台上都可用,因此我必须检查它是否存在以相应地运行。
我在 Visual Studio 项目的属性中启用了 Intel Performance Libraries
,如 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 中所述,例如__INTEL_MKL__
未定义。
有什么想法可以让我拥有这些吗?或者任何其他检测英特尔 MKL 的方法?
我找到了一个很好的折衷方法,但不是很优雅。
显然我们可以在 Build Events 中检查 属性 页面设置的值。在发现名为 UseIntelMKL
的宏后,我决定将 config.h
相应地绑定到它的值,并改用此 config.h
中定义的预处理器指令。
这里大致是充当Pre-build Event
的脚本。我基本上是在 config-mkl.h
.
__INTEL_MKL__
if "$(UseIntelMKL)"=="Parallel" (
xcopy /Y /I $(ProjectDir)config-mkl.h $(ProjectDir)config.h
) else (
xcopy /Y /I $(ProjectDir)config-nomkl.h $(ProjectDir)config.h
)