Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7954 Discussions

Compiling TensorFlow with Intel C Compiler

Osanda_G_
Beginner
1,292 Views

Just Tried to build TF with icc and it keeps failing. the following is the command used for building:

CC=icc bazel build --verbose_failures --config=mkl --copt=-msse4.2 --copt="-DEIGEN_USE_VML" -c opt //tensorflow/tools/pip_package:build_pip_package

The following was the error output:

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

The issue seems to be with a contrib, is it possible to exclude certain contribs from the compilation? The Python used is intel python 3.5 As bit of background, the system is Ubuntu 16 running on dual x5550, the aim was to get better performance since plain TF on a PC (i7-4700mq) works much faster.

0 Kudos
4 Replies
Xiaoping_D_Intel
Employee
1,292 Views

It is a known issue and a workaround  is changing the variable declaration to:

auto distance_mat =

 

The existing bug track ID is CMPLRS-38890.

Thanks,

Xiaoping Duan

Intel Customer Support

 

0 Kudos
Osanda_G_
Beginner
1,292 Views

Duan, Xiaoping (Intel) wrote:

It is a known issue and a workaround  is changing the variable declaration to:

auto distance_mat =

 

The existing bug track ID is CMPLRS-38890.

Thanks,

Xiaoping Duan

Intel Customer Support

 

Thank Your Very Very Much Xiaoping Duan

This is tensorflow that I am trying to compile, so I get various errors through out.

How do I find more information which regards to the bug track?

 

0 Kudos
Xiaoping_D_Intel
Employee
1,292 Views

Osanda G. wrote:

Quote:

Duan, Xiaoping (Intel) wrote:

 

It is a known issue and a workaround  is changing the variable declaration to:

auto distance_mat =

 

The existing bug track ID is CMPLRS-38890.

Thanks,

Xiaoping Duan

Intel Customer Support

 

 

 

Thank Your Very Very Much Xiaoping Duan

This is tensorflow that I am trying to compile, so I get various errors through out.

How do I find more information which regards to the bug track?

 

We used to provide a bug fixes list for new compiler releases in which you can check whether a bug has been fixed using its ID; however, it is not available now: https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/702188

 

For better tracking the status of an issue reported you may submit a ticket at our Online Service Center by http://www.intel.com/supporttickets

 

Thanks,

Xiaoping Duan

Intel Customer Support

0 Kudos
Steven_K
Beginner
1,292 Views

Did anyone try to compile the master branch with the latest icc 18?

I'm compiling on visual studio 2017 and now I'm stuck at tf_core_kernels, that I can compile with the msvc w/o problems, whereas the newest intel compiler version gives me a linker error shortly after multiple decorated name length exceeded warnings in training_ops.cc (#2586).
Thought this has been fixed..
 

0 Kudos
Reply