Guest User

Untitled

a guest
Dec 12th, 2017
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.72 KB | None | 0 0
  1. #from tensorflow/tensorflow/compiler/aot/tests
  2. python3 ./make_test_graphs.py --out_dir=./
  3.  
  4. bazel build --config=opt --config=cuda --verbose_failures --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0" //tensorflow/compiler/aot/tests:my_binary
  5.  
  6. package(default_visibility = ["//visibility:public"])
  7.  
  8. #define EIGEN_USE_THREADS
  9. #define EIGEN_USE_CUSTOM_THREAD_POOL
  10.  
  11. #include <iostream>
  12. #include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor"
  13. #include "tensorflow/compiler/aot/tests/test_graph_tfmatmul.h" // generated
  14.  
  15. int main(int argc, char** argv) {
  16. Eigen::ThreadPool tp(2); // Size the thread pool as appropriate.
  17. Eigen::ThreadPoolDevice device(&tp, tp.NumThreads());
  18.  
  19. foo::bar::MatMulComp matmul;
  20. matmul.set_thread_pool(&device);
  21.  
  22. // Set up args and run the computation.
  23. const float args[12] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
  24. std::copy(args + 0, args + 6, matmul.arg0_data());
  25. std::copy(args + 6, args + 12, matmul.arg1_data());
  26. matmul.Run();
  27.  
  28. // Check result
  29. if (matmul.result0(0, 0) == 58) {
  30. std::cout << "Success" << std::endl;
  31. } else {
  32. std::cout << "Failed. Expected value 58 at 0,0. Got:"
  33. << matmul.result0(0, 0) << std::endl;
  34. }
  35.  
  36. return 0;
  37. }
  38.  
  39. # Example of linking your binary
  40. # Also see //third_party/tensorflow/compiler/aot/tests/BUILD
  41. load("//tensorflow/compiler/aot:tfcompile.bzl", "tf_library")
  42.  
  43. # The same tf_library call from step 2 above.
  44. tf_library(
  45. name = "test_graph_tfmatmul",
  46. cpp_class = "foo::bar::MatMulComp",
  47. graph = "test_graph_tfmatmul.pb",
  48. config = "test_graph_tfmatmul.config.pbtxt",
  49. )
  50.  
  51. # The executable code generated by tf_library can then be linked into your code.
  52. cc_binary(
  53. name = "my_binary",
  54. srcs = [
  55. "my_code.cc", # include test_graph_tfmatmul.h to access the generated header
  56. ],
  57. deps = [
  58. ":test_graph_tfmatmul", # link in the generated object file
  59. "//tensorflow/compiler/tf2xla",
  60. "//tensorflow/compiler/tf2xla:common",
  61. "//tensorflow/compiler/tf2xla:tf2xla_proto",
  62. "//tensorflow/compiler/tf2xla:tf2xla_util",
  63. "//tensorflow/compiler/tf2xla:xla_compiler",
  64. "//tensorflow/compiler/tf2xla/kernels:xla_cpu_only_ops",
  65. "//tensorflow/compiler/tf2xla/kernels:xla_ops",
  66. "//tensorflow/compiler/xla:shape_util",
  67. "//tensorflow/compiler/xla:statusor",
  68. "//tensorflow/compiler/xla:util",
  69. "//tensorflow/compiler/xla:xla_data_proto",
  70. "//tensorflow/compiler/xla/client:client_library",
  71. "//tensorflow/compiler/xla/client:compile_only_client",
  72. "//tensorflow/compiler/xla/service:compiler",
  73. "//tensorflow/compiler/xla/service/cpu:cpu_compiler",
  74. "//tensorflow/core:core_cpu",
  75. "//tensorflow/core:core_cpu_internal",
  76. "//tensorflow/core:framework",
  77. "//tensorflow/core:framework_internal",
  78. "//tensorflow/core:lib",
  79. "//tensorflow/core:protos_all_cc",
  80. "//tensorflow/compiler/tf2xla:xla_compiled_cpu_function",
  81. "//third_party/eigen3",
  82. ],
  83. linkopts = [
  84. "-lpthread",
  85. ]
  86. )
  87.  
  88. Loading:
  89. Loading: 0 packages loaded
  90. INFO: Analysed target //tensorflow/compiler/aot/tests:my_binary (0 packages loaded).
  91. INFO: Found 1 target...
  92. [0 / 2] BazelWorkspaceStatusAction stable-status.txt
  93. [1 / 2] Linking tensorflow/compiler/aot/tests/my_binary; 1s local
  94. ERROR: /home/m2angus/tensorflow/tensorflow/compiler/aot/tests/BUILD:14:1: Linking of rule '//tensorflow/compiler/aot/tests:my_binary' failed (Exit 1): crosstool_wrapper_driver_is_not_gcc failed: error executing command
  95. (cd /home/m2angus/.cache/bazel/_bazel_m2angus/5e7d70ea4881ca91d8032ed9fd943ff8/execroot/org_tensorflow &&
  96. exec env -
  97. CUDA_TOOLKIT_PATH=/usr/local/cuda
  98. CUDNN_INSTALL_PATH=/usr/local/cuda-8.0
  99. GCC_HOST_COMPILER_PATH=/usr/bin/gcc
  100. PWD=/proc/self/cwd
  101. PYTHON_BIN_PATH=/usr/bin/python3
  102. PYTHON_LIB_PATH=/usr/local/lib/python3.5/dist-packages
  103. TF_CUDA_CLANG=0
  104. TF_CUDA_COMPUTE_CAPABILITIES=6.1
  105. TF_CUDA_VERSION=8.0
  106. TF_CUDNN_VERSION=6
  107. TF_NEED_CUDA=1
  108. TF_NEED_OPENCL=0
  109. external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc -o bazel-out/k8-py3-opt/bin/tensorflow/compiler/aot/tests/my_binary '-Wl,-rpath,$ORIGIN/../../../../_solib_local/_U@local_Uconfig_Ucuda_S_Scuda_Ccudart___Uexternal_Slocal_Uconfig_Ucuda_Scuda_Scuda_Slib' -Lbazel-out/k8-py3-opt/bin/_solib_local/_U@local_Uconfig_Ucuda_S_Scuda_Ccudart___Uexternal_Slocal_Uconfig_Ucuda_Scuda_Scuda_Slib -pthread -Wl,-rpath,../local_config_cuda/cuda/lib64 -Wl,-rpath,../local_config_cuda/cuda/extras/CUPTI/lib64 -Wl,-no-as-needed -B/usr/bin/ -pie -Wl,-z,relro,-z,now -no-canonical-prefixes -pass-exit-codes '-Wl,--build-id=md5' '-Wl,--hash-style=gnu' -Wl,--gc-sections -Wl,@bazel-out/k8-py3-opt/bin/tensorflow/compiler/aot/tests/my_binary-2.params)
  110. bazel-out/k8-py3-opt/bin/tensorflow/compiler/tf2xla/kernels/libgather_op_kernel_float_int32.lo(gather_op_kernel_float_int32.o): In function `gather_float_int32_xla_impl':
  111. gather_op_kernel_float_int32.cc:(.text.gather_float_int32_xla_impl+0x0): multiple definition of `gather_float_int32_xla_impl'
  112. bazel-out/k8-py3-opt/bin/external/org_tensorflow/tensorflow/compiler/tf2xla/kernels/libgather_op_kernel_float_int32.lo(gather_op_kernel_float_int32.o):gather_op_kernel_float_int32.cc:(.text.gather_float_int32_xla_impl+0x0): first defined here
  113. bazel-out/k8-py3-opt/bin/tensorflow/compiler/tf2xla/kernels/libgather_op_kernel_float_int64.lo(gather_op_kernel_float_int64.o): In function `gather_float_int64_xla_impl':
  114. gather_op_kernel_float_int64.cc:(.text.gather_float_int64_xla_impl+0x0): multiple definition of `gather_float_int64_xla_impl'
  115. bazel-out/k8-py3-opt/bin/external/org_tensorflow/tensorflow/compiler/tf2xla/kernels/libgather_op_kernel_float_int64.lo(gather_op_kernel_float_int64.o):gather_op_kernel_float_int64.cc:(.text.gather_float_int64_xla_impl+0x0): first defined here
  116. bazel-out/k8-py3-opt/bin/tensorflow/compiler/tf2xla/kernels/libindex_ops_kernel_argmax_float_1d.lo(index_ops_kernel_argmax_float_1d.o): In function `argmax_float_1d_xla_impl':
  117. index_ops_kernel_argmax_float_1d.cc:(.text.argmax_float_1d_xla_impl+0x0): multiple definition of `argmax_float_1d_xla_impl'
  118. bazel-out/k8-py3-opt/bin/external/org_tensorflow/tensorflow/compiler/tf2xla/kernels/libindex_ops_kernel_argmax_float_1d.lo(index_ops_kernel_argmax_float_1d.o):index_ops_kernel_argmax_float_1d.cc:(.text.argmax_float_1d_xla_impl+0x0): first defined here
  119. bazel-out/k8-py3-opt/bin/tensorflow/compiler/tf2xla/kernels/libindex_ops_kernel_argmax_float_2d.lo(index_ops_kernel_argmax_float_2d.o): In function `argmax_float_2d_xla_impl':
  120. index_ops_kernel_argmax_float_2d.cc:(.text.argmax_float_2d_xla_impl+0x0): multiple definition of `argmax_float_2d_xla_impl'
  121. bazel-out/k8-py3-opt/bin/external/org_tensorflow/tensorflow/compiler/tf2xla/kernels/libindex_ops_kernel_argmax_float_2d.lo(index_ops_kernel_argmax_float_2d.o):index_ops_kernel_argmax_float_2d.cc:(.text.argmax_float_2d_xla_impl+0x0): first defined here
  122. bazel-out/k8-py3-opt/bin/tensorflow/compiler/tf2xla/kernels/libxla_cpu_only_ops.lo(index_ops_cpu.o): In function `tensorflow::(anonymous namespace)::ArgMaxCustomCallOp::~ArgMaxCustomCallOp()':
  123. index_ops_cpu.cc:(.text._ZN10tensorflow12_GLOBAL__N_118ArgMaxCustomCallOpD2Ev+0x10): undefined reference to `tensorflow::OpKernel::~OpKernel()'
  124. bazel-out/k8-py3-opt/bin/tensorflow/compiler/tf2xla/kernels/libxla_cpu_only_ops.lo(index_ops_cpu.o): In function `tensorflow::(anonymous namespace)::ArgMaxCustomCallOp::~ArgMaxCustomCallOp()':
  125. index_ops_cpu.cc:(.text._ZN10tensorflow12_GLOBAL__N_118ArgMaxCustomCallOpD0Ev+0x17): undefined reference to `tensorflow::OpKernel::~OpKernel()'
  126. bazel-out/k8-py3-opt/bin/tensorflow/compiler/tf2xla/kernels/libxla_cpu_only_ops.lo(index_ops_cpu.o): In function `tensorflow::Status tensorflow::errors::InvalidArgument<char const*>(char const*)':
  127. index_ops_cpu.cc:(.text._ZN10tensorflow6errors15InvalidArgumentIJPKcEEENS_6StatusEDpT_[_ZN10tensorflow6errors15InvalidArgumentIJPKcEEENS_6StatusEDpT_]+0x34): undefined reference to `tensorflow::strings::StrCat(tensorflow::strings::AlphaNum const&)'
  128. index_ops_cpu.cc:(.text._ZN10tensorflow6errors15InvalidArgumentIJPKcEEENS_6StatusEDpT_[_ZN10tensorflow6errors15InvalidArgumentIJPKcEEENS_6StatusEDpT_]+0x49): undefined reference to `tensorflow::Status::Status(tensorflow::error::Code, tensorflow::StringPiece)'
  129. ....
  130. sendrecv_ops.cc:(.text.startup._Z41__static_initialization_and_destruction_0ii.constprop.9+0x3a9): undefined reference to `tensorflow::register_op::OpDefBuilderReceiver::OpDefBuilderReceiver(tensorflow::register_op::OpDefBuilderWrapper<true> const&)'
  131. collect2: error: ld returned 1 exit status
  132. Target //tensorflow/compiler/aot/tests:my_binary failed to build
  133. INFO: Elapsed time: 10.513s, Critical Path: 10.10s
  134. FAILED: Build did NOT complete successfully
Add Comment
Please, Sign In to add comment