diff options
author | avijit-nervana <avijit.chakraborty@intel.com> | 2018-08-22 23:34:34 -0700 |
---|---|---|
committer | avijit-nervana <avijit.chakraborty@intel.com> | 2018-08-22 23:34:34 -0700 |
commit | 52d3e5a3a7bece06da072dcfb3f4ac53e83f8470 (patch) | |
tree | 62cac513c160aa6d9583c97e53a53f9d7449fb0d | |
parent | b425b0ed272a28ccb6dbc3d3ab937da257b7f02d (diff) |
Added the BUILD files for tbb and updated the ngraph.BUILD with
CPU library (DEX).
-rw-r--r-- | WORKSPACE | 7 | ||||
-rw-r--r-- | tensorflow/workspace.bzl | 29 | ||||
-rw-r--r-- | third_party/ngraph/ngraph.BUILD | 109 | ||||
-rw-r--r-- | third_party/ngraph/ngraph_tf.BUILD | 11 | ||||
-rw-r--r-- | third_party/ngraph/tbb.BUILD | 52 |
5 files changed, 188 insertions, 20 deletions
@@ -79,3 +79,10 @@ new_http_archive( "http://download.tensorflow.org/models/speech_commands_v0.01.zip", ], ) + +new_local_repository( + name = "ngraph", + path = "/nfs/site/home/avijitch/workspace/tf-upstream/ngraph", + build_file = "//third_party/ngraph:ngraph.BUILD", +) + diff --git a/tensorflow/workspace.bzl b/tensorflow/workspace.bzl index 5d90d0fe64..951cb8a89d 100644 --- a/tensorflow/workspace.bzl +++ b/tensorflow/workspace.bzl @@ -833,15 +833,26 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""): ) tf_http_archive( - name = "ngraph", - urls = [ - "https://mirror.bazel.build/github.com/NervanaSystems/ngraph/archive/v0.5.0.tar.gz", - "https://github.com/NervanaSystems/ngraph/archive/v0.5.0.tar.gz", - ], - sha256 = "cb35d3d98836f615408afd18371fb13e3400711247e0d822ba7f306c45e9bb2c", - strip_prefix = "ngraph-0.5.0", - build_file = clean_dep("//third_party/ngraph:ngraph.BUILD"), - ) + name = "tbb", + urls = [ + "https://mirror.bazel.build/github.com/01org/tbb/archive/tbb_2018.zip", + "https://github.com/01org/tbb/archive/tbb_2018.zip", + ], + sha256 = "724686f90bcda78f13b76f297d964008737ccd6399328143c1c0093e73ae6a13", + strip_prefix = "tbb-tbb_2018", + build_file = clean_dep("//third_party/ngraph:tbb.BUILD"), + ) + + # tf_http_archive( + # name = "ngraph", + # urls = [ + # "https://mirror.bazel.build/github.com/NervanaSystems/ngraph/archive/v0.5.0.tar.gz", + # "https://github.com/NervanaSystems/ngraph/archive/v0.5.0.tar.gz", + # ], + # sha256 = "cb35d3d98836f615408afd18371fb13e3400711247e0d822ba7f306c45e9bb2c", + # strip_prefix = "ngraph-0.5.0", + # build_file = clean_dep("//third_party/ngraph:ngraph.BUILD"), + # ) tf_http_archive( name = "nlohmann_json_lib", diff --git a/third_party/ngraph/ngraph.BUILD b/third_party/ngraph/ngraph.BUILD index 31aa3cee51..f1cf8acbf6 100644 --- a/third_party/ngraph/ngraph.BUILD +++ b/third_party/ngraph/ngraph.BUILD @@ -3,6 +3,112 @@ licenses(["notice"]) # 3-Clause BSD exports_files(["LICENSE"]) cc_library( + name = "ngraph_headers", + hdrs = glob(["src/ngraph/**/*.hpp"]) , + visibility = ["//visibility:public"], +) + +cc_library( + name = "ngraph_cpu_backend", + srcs = [ + "src/ngraph/runtime/cpu/cpu_backend.cpp", + "src/ngraph/runtime/cpu/cpu_builder.cpp", + "src/ngraph/runtime/cpu/cpu_call_frame.cpp", + "src/ngraph/runtime/cpu/cpu_external_function.cpp", + "src/ngraph/runtime/cpu/cpu_kernels.cpp", + "src/ngraph/runtime/cpu/cpu_layout_descriptor.cpp", + "src/ngraph/runtime/cpu/cpu_tensor_view_wrapper.cpp", + "src/ngraph/runtime/cpu/cpu_tensor_view.cpp", + "src/ngraph/runtime/cpu/cpu_tracing.cpp", + "src/ngraph/runtime/cpu/builder/add.cpp", + "src/ngraph/runtime/cpu/builder/allreduce.cpp", + "src/ngraph/runtime/cpu/builder/avg_pool.cpp", + "src/ngraph/runtime/cpu/builder/argmin.cpp", + "src/ngraph/runtime/cpu/builder/argmax.cpp", + "src/ngraph/runtime/cpu/builder/batch_norm.cpp", + "src/ngraph/runtime/cpu/builder/broadcast.cpp", + "src/ngraph/runtime/cpu/builder/bounded_relu.cpp", + "src/ngraph/runtime/cpu/builder/concat.cpp", + "src/ngraph/runtime/cpu/builder/convert.cpp", + "src/ngraph/runtime/cpu/builder/convert_layout.cpp", + "src/ngraph/runtime/cpu/builder/convolution.cpp", + "src/ngraph/runtime/cpu/builder/dot.cpp", + "src/ngraph/runtime/cpu/builder/function_call.cpp", + "src/ngraph/runtime/cpu/builder/lstm.cpp", + "src/ngraph/runtime/cpu/builder/lrn.cpp", + "src/ngraph/runtime/cpu/builder/matmul_bias.cpp", + "src/ngraph/runtime/cpu/builder/max.cpp", + "src/ngraph/runtime/cpu/builder/max_pool.cpp", + "src/ngraph/runtime/cpu/builder/min.cpp", + "src/ngraph/runtime/cpu/builder/one_hot.cpp", + "src/ngraph/runtime/cpu/builder/relu.cpp", + "src/ngraph/runtime/cpu/builder/pad.cpp", + "src/ngraph/runtime/cpu/builder/product.cpp", + "src/ngraph/runtime/cpu/builder/reduce_function.cpp", + "src/ngraph/runtime/cpu/builder/reduce_function_window.cpp", + "src/ngraph/runtime/cpu/builder/replace_slice.cpp", + "src/ngraph/runtime/cpu/builder/reshape.cpp", + "src/ngraph/runtime/cpu/builder/reverse.cpp", + "src/ngraph/runtime/cpu/builder/reverse_sequence.cpp", + "src/ngraph/runtime/cpu/builder/rnn.cpp", + "src/ngraph/runtime/cpu/builder/select.cpp", + "src/ngraph/runtime/cpu/builder/select_and_scatter.cpp", + "src/ngraph/runtime/cpu/builder/sigmoid.cpp", + "src/ngraph/runtime/cpu/builder/slice.cpp", + "src/ngraph/runtime/cpu/builder/softmax.cpp", + "src/ngraph/runtime/cpu/builder/sum.cpp", + "src/ngraph/runtime/cpu/kernel/eigen_thread_pool.cpp", + "src/ngraph/runtime/cpu/kernel/pad.cpp", + "src/ngraph/runtime/cpu/kernel/reduce_max.cpp", + "src/ngraph/runtime/cpu/kernel/reduce_sum.cpp", + "src/ngraph/runtime/cpu/kernel/reshape.cpp", + "src/ngraph/runtime/cpu/mkldnn_emitter.cpp", + "src/ngraph/runtime/cpu/mkldnn_invoke.cpp", + "src/ngraph/runtime/cpu/mkldnn_utils.cpp", + "src/ngraph/runtime/cpu/op/batch_dot.cpp", + "src/ngraph/runtime/cpu/op/batch_norm_relu.cpp", + "src/ngraph/runtime/cpu/op/bounded_relu.cpp", + "src/ngraph/runtime/cpu/op/group_conv.cpp", + "src/ngraph/runtime/cpu/op/conv_bias.cpp", + "src/ngraph/runtime/cpu/op/conv_relu.cpp", + "src/ngraph/runtime/cpu/op/convert_layout.cpp", + "src/ngraph/runtime/cpu/op/loop_kernel.cpp", + "src/ngraph/runtime/cpu/op/lstm.cpp", + "src/ngraph/runtime/cpu/op/matmul_bias.cpp", + "src/ngraph/runtime/cpu/op/max_pool_with_indices.cpp", + "src/ngraph/runtime/cpu/op/rnn.cpp", + "src/ngraph/runtime/cpu/op/sigmoid_mul.cpp", + "src/ngraph/runtime/cpu/pass/cpu_assignment.cpp", + "src/ngraph/runtime/cpu/pass/cpu_collapse_dims.cpp", + "src/ngraph/runtime/cpu/pass/cpu_concat_inputs.cpp", + "src/ngraph/runtime/cpu/pass/cpu_fusion.cpp", + "src/ngraph/runtime/cpu/pass/cpu_layout.cpp", + "src/ngraph/runtime/cpu/pass/cpu_loop_kernel_fusion.cpp", + "src/ngraph/runtime/cpu/pass/cpu_mat_fusion.cpp", + "src/ngraph/runtime/cpu/pass/cpu_post_layout_optimizations.cpp", + "src/ngraph/runtime/cpu/pass/cpu_rnn_fusion.cpp", + "src/ngraph/runtime/cpu/pass/cpu_workspace_insertion.cpp", + ], + hdrs = glob(["src/ngraph/runtime/cpu/**/*.hpp"]) + glob([]), + deps = [ + ":ngraph_headers", + "@eigen_archive//:eigen", + "@nlohmann_json_lib", + "@tbb", + "@mkl_dnn//:mkl_dnn", + ], + copts = [ + "-I external/ngraph/src", + "-I external/nlohmann_json_lib/include/", + '-D SHARED_LIB_EXT=\\".so\\"', + '-D NGRAPH_VERSION=\\"0.5.0\\"', + '-D NGRAPH_DEX_ONLY', + ], + visibility = ["//visibility:public"], + alwayslink = 1, +) + +cc_library( name = "ngraph_core", srcs = glob([ "src/ngraph/*.cpp", @@ -21,8 +127,9 @@ cc_library( "src/ngraph/runtime/interpreter/*.cpp", "src/ngraph/runtime/interpreter/*.hpp", ]), - hdrs = glob(["src/ngraph/**/*.hpp"]), deps = [ + ":ngraph_headers", + ":ngraph_cpu_backend", "@eigen_archive//:eigen", "@nlohmann_json_lib", ], diff --git a/third_party/ngraph/ngraph_tf.BUILD b/third_party/ngraph/ngraph_tf.BUILD index 4d96ccf2f2..0647d9926a 100644 --- a/third_party/ngraph/ngraph_tf.BUILD +++ b/third_party/ngraph/ngraph_tf.BUILD @@ -8,15 +8,6 @@ load( ) cc_library( - name = "ngraph_libs_linux", - srcs = [ - "lib/libiomp5.so", - "lib/libmklml_intel.so", - ], - visibility = ["//visibility:public"], -) - -cc_library( name = "ngraph_tf", srcs = [ "src/ngraph_builder.h", @@ -58,7 +49,7 @@ cc_library( "-I external/ngraph_tf/src", "-I external/ngraph_tf/logging", "-I external/ngraph/src", - "-D NGRAPH_EMBEDDED_IN_TENSORFLOW=1", + #"-D NGRAPH_EMBEDDED_IN_TENSORFLOW=1", ], alwayslink = 1, visibility = ["//visibility:public"], diff --git a/third_party/ngraph/tbb.BUILD b/third_party/ngraph/tbb.BUILD new file mode 100644 index 0000000000..c3e7f7fd35 --- /dev/null +++ b/third_party/ngraph/tbb.BUILD @@ -0,0 +1,52 @@ +licenses(["notice"]) # 3-Clause BSD + +exports_files(["LICENSE"]) + +genrule( + name = "build_tbb", + srcs = glob(["**"]) + [ + "@local_config_cc//:toolchain", + ], + cmd = """ + set -e + WORK_DIR=$$PWD + DEST_DIR=$$PWD/$(@D) + export PATH=$$(dirname $(AR)):$$PATH + export CXXFLAGS=$(CC_FLAGS) + export NM=$(NM) + export AR=$(AR) + cd $$(dirname $(location :Makefile)) + + #TBB's build needs some help to figure out what compiler it's using + if $$CXX --version | grep clang &> /dev/null; then + COMPILER_OPT="compiler=clang" + else + COMPILER_OPT="compiler=gcc" + fi + + # uses extra_inc=big_iron.inc to specify that static libraries are + # built. See https://software.intel.com/en-us/forums/intel-threading-building-blocks/topic/297792 + make tbb_build_prefix="build" \ + extra_inc=big_iron.inc \ + $$COMPILER_OPT; \ + + echo cp build/build_{release,debug}/*.a $$DEST_DIR + cp build/build_{release,debug}/*.a $$DEST_DIR + cd $$WORK_DIR + """, + outs = [ + "libtbb.a", + "libtbbmalloc.a", + ] +) + +cc_library( + name = "tbb", + hdrs = glob([ + "include/serial/**", + "include/tbb/**/**", + ]), + srcs = ["libtbb.a"], + includes = ["include"], + visibility = ["//visibility:public"], +)
\ No newline at end of file |