Skip to content

Failed compilation with avx or avx2 on Ubuntu 14.04 #580

Closed

Description

@alquraishi

I am unable to compile when passing avx or avx2 to bazel, even though I have an avx2-compatible CPU (Xeon E5-2643 v3). This is the command I'm using to compile:

bazel build -c opt --copt=-mavx2 //tensorflow/tools/pip_package:build_pip_package

Also I can compile just fine using the default CPU or GPU configurations, i.e. both of these commands work:

bazel build -c opt //tensorflow/tools/pip_package:build_pip_package
bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package

Here is the error message when turning on verbose_failures:

ERROR: /usr/local/tensorflow/tensorflow/core/BUILD:157:1: C++ compilation of rule '//tensorflow/core:framework' failed: gcc failed: error executing command
(cd /root/.cache/bazel/bazel_root/e86f6fce5559de9e3e13fb6adb66b858/tensorflow &&
exec env -
INTERCEPT_LOCALLY_EXECUTABLE=1
PATH=/usr/local/cuda/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -fPIE -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 -DNDEBUG -ffunction-sections -fdata-sections -mavx2 '-std=c++0x' -iquote . -iquote bazel-out/local_linux-opt/genfiles -isystem google/protobuf/src -isystem bazel-out/local_linux-opt/genfiles/google/protobuf/src -isystem tools/cpp/gcc3 -isystem external/jpeg_archive/jpeg-9a -isystem bazel-out/local_linux-opt/genfiles/external/jpeg_archive/jpeg-9a -isystem external/png_archive/libpng-1.2.53 -isystem bazel-out/local_linux-opt/genfiles/external/png_archive/libpng-1.2.53 -isystem external/re2 -isystem bazel-out/local_linux-opt/genfiles/external/re2 -isystem third_party/eigen3 -isystem bazel-out/local_linux-opt/genfiles/third_party/eigen3 -isystem external/eigen_archive/eigen-eigen-ce5a455b34c0 -isystem bazel-out/local_linux-opt/genfiles/external/eigen_archive/eigen-eigen-ce5a455b34c0 -pthread -fno-exceptions -DEIGEN_AVOID_STL_ARRAY -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE
_="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' '-frandom-seed=bazel-out/local_linux-opt/bin/tensorflow/core/objs/framework/tensorflow/core/framework/kernel_def_builder.pic.o' -MD -MF bazel-out/local_linux-opt/bin/tensorflow/core/objs/framework/tensorflow/core/framework/kernel_def_builder.pic.d -fPIC -c tensorflow/core/framework/kernel_def_builder.cc -o bazel-out/local_linux-opt/bin/tensorflow/core/objs/framework/tensorflow/core/framework/kernel_def_builder.pic.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1: gcc failed: error executing command
(cd /root/.cache/bazel/bazel_root/e86f6fce5559de9e3e13fb6adb66b858/tensorflow &&
exec env -
INTERCEPT_LOCALLY_EXECUTABLE=1
PATH=/usr/local/cuda/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -fPIE -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 -DNDEBUG -ffunction-sections -fdata-sections -mavx2 '-std=c++0x' -iquote . -iquote bazel-out/local_linux-opt/genfiles -isystem google/protobuf/src -isystem bazel-out/local_linux-opt/genfiles/google/protobuf/src -isystem tools/cpp/gcc3 -isystem external/jpeg_archive/jpeg-9a -isystem bazel-out/local_linux-opt/genfiles/external/jpeg_archive/jpeg-9a -isystem external/png_archive/libpng-1.2.53 -isystem bazel-out/local_linux-opt/genfiles/external/png_archive/libpng-1.2.53 -isystem external/re2 -isystem bazel-out/local_linux-opt/genfiles/external/re2 -isystem third_party/eigen3 -isystem bazel-out/local_linux-opt/genfiles/third_party/eigen3 -isystem external/eigen_archive/eigen-eigen-ce5a455b34c0 -isystem bazel-out/local_linux-opt/genfiles/external/eigen_archive/eigen-eigen-ce5a455b34c0 -pthread -fno-exceptions -DEIGEN_AVOID_STL_ARRAY -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE
="redacted"' '-D__TIMESTAMP
="redacted"' '-D__TIME__="redacted"' '-frandom-seed=bazel-out/local_linux-opt/bin/tensorflow/core/_objs/framework/tensorflow/core/framework/kernel_def_builder.pic.o' -MD -MF bazel-out/local_linux-opt/bin/tensorflow/core/_objs/framework/tensorflow/core/framework/kernel_def_builder.pic.d -fPIC -c tensorflow/core/framework/kernel_def_builder.cc -o bazel-out/local_linux-opt/bin/tensorflow/core/_objs/framework/tensorflow/core/framework/kernel_def_builder.pic.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
Target //tensorflow/tools/pip_package:build_pip_package failed to build

Activity

  1. benoitsteiner commented on Dec 23, 2015

    @benoitsteiner
    Contributor

    I have upstreamed a partial fix to Eigen (see https://bitbucket.org/eigen/eigen/commits/f6e3953e6b44a8a0bfde7186cc162a612a904e15 for details).
    I'll work on the second half of the problem after the Christmas break.

  2. alquraishi commented on Jan 14, 2016

    @alquraishi
    Author

    Any updates on this?

  3. benoitsteiner commented on Jan 23, 2016

    @benoitsteiner
    Contributor

    This will be fixed with pull request #847

  4. benoitsteiner commented on Jan 24, 2016

    @benoitsteiner
    Contributor

    The fix was merged. Closing this issue.

  5. skearnes commented on Jan 25, 2016

    @skearnes

    @benoitsteiner I'm still having problems at a27d844:

    bazel build -c opt --copt=-mavx2 //tensorflow:tensorflow_py --verbose_failures

    INFO: From Compiling tensorflow/core/framework/op.cc:
    In file included from ./tensorflow/core/framework/types.h:27:0,
                     from ./tensorflow/core/framework/type_traits.h:22,
                     from ./tensorflow/core/framework/allocator.h:25,
                     from ./tensorflow/core/framework/op_kernel.h:22,
                     from tensorflow/core/framework/op.cc:21:
    ./third_party/eigen3/unsupported/Eigen/CXX11/FixedPoint:36:52: fatal error: src/Tensor/TensorContractionThreadPool.h: No such file or directory
     #include "src/Tensor/TensorContractionThreadPool.h"
                                                        ^
    compilation terminated.
    ERROR: /home/kearnes/git/tensorflow/tensorflow/core/BUILD:718:1: C++ compilation of rule '//tensorflow/core:framework_internal' failed: gcc failed: error executing command 
      (cd /home/kearnes/.cache/bazel/_bazel_kearnes/f662703ad8d0299d3b1319f4ce155cb9/tensorflow && \
      exec env - \
        PATH=/home/kearnes/miniconda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/kearnes/bin:/usr/local/cuda/bin \
      /usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 -DNDEBUG -ffunction-sections -fdata-sections -mavx2 '-std=c++0x' -iquote . -iquote bazel-out/local_linux-opt/genfiles -iquote external/bazel_tools -iquote bazel-out/local_linux-opt/genfiles/external/bazel_tools -iquote external/jpeg_archive -iquote bazel-out/local_linux-opt/genfiles/external/jpeg_archive -iquote external/png_archive -iquote bazel-out/local_linux-opt/genfiles/external/png_archive -iquote external/re2 -iquote bazel-out/local_linux-opt/genfiles/external/re2 -iquote external/eigen_archive -iquote bazel-out/local_linux-opt/genfiles/external/eigen_archive -isystem google/protobuf/src -isystem bazel-out/local_linux-opt/genfiles/google/protobuf/src -isystem external/bazel_tools/tools/cpp/gcc3 -isystem external/jpeg_archive/jpeg-9a -isystem bazel-out/local_linux-opt/genfiles/external/jpeg_archive/jpeg-9a -isystem external/png_archive/libpng-1.2.53 -isystem bazel-out/local_linux-opt/genfiles/external/png_archive/libpng-1.2.53 -isystem external/re2 -isystem bazel-out/local_linux-opt/genfiles/external/re2 -isystem third_party/eigen3 -isystem bazel-out/local_linux-opt/genfiles/third_party/eigen3 -isystem external/eigen_archive/eigen-eigen-c8e5d094f3a9 -isystem bazel-out/local_linux-opt/genfiles/external/eigen_archive/eigen-eigen-c8e5d094f3a9 -pthread -fno-exceptions -DEIGEN_AVOID_STL_ARRAY -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' '-frandom-seed=bazel-out/local_linux-opt/bin/tensorflow/core/_objs/framework_internal/tensorflow/core/framework/op.pic.o' -MD -MF bazel-out/local_linux-opt/bin/tensorflow/core/_objs/framework_internal/tensorflow/core/framework/op.pic.d -fPIC -c tensorflow/core/framework/op.cc -o bazel-out/local_linux-opt/bin/tensorflow/core/_objs/framework_internal/tensorflow/core/framework/op.pic.o): gcc failed: error executing command 
      (cd /home/kearnes/.cache/bazel/_bazel_kearnes/f662703ad8d0299d3b1319f4ce155cb9/tensorflow && \
      exec env - \
        PATH=/home/kearnes/miniconda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/kearnes/bin:/usr/local/cuda/bin \
      /usr/bin/gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 -DNDEBUG -ffunction-sections -fdata-sections -mavx2 '-std=c++0x' -iquote . -iquote bazel-out/local_linux-opt/genfiles -iquote external/bazel_tools -iquote bazel-out/local_linux-opt/genfiles/external/bazel_tools -iquote external/jpeg_archive -iquote bazel-out/local_linux-opt/genfiles/external/jpeg_archive -iquote external/png_archive -iquote bazel-out/local_linux-opt/genfiles/external/png_archive -iquote external/re2 -iquote bazel-out/local_linux-opt/genfiles/external/re2 -iquote external/eigen_archive -iquote bazel-out/local_linux-opt/genfiles/external/eigen_archive -isystem google/protobuf/src -isystem bazel-out/local_linux-opt/genfiles/google/protobuf/src -isystem external/bazel_tools/tools/cpp/gcc3 -isystem external/jpeg_archive/jpeg-9a -isystem bazel-out/local_linux-opt/genfiles/external/jpeg_archive/jpeg-9a -isystem external/png_archive/libpng-1.2.53 -isystem bazel-out/local_linux-opt/genfiles/external/png_archive/libpng-1.2.53 -isystem external/re2 -isystem bazel-out/local_linux-opt/genfiles/external/re2 -isystem third_party/eigen3 -isystem bazel-out/local_linux-opt/genfiles/third_party/eigen3 -isystem external/eigen_archive/eigen-eigen-c8e5d094f3a9 -isystem bazel-out/local_linux-opt/genfiles/external/eigen_archive/eigen-eigen-c8e5d094f3a9 -pthread -fno-exceptions -DEIGEN_AVOID_STL_ARRAY -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' '-frandom-seed=bazel-out/local_linux-opt/bin/tensorflow/core/_objs/framework_internal/tensorflow/core/framework/op.pic.o' -MD -MF bazel-out/local_linux-opt/bin/tensorflow/core/_objs/framework_internal/tensorflow/core/framework/op.pic.d -fPIC -c tensorflow/core/framework/op.cc -o bazel-out/local_linux-opt/bin/tensorflow/core/_objs/framework_internal/tensorflow/core/framework/op.pic.o).
    Target //tensorflow:tensorflow_py failed to build
    
  6. gokceneraslan commented on Jan 26, 2016

    @gokceneraslan
    Contributor

    Yes, I'm also getting the same error at b159e21.

  7. reopened this on Jan 26, 2016
  8. vrv commented on Jan 26, 2016

    @vrv

    Reopening since we had to rollback the change.

  9. benoitsteiner commented on Feb 4, 2016

    @benoitsteiner
    Contributor

    I have another set of fixes pending in pull request #991

  10. benoitsteiner commented on Feb 12, 2016

    @benoitsteiner
    Contributor

    Pull request #991 is now merged in the codebase. I'm closing this issue.

  11. caisq commented on Apr 18, 2016

    @caisq
    Contributor

    @benoitsteiner @wicke @vrv

    Update: The build agents have Xeon CPUs, which don't support AVX2. Perhaps that's the cause of the failures below. If this is confirmed, there is no action required on this issue.

    Not sure if a new issue should be created since it has been three months since this issue was closed. But today I noticed a large number of test errors while doing
    bazel test -c opt --copt=-mavx2 //tensorflow/...
    on the master branch, as a part of the effort to add mavx/mavx2 build to Jenkins.

    Executed 414 out of 416 tests: 356 tests pass and 60 fail locally.

    The logs from the individual failed test failures are not especially informative. For example:

    ==================== Test output for //tensorflow/python:matmul_op_test:
    external/bazel_tools/tools/test/test-setup.sh: line 52: 7125 Illegal instruction (core dumped) "$@"

    Testing with --copt=-mavx or no AVX flag didn't see any failures.

  12. vrv commented on Apr 18, 2016

    @vrv

    Do Jenkins machines have avx2 support?

  13. caisq commented on Apr 18, 2016

    @caisq
    Contributor

    @vrv see updates above. They have Xeon CPUs, which aren't supposed to support either AVX or AVX2?But mavx build passes.

  14. vrv commented on Apr 18, 2016

    @vrv

    Which Xeon? AVX is pretty old, avx2 is relatively new -- I'd expect avx support on many machines but not avx2.

  15. caisq commented on Apr 18, 2016

    @caisq
    Contributor

    Just looked it up: The slaves we have in the particular GCE region have Ivy Bridge Xeon, which supports AVX but not AVX2. So this explains it.

  16. added a commit that references this issue on Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions