我正在尝试在 Ubuntu 16.04 中使用 OpenBLAS 编译 Caffe。我已经使用 make NO_AFFINITY=1 USE_OPENMP=1 下载并编译了 OpenBLAS OpenBLAS 编译正常,所有测试也运行
OpenBLAS build complete. (BLAS CBLAS LAPACK LAPACKE)
OS ... Linux
Architecture ... x86_64
BINARY ... 64bit
C compiler ... GCC (command line : gcc)
Fortran compiler ... GFORTRAN (command line : gfortran)
Library Name ... libopenblas_sandybridgep-r0.2.20.dev.a (Multi threaded; Max num-threads is 4)
Use OpenMP in the multithreading. Because of ignoring OPENBLAS_NUM_THREADS and GOTO_NUM_THREADS flags,
you should use OMP_NUM_THREADS environment variable to control the number of threads.
但是在 Caffe 安装中与 OpenBLAS 库链接会出现以下错误
Linking CXX executable upgrade_net_proto_binary /opt/OpenBLAS/lib/libopenblas.so: undefined reference to `GOMP_parallel@GOMP_4.0' collect2: error: ld returned 1 exit status tools/CMakeFiles/upgrade_net_proto_binary.dir/build.make:129: recipe for target 'tools/upgrade_net_proto_binary' failed make[2]: * [tools/upgrade_net_proto_binary] Error 1 CMakeFiles/Makefile2:403: recipe for target 'tools/CMakeFiles/upgrade_net_proto_binary.dir/all' failed make[1]: * [tools/CMakeFiles/upgrade_net_proto_binary.dir/all] Error 2
最佳答案
最有可能的原因是您链接到已编译的 OpenBLAS,而不是安装它并链接到安装。运行 make
后,您应该运行 make install PREFIX=/path/to/install/OpenBLAS
,然后您应该链接到已安装的版本。
关于c++ - 编译 Caffe 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42415515/