- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
今天一整天我都在为这个问题苦苦挣扎。我相信我在 CMake 中遗漏了一些小东西,因为这是我现在第一次使用它,而且我遇到了所有这些错误。
我的问题是,无论我如何更改或在 Cmake 文件中包含什么,我都会不断收到此错误。
[ 25%] Linking CXX executable Matrix_Benchmark
CMakeFiles/Matrix_Benchmark.dir/main.cpp.o: In function `run_benchmark(double*, double*, double*, int, int, int, int)':
/home/lumx/git_projects/memory-traces/src/Matrix_Benchmark/main.cpp:202: undefined reference to `cblas_dgemm'
collect2: error: ld returned 1 exit status
我认为 Blas 和 OpenBlas 存在问题,因为没有带有 blas 或 blas-devel 包的 cblas.h 为此,我必须安装 OpenBlas 和开发库。
到目前为止我尝试了很多东西,我将包括我现在拥有的有点困惑的 Cmake 文件。我对此感到抱歉,但我希望有人能发现更多错误并帮助我改进这些错误。
cmake_minimum_required(VERSION 3.5)
#set( CMAKE_VERBOSE_MAKEFILE on )
set( CMAKE_VERBOSE_MAKEFILE off )
project(Matrix_Benchmark)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Werror -Wfatal-errors -Wall -O2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wfatal-errors -Wall -O2")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wfatal-errors -Wall -O2")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
#https://github.com/BVLC/caffe/blob/master/cmake/Modules/FindOpenBLAS.cmake
SET(Open_BLAS_INCLUDE_SEARCH_PATHS
/usr/include
/usr/include/openblas
/usr/include/openblas-base
/usr/local/include
/usr/local/include/openblas
/usr/local/include/openblas-base
/opt/OpenBLAS/include
$ENV{OpenBLAS_HOME}
$ENV{OpenBLAS_HOME}/include
)
SET(Open_BLAS_LIB_SEARCH_PATHS
/lib/
/lib/openblas-base
/lib64/
/usr/lib
/usr/lib/openblas-base
/usr/lib64
/usr/local/lib
/usr/local/lib64
/opt/OpenBLAS/lib
$ENV{OpenBLAS}cd
$ENV{OpenBLAS}/lib
$ENV{OpenBLAS_HOME}
$ENV{OpenBLAS_HOME}/lib
)
FIND_PATH(OpenBLAS_INCLUDE_DIR NAMES cblas.h PATHS ${Open_BLAS_INCLUDE_SEARCH_PATHS})
FIND_LIBRARY(OpenBLAS_LIB NAMES openblas PATHS ${Open_BLAS_LIB_SEARCH_PATHS})
SET(OpenBLAS_FOUND ON)
# Check include files
IF(NOT OpenBLAS_INCLUDE_DIR)
SET(OpenBLAS_FOUND OFF)
MESSAGE(STATUS "Could not find OpenBLAS include. Turning OpenBLAS_FOUND off")
ENDIF()
# Check libraries
IF(NOT OpenBLAS_LIB)
SET(OpenBLAS_FOUND OFF)
MESSAGE(STATUS "Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off")
ENDIF()
IF (OpenBLAS_FOUND)
IF (NOT OpenBLAS_FIND_QUIETLY)
MESSAGE(STATUS "Found OpenBLAS libraries: ${OpenBLAS_LIB}")
MESSAGE(STATUS "Found OpenBLAS include: ${OpenBLAS_INCLUDE_DIR}")
ENDIF (NOT OpenBLAS_FIND_QUIETLY)
ELSE (OpenBLAS_FOUND)
IF (OpenBLAS_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find OpenBLAS")
ENDIF (OpenBLAS_FIND_REQUIRED)
ENDIF (OpenBLAS_FOUND)
MARK_AS_ADVANCED(
OpenBLAS_INCLUDE_DIR
OpenBLAS_LIB
OpenBLAS
)
find_package(BLAS REQUIRED)
if(BLAS_FOUND)
message(WARNING "BLAS FOUND")
link_directories(${OpenBLAS_LIB})
#link_directories(/usr/lib64/libopenblas.so)
message(WARNING ${BLAS_LIBRARIES} " asd " ${OpenBLAS_LIB} " asdfasd " ${OpenBLAS_INCLUDE_DIR})
add_library(OpenBlas /usr/include/openblas/cblas.h)
else(BLAS_FOUND)
message(FATAL_ERROR "BLAS NOT FOUND")
endif(BLAS_FOUND)
if(OpenBLAS_FOUND)
message(WARNING "OpenBLAS FOUND")
link_directories(${BLAS_LIBRARIES})
#link_directories(/usr/lib64/libopenblas.so)
message(WARNING ${OpenBLAS_FOUND} " asd " ${BLA_VENDOR} )
#add_library(OpenBlas /usr/include/openblas/cblas.h)
else(OpenBLAS_FOUND)
message(FATAL_ERROR "BLAS NOT FOUND")
endif(OpenBLAS_FOUND)
find_package(LAPACK REQUIRED)
if(LAPACK_FOUND)
message(WARNING "LAPACK FOUND")
link_directories(${LAPACK_LIBRARIES})
message(WARNING ${LAPACK_LIBRARIES})
else(LAPACK_FOUND)
message(FATAL_ERROR "LAPACK NOT FOUND")
endif(LAPACK_FOUND)
set(SOURCE_FILES ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${OpenBLAS_INCLUDE_DIR} main.cpp MatrixMarket/mmio.c MatrixMarket/iohb.c )
add_executable(Matrix_Benchmark ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${OpenBLAS_INCLUDE_DIR} ${SOURCE_FILES})
if(BLAS_FOUND)
target_link_libraries (Matrix_Benchmark ${BLAS_LIBRARIES})
endif(BLAS_FOUND)
if(LAPACK_FOUND)
target_link_libraries ( Matrix_Benchmark ${LAPACK_LIBRARIES})
endif(LAPACK_FOUND)
# copy data folder to build (not working, have to fix it)
file(GLOB dataFiles "${CMAKE_CURRENT_BINARY_DIR}/data/")
#file( GLOB_RECURSE dataFiles RELATIVE "${CMAKE_CURRENT_BINARY_DIR}" "data/*.*)
#file( GLOB_RECURSE pattern_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/" "patterns/*.vti" )
#add_custom_target(copy)
foreach(dataFile ${dataFiles})
message(WARNING "ASDASDASD")
message(WARNING ${dataFolder})
#set (dest "${PROJECT_BINARY_DIR}/${copyDataFiles}")
#SET (dest2 "${CMAKE_CURRENT_BINARY_DIR}/${copyDataFiles}")
message(WARNING " Copying ${dest}")
add_custom_command(
TARGET dataFile POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy ${CMAKE_CURRENT_BINARY_DIR}/${dataFiles} ${CMAKE_SOURCE_DIR}/data/
)
#SET (dest2 "${CMAKE_CURRENT_BINARY_DIR}/${copyDataFiles}")
#MESSAGE(STATUS " Copying ${dest2}")
endforeach(dataFile)
我也有 cblas.h 的 include 指令来处理 C 和 C++
#ifdef __cplusplus
extern "C"
{
#endif
#include <openblas/cblas.h>
#ifdef __cplusplus
}
#endif
最佳答案
好的,修复了它。
我没有在 CMake 文件中包含 OpenBlas lib,出于某些原因,我不得不删除所有 Blas、OpenBlas、Lapack 包并重新安装它们。同样出于某种原因,我不得不重新启动系统以使其正常工作。这很奇怪,但谁知道发生了什么。
现在 CMake 文件看起来像
cmake_minimum_required(VERSION 3.5)
#set( CMAKE_VERBOSE_MAKEFILE on )
set( CMAKE_VERBOSE_MAKEFILE off )
project(Matrix_Benchmark)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Werror -Wfatal-errors -Wall -O2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wfatal-errors -Wall -O2")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wfatal-errors -Wall -O2")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
#https://github.com/BVLC/caffe/blob/master/cmake/Modules/FindOpenBLAS.cmake
SET(Open_BLAS_INCLUDE_SEARCH_PATHS
/usr/include
/usr/include/openblas
/usr/include/openblas-base
/usr/local/include
/usr/local/include/openblas
/usr/local/include/openblas-base
/opt/OpenBLAS/include
$ENV{OpenBLAS_HOME}
$ENV{OpenBLAS_HOME}/include
)
SET(Open_BLAS_LIB_SEARCH_PATHS
/lib/
/lib/openblas-base
/lib64/
/usr/lib
/usr/lib/openblas-base
/usr/lib64
/usr/local/lib
/usr/local/lib64
/opt/OpenBLAS/lib
$ENV{OpenBLAS}cd
$ENV{OpenBLAS}/lib
$ENV{OpenBLAS_HOME}
$ENV{OpenBLAS_HOME}/lib
)
FIND_PATH(OpenBLAS_INCLUDE_DIR NAMES cblas.h PATHS ${Open_BLAS_INCLUDE_SEARCH_PATHS})
FIND_LIBRARY(OpenBLAS_LIB NAMES openblas PATHS ${Open_BLAS_LIB_SEARCH_PATHS})
SET(OpenBLAS_FOUND ON)
# Check include files
IF(NOT OpenBLAS_INCLUDE_DIR)
SET(OpenBLAS_FOUND OFF)
MESSAGE(STATUS "Could not find OpenBLAS include. Turning OpenBLAS_FOUND off")
ENDIF()
# Check libraries
IF(NOT OpenBLAS_LIB)
SET(OpenBLAS_FOUND OFF)
MESSAGE(STATUS "Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off")
ENDIF()
IF (OpenBLAS_FOUND)
IF (NOT OpenBLAS_FIND_QUIETLY)
MESSAGE(STATUS "Found OpenBLAS libraries: ${OpenBLAS_LIB}")
MESSAGE(STATUS "Found OpenBLAS include: ${OpenBLAS_INCLUDE_DIR}")
ENDIF (NOT OpenBLAS_FIND_QUIETLY)
ELSE (OpenBLAS_FOUND)
IF (OpenBLAS_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find OpenBLAS")
ENDIF (OpenBLAS_FIND_REQUIRED)
ENDIF (OpenBLAS_FOUND)
MARK_AS_ADVANCED(
OpenBLAS_INCLUDE_DIR
OpenBLAS_LIB
OpenBLAS
)
find_package(BLAS REQUIRED)
if(BLAS_FOUND)
message(WARNING "BLAS_LIB FOUND at " ${BLAS_LIBRARIES} " include files " )
link_directories(${BLAS_LIBRARIES})
else(BLAS_FOUND)
message(FATAL_ERROR "BLAS NOT FOUND")
endif(BLAS_FOUND)
if(OpenBLAS_FOUND)
message(WARNING "OpenBLAS_LIB FOUND at " ${OpenBLAS_LIB} ", include files " ${OpenBLAS_INCLUDE_DIR})
link_directories(${OpenBLAS_LIB})
#add_library(${OpenBLAS_INCLUDE_DIR})
else(OpenBLAS_FOUND)
message(FATAL_ERROR "OpenBLAS_FOUND NOT FOUND")
endif(OpenBLAS_FOUND)
find_package(LAPACK REQUIRED)
if(LAPACK_FOUND)
message(WARNING "LAPACK_LIB FOUND at " ${LAPACK_LIBRARIES} ", include files " )
link_directories(${LAPACK_LIBRARIES})
else(LAPACK_FOUND)
message(FATAL_ERROR "LAPACK NOT FOUND")
endif(LAPACK_FOUND)
set(SOURCE_FILES ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${OpenBLAS_INCLUDE_DIR} main.cpp MatrixMarket/mmio.c MatrixMarket/iohb.c )
add_executable(Matrix_Benchmark ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${OpenBLAS_LIB} ${SOURCE_FILES})
if(BLAS_FOUND)
target_link_libraries (Matrix_Benchmark ${BLAS_LIBRARIES})
endif(BLAS_FOUND)
if(OpenBLAS_FOUND)
target_link_libraries (Matrix_Benchmark ${OpenBLAS_LIB})
endif(OpenBLAS_FOUND)
if(LAPACK_FOUND)
target_link_libraries ( Matrix_Benchmark ${LAPACK_LIBRARIES})
endif(LAPACK_FOUND)
# copy data folder to build
file(GLOB dataFiles "${CMAKE_CURRENT_BINARY_DIR}/data/")
#file( GLOB_RECURSE dataFiles RELATIVE "${CMAKE_CURRENT_BINARY_DIR}" "data/*.*)
#file( GLOB_RECURSE pattern_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/" "patterns/*.vti" )
#add_custom_target(copy)
foreach(dataFile ${dataFiles})
message(WARNING "ASDASDASD")
message(WARNING ${dataFolder})
#set (dest "${PROJECT_BINARY_DIR}/${copyDataFiles}")
#SET (dest2 "${CMAKE_CURRENT_BINARY_DIR}/${copyDataFiles}")
message(WARNING " Copying ${dest}")
add_custom_command(
TARGET dataFile POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy ${CMAKE_CURRENT_BINARY_DIR}/${dataFiles} ${CMAKE_SOURCE_DIR}/data/
)
#SET (dest2 "${CMAKE_CURRENT_BINARY_DIR}/${copyDataFiles}")
#MESSAGE(STATUS " Copying ${dest2}")
endforeach(dataFile)
关于无法将 BLAS 库与 Clion 2016.1.2 和 Fedora 22 链接,获取 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37515867/
Java 库和 android 库有什么区别,各自有什么优点/缺点? 最佳答案 您可以在 Android 应用程序中包含标准 Java .jar 文件库。它们在 .apk 构建时被翻译成 Dalvik
所以,我现在的代码就像从 Java 层加载库(比如 liba.so),并在内部 liba.so 加载 libb.so。因此,如果我必须将所有库打包到 APK 中并将其安装在没有 root 访问权限的设
我想在我的系统中设置 LEDA 库。 我已经从以下链接下载了 LEDA 库 http://www.algorithmic-solutions.info/free/d5.php Instruct
我想用 autoconf 创建一个共享库。但是,我希望共享库具有“.so”扩展名,而不是以“lib”开头。基本上,我想制作一个加载 dlopen 的插件。 .是否有捷径可寻? 当我尝试使用 autoc
我需要在 Apps 脚本应用程序上修改 PDF。为此,我想使用 JS 库:PDF-LIB 我的代码: eval(UrlFetchApp.fetch("https://unpkg.com/pdf-lib
我正在构建一个使用以下 Boost header 的程序(我使用的是 Microsoft Visual C++ 10), #include #include #include #include
当我通过 cygwin 在 hadoop 上运行此命令时: $bin/hadoop jar hadoop-examples-*.jar grep input output 'dfs[a-z.]+' 我
我已经通过 vcpgk 成功安装了一个 C++ 库,名为:lmdb:x64-windows 我还安装了lmdb通过 Cabal 安装的 Haskell 绑定(bind)包 在尝试测试 lmdb 包时:
我该如何解决这个问题? 我刚刚将 javacv jar 文件复制到我的项目 Lib 文件夹下,但出现了这个错误! 我可以找到这个thread来自谷歌,但不幸的是,由于我国的谷歌限制政策,该页面无法打开
我有一个 Android 库项目 FooLib。 FooLib 引用 Android Context 之类的东西,但不需要任何资源文件(res/ 中的东西)所以我目前将其打包为供我的应用使用的 JAR
我正在开发一个 Android 应用程序(使用 Android Studio),它能够通过手势识别算法了解您正在进行的 Activity 。对于我使用 nickgillian ithub 帐户上可用的
关于从 .NET Framework 项目中引用 .NET Standard 类库的问题有很多类似的问题,其中 netstandard 库中的 NuGet 包依赖项不会流向 netframework
我已经从互联网上下载了 jna-4.2.2.jar,现在想将这个 jar 导入到我的项目中。但是当我试图将这个 jar 导入我的项目时,出现以下错误。 [2016-06-20 09:35:01 - F
我正在尝试通过编译在 Mac 上安装 rsync 3.2.3。但是,我想安装所有功能。为此,它需要一些库,此处 ( https://download.samba.org/pub/rsync/INSTA
进入 Web 开发有点困难。过去 5 年我一直致力于 winforms 工作。所以我正在努力从一种切换到另一种。前段时间,我使用过 JavaScript,但现在还没有大量的 JavaScript 库
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
我正在寻找一个用Python编写的与logstash(ruby + java)类似的工具/库。 我的目标是: 从 syslog 中解析所有系统日志 解析应用程序特定日志(apache、django、m
就目前情况而言,这个问题不太适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、民意调查或扩展讨论。如果您觉得这个问题可以改进并可能重新开放,visit
我花了几天时间试图寻找用于 JavaPOS 实现的 .jar 库,但我找不到任何可以工作的东西。我找到了很多像这样的文档:http://jpos.1045706.n5.nabble.com/file/
这个问题在这里已经有了答案: Merge multiple .so shared libraries (2 个答案) 关闭 9 年前。 我有我在代码中使用的第三方库的源代码和对象。该库附带有关如何使
我是一名优秀的程序员,十分优秀!