zhihu / cuBERT

Fast implementation of BERT inference directly on NVIDIA (CUDA, CUBLAS) and Intel MKL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

编译不通过

dawson-chen opened this issue · comments

[ 75%] Building CXX object googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
[100%] Linking CXX static library libgtest_main.a
[100%] Built target gtest_main
[ 18%] No install step for 'googletest'
[ 19%] Completed 'googletest'
[ 19%] Built target googletest
Note: checking out 'v3.6.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b new_branch_name

HEAD is now at ab8edf1... Merge pull request #4713 from acozzette/changelog
Submodule 'third_party/benchmark' (https://github.com/google/benchmark.git) registered for path 'third_party/benchmark'
Submodule 'third_party/googletest' (https://github.com/google/googletest.git) registered for path 'third_party/googletest'
Cloning into 'third_party/benchmark'...
Submodule path 'third_party/benchmark': checked out '5b7683f49e1e9223cf9927b24f6fd3d6bd82e3f8'
Cloning into 'third_party/googletest'...
Submodule path 'third_party/googletest': checked out 'c3bb0ee2a63279a803aaad956b9b26d74bf9e6e2'
[ 20%] No patch step for 'protobuf'
[ 21%] Performing update step for 'protobuf'
[ 22%] Performing configure step for 'protobuf'

  • autoreconf -f -i -Wall,no-obsolete
    /data/allenchen/cuBERT/build/protobuf/src/protobuf/autogen.sh: line 32: autoreconf: command not found
    make[2]: *** [protobuf/src/protobuf-stamp/protobuf-configure] Error 127
    make[1]: *** [CMakeFiles/protobuf.dir/all] Error 2
    make: *** [all] Error 2

我看大家好像都能使用,但是我在centos7上编译报了这个错,求帮助~
我的mkl版本是2019.0

你的系统里没有装 autoreconf 吧,试一下 yum install autoconf automake libtool

@levyfan 非常感谢,现在已经可以执行到后面了!
但是编译程序的时候还有个问题我无法解决,麻烦帮我看下
error: missing space between ‘""’ and suffix identifier
我系统里gcc和g++版本是4.8.5。

下面是完整错误信息
Scanning dependencies of target cuBERT
[ 57%] Building CXX object CMakeFiles/cuBERT.dir/src/cuBERT.cpp.o
[ 58%] Building C object CMakeFiles/cuBERT.dir/src/utf8proc/utf8proc.c.o
[ 59%] Building CXX object CMakeFiles/cuBERT.dir/src/cuBERT/common.cpp.o
[ 60%] Building CXX object CMakeFiles/cuBERT.dir/src/cuBERT/tokenization.cpp.o
/data/allenchen/cuBERT/src/cuBERT/common.cpp:19:2: error: #error only one and extact one blas implementation should be selected
#error only one and extact one blas implementation should be selected
^
In file included from /data/allenchen/cuBERT/src/cuBERT/common.h:8:0,
from /data/allenchen/cuBERT/src/cuBERT.cpp:7:
/data/allenchen/cuBERT/src/half.hpp:274:8: error: missing space between ‘""’ and suffix identifier
half operator""_h(long double);
^
/data/allenchen/cuBERT/src/half.hpp:1085:24: error: missing space between ‘""’ and suffix identifier
friend half literal::operator""_h(long double);
^
/data/allenchen/cuBERT/src/half.hpp:1198:15: error: missing space between ‘""’ and suffix identifier
inline half operator""_h(long double value) { return half(detail::binary, detail::float2halfhalf::round_style(value)); }
^
In file included from /data/allenchen/cuBERT/src/cuBERT/./common.h:8:0,
from /data/allenchen/cuBERT/src/cuBERT/common.cpp:22:
/data/allenchen/cuBERT/src/half.hpp:274:8: error: missing space between ‘""’ and suffix identifier
half operator""_h(long double);
^
/data/allenchen/cuBERT/src/half.hpp:1085:24: error: missing space between ‘""’ and suffix identifier
friend half literal::operator""_h(long double);
^
/data/allenchen/cuBERT/src/half.hpp:1198:15: error: missing space between ‘""’ and suffix identifier
inline half operator""_h(long double value) { return half(detail::binary, detail::float2halfhalf::round_style(value)); }
^
make[2]: *** [CMakeFiles/cuBERT.dir/src/cuBERT/common.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/cuBERT.dir/src/cuBERT.cpp.o] Error 1
make[1]: *** [CMakeFiles/cuBERT.dir/all] Error 2
make: *** [all] Error 2

需要升级 gcc 版本 >=4.9,代码是 c11 标准的,4.8.5 没有支持 c11

@levyfan 感谢帮助,编译成功了!
分享一下我遇到的问题
环境
ubuntu 16
cmake 3.9
gcc g++ 5.4
安装了四个包编译时的工具 autoconf automake libtool pkg-config

编译中最耗时的是mkl包下载过程,2h只下载了4%;不知道是不是个人原因,感觉在github上下载东西都挺慢的;最后改了下下载地址解决了
将cmake/mkl.cmake文件以下片段
set(mkl_LNX mklml_lnx_2019.0.3.20190220.tgz)
set(mkl_TAG v0.18)
set(mkl_URL https://github.com/intel/mkl-dnn/releases)
改成
set(mkl_LNX mklml_lnx_2019.0.20180710.tgz)
set(mkl_TAG v0.16)
set(mkl_URL https://mirror.bazel.build/github.com/intel/mkl-dnn/releases)
最后用了半小时编译完成。