我正在尝试使用bazel在CentOS 7.3上从https://github.com/tensorflow/serving构建tensorflow-serving。我的gcc版本是4.8.5,bazel版本是0.10.1。我确信我遵循了安装介绍,并且已经设置了所有要求的先决条件。每次运行命令时: bazel build -c opt tensorflow_serving / model_servers / ... 它将运行大约10~15分钟,之后因错误而停止:
ERROR:
/root/.cache/bazel/_bazel_root/2d16d9349bff8cf3d8fc4a53d2a23056/external/org_tensorflow/tensorflow/core/kernels/BUILD:3120:1: C++ compilation of rule '@org_tensorflow//tensorflow/core/kernels:conv_ops' failed (Exit 4)
gcc: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
INFO: Elapsed time: 881.803s, Critical Path: 37.21s
FAILED: Build did NOT complete successfully
如果我尝试另一个命令:
bazel build -c opt tensorflow_serving/model_servers/...
专门构建服务子目录,错误如下:
ERROR:
/home/serving/tensorflow_serving/batching/BUILD:122:1: C++ compilation of rule '//tensorflow_serving/batching:batching_util' failed (Exit 4)
tensorflow_serving/batching/batching_util.cc: In function 'std::map<std::basic_string<char>, std::vector<int> > tensorflow::serving::CalculateMaxDimSizes(const std::vector<std::vector<std::pair<std::basic_string<char>, tensorflow::Tensor> > >&)':
tensorflow_serving/batching/batching_util.cc:165:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < batch.size(); ++i) {
^
gcc: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
INFO: Elapsed time: 1486.641s, Critical Path: 211.94s
FAILED: Build did NOT complete successfully
请原谅我可怜的英语并帮助我...我已经在这个问题上坚持了很长时间。
答案 0 :(得分:1)
我想出了问题。你的内存不够。添加参数 --local_resource 和 --jobs 实际上没有帮助。然后我尝试使用一个4 CPU和25G内存的谷歌云实例来构建。我发现构建过程可能在高峰时间需要8G内存。所以你的1.8G内存不够用。
答案 1 :(得分:0)
在TensorFlow的Github上发现了一个类似的问题(349),你很可能内存不足。他们建议添加参数&#34; - jobs 1 --local_resources 2048,.5,1.0&#34;因此,Bazel一次只产生一个编译器进程,并限制系统资源的使用。