find_package(BLAS)
if(BLAS_FOUND)
message("Some BLAS found: linker flags ${BLAS_LINKER_FLAGS}, libs ${BLAS_LIBRARIES}, libs95 ${BLAS95_LIBRARIES}")
foreach(lib ${BLAS_LIBRARIES})
if(${lib} MATCHES "mkl")
message("Some BLAS found matches MKL")
add_definitions(-DBLAS_DOT_RETURNS_VOID)
# in some systems with MKL, regular BLAS headers need to be found for it to work
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib64")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib64")
endif()
if(${lib} MATCHES "hpc_sdk")
message("Some BLAS found matches hpc_sdk (nvhpc)")
add_definitions(-DBLAS_DOT_RETURNS_VOID)
endif()
... do this for Apple Accelerate, ATLAS, etc
endforeach()
endif()
2条答案
按热度按时间bxgwgixi1#
CMake 2.8+随附FindBLAS.cmake FindLAPACK. cmake。您可能想要检阅本机cmake安装档案中的注解:cmake-2.8.5/share/cmake/Modules/FindBLAS. cmake。此模块支援各种BLAS和LAPACK实作。例如:
字符串
祝你好运
7ivaypg92#
(this是CMake 3.x时代的答案)
我曾经做过一个类似于另一个答案的复杂工作流程,其中我尝试使用不同的显式供应商来检测BLAS发行版。
这样做的问题是,你必须尝试许多可能性,逻辑变得复杂。如果从命令行进行选择,你也会覆盖供应商的选择。
所以,我现在要做的是检查输出变量并设置变量或采取任何特定的操作:
字符串