【发布时间】:2017-07-20 10:28:31
【问题描述】:
刚刚尝试使用 icc 构建 TF,但一直失败。 以下是用于构建的命令:
CC=icc bazel build --verbose_failures --config=mkl --copt=-msse4.2 --copt="-DEIGEN_USE_VML" -c opt //tensorflow/tools/pip_package:build_pip_package
以下是错误输出:
INFO: From Compiling tensorflow/contrib/memory_stats/ops/memory_stats_ops.cc [for host]:
icc: command line warning #10006: ignoring unknown option '-frandom-seed=bazel-out/host/bin/tensorflow/contrib/memory_stats/_objs/memory_stats_ops_op_lib/tensorflow/contrib/memory_stats/ops/memory_stats_ops.o'
icc: command line warning #10006: ignoring unknown option '-Wno-builtin-macro-redefined'
Warning #2011: predefined meaning of "__DATE__" discarded
Warning #2011: predefined meaning of "__TIMESTAMP__" discarded
Warning #2011: predefined meaning of "__TIME__" discarded
tensorflow/contrib/memory_stats/ops/memory_stats_ops.cc(29): warning #2196: routine is both "inline" and "noinline"
tensorflow/contrib/memory_stats/ops/memory_stats_ops.cc(29): warning #2196: routine is both "inline" and "noinline"
ERROR: /home/bert/tensorflow/tensorflow/contrib/image/BUILD:20:1: C++ compilation of rule '//tensorflow/contrib/image:python/ops/_image_ops.so' failed: icc failed: error executing command
(cd /root/.cache/bazel/_bazel_root/de2d5e30e11a47d70dad7109465f3a0a/execroot/org_tensorflow && \
exec env - \
PWD=/proc/self/cwd \
PYTHON_BIN_PATH=/opt/intel/intelpython3/bin/python \
PYTHON_LIB_PATH=/opt/intel/intelpython3/lib/python3.5/site-packages \
TF_NEED_CUDA=0 \
TF_NEED_OPENCL=0 \
/opt/intel/compilers_and_libraries_2017.4.196/linux/bin/intel64/icc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/opt/intel/compilers_and_libraries_2017.4.196/linux/bin/intel64 -B/usr/bin -Wunused-but-set-parameter -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections -msse4.2 -DEIGEN_USE_VML '-std=c++0x' -MD -MF bazel-out/local-py3-opt/bin/tensorflow/contrib/image/_objs/python/ops/_image_ops.so/tensorflow/contrib/image/kernels/bipartite_match_op.pic.d '-frandom-seed=bazel-out/local-py3-opt/bin/tensorflow/contrib/image/_objs/python/ops/_image_ops.so/tensorflow/contrib/image/kernels/bipartite_match_op.pic.o' -fPIC -DEIGEN_MPL2_ONLY -iquote . -iquote bazel-out/local-py3-opt/genfiles -iquote external/protobuf -iquote bazel-out/local-py3-opt/genfiles/external/protobuf -iquote external/bazel_tools -iquote bazel-out/local-py3-opt/genfiles/external/bazel_tools -iquote external/eigen_archive -iquote bazel-out/local-py3-opt/genfiles/external/eigen_archive -iquote external/local_config_sycl -iquote bazel-out/local-py3-opt/genfiles/external/local_config_sycl -isystem external/protobuf/src -isystem bazel-out/local-py3-opt/genfiles/external/protobuf/src -isystem external/bazel_tools/tools/cpp/gcc3 -isystem third_party/eigen3/mkl_include -isystem bazel-out/local-py3-opt/genfiles/third_party/eigen3/mkl_include -isystem external/eigen_archive -isystem bazel-out/local-py3-opt/genfiles/external/eigen_archive -DEIGEN_AVOID_STL_ARRAY -Iexternal/gemmlowp -Wno-sign-compare -fno-exceptions '-DINTEL_MKL=1' -fopenmp -msse3 -pthread -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c tensorflow/contrib/image/kernels/bipartite_match_op.cc -o bazel-out/local-py3-opt/bin/tensorflow/contrib/image/_objs/python/ops/_image_ops.so/tensorflow/contrib/image/kernels/bipartite_match_op.pic.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 2.
icc: command line warning #10006: ignoring unknown option '-frandom-seed=bazel-out/local-py3-opt/bin/tensorflow/contrib/image/_objs/python/ops/_image_ops.so/tensorflow/contrib/image/kernels/bipartite_match_op.pic.o'
icc: command line warning #10120: overriding '-msse4.2' with '-msse3'
icc: command line warning #10006: ignoring unknown option '-Wno-builtin-macro-redefined'
Warning #2011: predefined meaning of "__DATE__" discarded
Warning #2011: predefined meaning of "__TIMESTAMP__" discarded
Warning #2011: predefined meaning of "__TIME__" discarded
In file included from tensorflow/contrib/image/kernels/bipartite_match_op.cc(17):
./tensorflow/core/framework/op_kernel.h(317): warning #858: type qualifier on return type is meaningless
const int graph_def_version() const { return graph_def_version_; }
^
tensorflow/contrib/image/kernels/bipartite_match_op.cc(88): error: type name is not allowed
typename TTypes<float, 2>::ConstTensor distance_mat =
^
tensorflow/contrib/image/kernels/bipartite_match_op.cc(88): error: expected a ";"
typename TTypes<float, 2>::ConstTensor distance_mat =
^
tensorflow/contrib/image/kernels/bipartite_match_op.cc(98): error: identifier "distance_mat" is undefined
DistancePair(index1, index2, distance_mat(index1, index2)));
^
tensorflow/contrib/image/kernels/bipartite_match_op.cc(134): warning #2196: routine is both "inline" and "noinline"
tensorflow/contrib/image/kernels/bipartite_match_op.cc(134): warning #2196: routine is both "inline" and "noinline"
tensorflow/contrib/image/kernels/bipartite_match_op.cc(134): warning #2196: routine is both "inline" and "noinline"
tensorflow/contrib/image/kernels/bipartite_match_op.cc(134): warning #2196: routine is both "inline" and "noinline"
tensorflow/contrib/image/kernels/bipartite_match_op.cc(134): warning #2196: routine is both "inline" and "noinline"
tensorflow/contrib/image/kernels/bipartite_match_op.cc(134): warning #2196: routine is both "inline" and "noinline"
tensorflow/contrib/image/kernels/bipartite_match_op.cc(134): warning #2196: routine is both "inline" and "noinline"
compilation aborted for tensorflow/contrib/image/kernels/bipartite_match_op.cc (code 2)
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 93.648s, Critical Path: 18.66s
问题似乎与某个贡献有关,是否可以从编译中排除某些贡献? 使用的 Python 是 intel python 3.5 作为背景知识,系统是在双 x5550 上运行的 Ubuntu 16,目的是获得更好的性能,因为 PC (i7-4700mq) 上的普通 TF 运行速度要快得多。
【问题讨论】:
-
就算成功构建了,你打算如何在GCC构建的python里面使用ICC构建的共享库?
-
python 和库是从 ICC 构建的,它与 Intel® Parallel Studio XE 捆绑在一起。
-
从第一个警告开始,很明显makefile与icc不兼容。您必须编辑 makefile 以使所有编译器选项都适合。
-
谢谢!这是使用 bazel,所以有一个配置文件,也许有办法用 CROSSTOOL 明确 eh 编译器
标签: python c linux tensorflow intel