使用SYCL

时间:2017-06-12 02:21:44

标签: tensorflow opencl ubuntu-16.04

我通过跟随https://www.codeplay.com/portal/03-30-17-setting-up-tensorflow-with-opencl-using-sycl在Ubuntu 16.04 / AMD RX480上使用SYCL设置TensorFlow,并且由于fglrx版本冲突而跳过安装AMD OpenCL标头。

然后,在以下时失败:

  1. 运行:$ bazel test --config = sycl -k --test_timeout 1600 - // tensorflow / ... - // tensorflow / contrib / ... - // tensorflow / java / ... - // tensorflow / compiler /...
  2. 返回:     /home/ai/.cache/bazel/_bazel_ai/03759b09788dc48db1c2f1f857f3711b/execroot/tensorflow-opencl/bazel-out/local_linux-opt/testlogs/tensorflow/go/test/test.log

    Executed 1 out of 634 tests: 84 tests pass, 549 fail to build and 1 fails locally.
    There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.
    

    test.log显示:

    [[ ! -x go ]]
    [[ -x /usr/local/go/bin/go ]]
    export
    PATH=.:/home/opt/anaconda2/envs/sycl/bin:/home/opt/anaconda2/bin:/home/opt/OpenSource/torch/install/bin:/home/opt/OpenSource/torch/install/bin:/home/ai/bin:/home/ai/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/usr/local/go/bin
    
    PATH=.:/home/opt/anaconda2/envs/sycl/bin:/home/opt/anaconda2/bin:/home/opt/OpenSource/torch/install/bin:/home/opt/OpenSource/torch/install/bin:/home/ai/bin:/home/ai/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/usr/local/go/bin
    export
    GOPATH=/home/ai/.cache/bazel/_bazel_ai/03759b09788dc48db1c2f1f857f3711b/execroot/tensorflow-opencl/_tmp/3e13e1018d21b8204dd1d98027854067/go
    
    GOPATH=/home/ai/.cache/bazel/_bazel_ai/03759b09788dc48db1c2f1f857f3711b/execroot/tensorflow-opencl/_tmp/3e13e1018d21b8204dd1d98027854067/go
    mkdir -p
    /home/ai/.cache/bazel/_bazel_ai/03759b09788dc48db1c2f1f857f3711b/execroot/tensorflow-opencl/_tmp/3e13e1018d21b8204dd1d98027854067/go/src/github.com/tensorflow
    ln -s
    /home/ai/.cache/bazel/_bazel_ai/03759b09788dc48db1c2f1f857f3711b/execroot/tensorflow-opencl/bazel-out/local_linux-opt/bin/tensorflow/go/test.runfiles/org_tensorflow
    /home/ai/.cache/bazel/_bazel_ai/03759b09788dc48db1c2f1f857f3711b/execroot/tensorflow-opencl/_tmp/3e13e1018d21b8204dd1d98027854067/go/src/github.com/tensorflow/tensorflow
    export
    LIBRARY_PATH=/home/ai/.cache/bazel/_bazel_ai/03759b09788dc48db1c2f1f857f3711b/execroot/tensorflow-opencl/bazel-out/local_linux-opt/bin/tensorflow/go/test.runfiles/org_tensorflow/tensorflow
    
    LIBRARY_PATH=/home/ai/.cache/bazel/_bazel_ai/03759b09788dc48db1c2f1f857f3711b/execroot/tensorflow-opencl/bazel-out/local_linux-opt/bin/tensorflow/go/test.runfiles/org_tensorflow/tensorflow
    ++ uname -s
    OS=Linux
    [[ Linux = \L\i\n\u\x ]]
    [[ -z
    /usr/local/computecpp/lib:/home/opt/OpenSource/torch/install/lib:/home/opt/OpenSource/torch/install/lib:  
    ]]
    export
    LD_LIBRARY_PATH=/home/ai/.cache/bazel/_bazel_ai/03759b09788dc48db1c2f1f857f3711b/execroot/tensorflow-opencl/bazel-out/local_linux-opt/bin/tensorflow/go/test.runfiles/org_tensorflow/tensorflow:/usr/local/computecpp/lib:/home/opt/OpenSource/torch/install/lib:/home/opt/OpenSource/torch/install/lib:
    
    LD_LIBRARY_PATH=/home/ai/.cache/bazel/_bazel_ai/03759b09788dc48db1c2f1f857f3711b/execroot/tensorflow-opencl/bazel-out/local_linux-opt/bin/tensorflow/go/test.runfiles/org_tensorflow/tensorflow:/usr/local/computecpp/lib:/home/opt/OpenSource/torch/install/lib:/home/opt/OpenSource/torch/install/lib:
    ++ go version
    echo 'Go version: go version go1.7.4 linux/amd64'
    Go version: go version go1.7.4 linux/amd64
    go test github.com/tensorflow/tensorflow/tensorflow/go
    github.com/tensorflow/tensorflow/tensorflow/go/op
    github.com/tensorflow/tensorflow/tensorflow/go
    /home/ai/.cache/bazel/_bazel_ai/03759b09788dc48db1c2f1f857f3711b/execroot/tensorflow-opencl/bazel-out/local_linux-opt/bin/tensorflow/go/test.runfiles/org_tensorflow/tensorflow/libtensorflow.so: undefined reference to cl::sycl::program::create_program_for_kernel_impl(std::string, unsigned char const*, int, char const* const*, std::shared_ptr<cl::sycl::detail::context>)
    /home/ai/.cache/bazel/_bazel_ai/03759b09788dc48db1c2f1f857f3711b/execroot/tensorflow-opencl/bazel-out/local_linux-opt/bin/tensorflow/go/test.runfiles/org_tensorflow/tensorflow/libtensorflow.so: undefined reference to cl::sycl::program::get_kernel_impl(std::string)
    const
    collect2: error: ld returned 1 exit status # github.com/tensorflow/tensorflow/tensorflow/go
    /home/ai/.cache/bazel/_bazel_ai/03759b09788dc48db1c2f1f857f3711b/execroot/tensorflow-opencl/bazel-out/local_linux-opt/bin/tensorflow/go/test.runfiles/org_tensorflow/tensorflow/libtensorflow.so: undefined reference to cl::sycl::program::create_program_for_kernel_impl(std::string, unsigned char const*, int, char const* const*, std::shared_ptr<cl::sycl::detail::context>)
    /home/ai/.cache/bazel/_bazel_ai/03759b09788dc48db1c2f1f857f3711b/execroot/tensorflow-opencl/bazel-out/local_linux-opt/bin/tensorflow/go/test.runfiles/org_tensorflow/tensorflow/libtensorflow.so: undefined reference to cl::sycl::program::get_kernel_impl(std::string)
    const
    collect2: error: ld returned 1 exit status
    FAIL    github.com/tensorflow/tensorflow/tensorflow/go [build failed]
    FAIL    github.com/tensorflow/tensorflow/tensorflow/go/op [build failed]
    
    1. 或正在运行:$ bazel build --local_resources 2048,.5,1.0 -c opt --config = sycl // tensorflow / tools / pip_package:build_pip_package
    2. 返回:

      /home/opt/OpenSource/TensorFlow/tensorflow-opencl/tensorflow/compiler/xla/service/BUILD:108:1: C++ compilation of rule '//tensorflow/compiler/xla/service:versioned_computation_handle' failed: computecpp failed: error executing command external/local_config_sycl/crosstool/computecpp -Wall -msse3 -g0 -O2 -DNDEBUG '-std=c++11' -MD -MF ... (remaining 103 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
      In file included from
      tensorflow/compiler/xla/service/versioned_computation_handle.cc:16:0:
      ./tensorflow/compiler/xla/service/versioned_computation_handle.h:33:19: error:  
      expected type-specifier before 'int64'
          using Version = int64;
      
      ./tensorflow/compiler/xla/service/versioned_computation_handle.h:36:3:  
      error: Version does not name a type
          Version version;
      
      ./tensorflow/compiler/xla/service/versioned_computation_handle.h:38:3:  
      error: string does not name a type
          string ToString() const;
      
      ./tensorflow/compiler/xla/service/versioned_computation_handle.h: In member function bool xla::VersionedComputationHandle::operator==(const
      xla::VersionedComputationHandle&) const:
      ./tensorflow/compiler/xla/service/versioned_computation_handle.h:41:13: error:  
      version was not declared in this scope
                   (version == other.version);
      
      ./tensorflow/compiler/xla/service/versioned_computation_handle.h:41:30: error:  
      const struct xla::VersionedComputationHandle has no member named version
                   (version == other.version);
      
      ./tensorflow/compiler/xla/service/versioned_computation_handle.h: In member function bool xla::VersionedComputationHandle::operator<(const
      xla::VersionedComputationHandle&) cons':
      ./tensorflow/compiler/xla/service/versioned_computation_handle.h:46:15: error:  
      version was not declared in this scope
                     (version < other.version)));
      
      ./tensorflow/compiler/xla/service/versioned_computation_handle.h:46:31: error:  
      'const struct xla::VersionedComputationHandle' has no member named version
                     (version < other.version)));
      
      tensorflow/compiler/xla/service/versioned_computation_handle.cc: At global scope:
      tensorflow/compiler/xla/service/versioned_computation_handle.cc:22:1:  
      error: string does not name a type
        string VersionedComputationHandle::ToString() const {
      
      tensorflow/compiler/xla/service/versioned_computation_handle.cc: In function std::ostream& xla::operator<<(std::ostream&, const
      xla::VersionedComputationHandle&):
      tensorflow/compiler/xla/service/versioned_computation_handle.cc:28:27:  
      error: const struct xla::VersionedComputationHandle has no member named ToString out << versioned_handle.ToString();
      

      此外,我的CPU和GPU看起来都没有经过测试&#34;根据computecpp_info计算CPP。

1 个答案:

答案 0 :(得分:0)

要克服第一个错误,请尝试-//tensorflow/go/... - 我们还没有尝试使用go包装器。

XLA错误令人困惑,因为在crosstool脚本中我们明确避免使用ComputeCpp(https://github.com/lukeiwanski/tensorflow/blob/dev/eigen_mehdi/third_party/sycl/crosstool/computecpp.tpl#L46)编译“compiler”文件夹。

确保您在此分支:https://github.com/lukeiwanski/tensorflow/tree/dev/eigen_mehdi