为了演示,我使用3行CMakeLists.txt:
cmake_minimum_required(VERSION 2.8)
find_package( BLAS REQUIRED )
message( STATUS BLAS found: ${BLAS_LIBRARIES} )
Run Code Online (Sandbox Code Playgroud)
我有cblas,ATLAS和OpenBLAS,包括安装在Debian Linux系统上的开发人员软件包,以及CMake 2.8.9.我打电话的时候
cmake . -DBLA_VENDOR=ATLAS -DCMAKE_PREFIX_PATH=/usr/lib/atlas-base
Run Code Online (Sandbox Code Playgroud)
很好地看到了ATLAS库:
-- The C compiler identification is GNU 4.7.2
-- The CXX compiler identification is GNU 4.7.2
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for dgemm_
-- Looking for dgemm_ - found
-- A library with BLAS API found.
-- BLASfound:/usr/lib/atlas-base/libf77blas.so/usr/lib/atlas-base/libatlas.so
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp
Run Code Online (Sandbox Code Playgroud)
同样,只是
cmake .
Run Code Online (Sandbox Code Playgroud)
会找到/usr/lib/libblas.so我的.(我不会忘记在第二次调用之前删除缓存文件.)
当我查看时/usr/share/cmake-2.8/Modules/FindBLAS.cmake,我读作BLA_VENDOR的允许值:
## Goto,ATLAS PhiPACK,CXML,DXML,SunPerf,SCSL,SGIMATH,IBMESSL,Intel10_32 (intel mkl v10 32 bit),Intel10_64lp (intel mkl v10 64 bit,lp thread model, lp64 model),
## Intel10_64lp_seq (intel mkl v10 64 bit,sequential code, lp64 model),
## Intel( older versions of mkl 32 and 64 bit), ACML,ACML_MP,ACML_GPU,Apple, NAS, Generic
Run Code Online (Sandbox Code Playgroud)
也就是说,OpenBLAS未列出.还有一些随机试验
cmake . -DBLA_VENDOR=open -DCMAKE_PREFIX_PATH=/usr/lib/openblas-base
Run Code Online (Sandbox Code Playgroud)
也不工作.我是否必须编写自己的FindBLAS才能使用CMake链接到OpenBLAS?
FindBLAS自CMake 3.6.0 起,CMake 支持使用 OpenBLAS 查找,因为该提交最终进入了发行版。
注意:OpenBLAS 也可用于替代 LAPACK,您应该使用该FindLAPACK命令替代 LAPACK,该命令自 3.6.0 起也可用。
“FindBLAS”和“FindLAPACK”模块学会了支持 OpenBLAS。
(参见:https : //blog.kitware.com/cmake-3-6-0-rc3-is-now-ready/)
| 归档时间: |
|
| 查看次数: |
9510 次 |
| 最近记录: |