Skip to content

Commit

Permalink
Merge pull request #237 from tensorflow/Kanvi/Upgrade_ng_core
Browse files Browse the repository at this point in the history
Kanvi/upgrade ng core
  • Loading branch information
avijit-nervana authored Sep 13, 2019
2 parents c1010ff + 48a8be8 commit 99b49ba
Show file tree
Hide file tree
Showing 39 changed files with 511 additions and 250 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ if (NOT USE_PRE_BUILT_NGRAPH)
ExternalProject_Add(
ext_ngraph
GIT_REPOSITORY https://github.com/NervanaSystems/ngraph
GIT_TAG v0.25.1-rc.0
GIT_TAG v0.25.1-rc.2
CMAKE_ARGS
-DNGRAPH_DISTRIBUTED_ENABLE=${NGRAPH_DISTRIBUTED_ENABLE}
-DNGRAPH_INSTALL_PREFIX=${NGRAPH_ARTIFACTS_DIR}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Once TensorFlow's dependencies are installed, clone the `ngraph-bridge` repo:

git clone https://github.com/tensorflow/ngraph-bridge.git
cd ngraph-bridge
git checkout v0.19.0-rc0
git checkout v0.19.0-rc1

Run the following Python script to build TensorFlow, nGraph, and the bridge. Use Python 3.5:

Expand Down
58 changes: 46 additions & 12 deletions bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
# limitations under the License.
# ==============================================================================
load("//:cxx_abi_option.bzl", "CXX_ABI")
load(
"@org_tensorflow//tensorflow:tensorflow.bzl",
"tf_cc_binary")

cc_library(
name = "ngraph_bridge_headers",
Expand Down Expand Up @@ -47,22 +50,22 @@ cc_library(
"logging/tf_graph_writer.h",
]),
copts = [
"-I external/ngraph_bridge/src",
"-I external/ngraph_bridge/logging",
"-I external/ngraph/src",
"-I logging",
],
visibility = ["//visibility:public"],
)

cc_binary(
name = 'libngraph_bridge.so',
cc_library(
name = 'ngraph_bridge_lib',
srcs = [
"ngraph_bridge/ngraph_api.cc",
"ngraph_bridge/ngraph_assign_clusters.cc",
"ngraph_bridge/ngraph_assign_clusters.h",
"ngraph_bridge/ngraph_builder.cc",
"ngraph_bridge/ngraph_backend_manager.cc",
"ngraph_bridge/ngraph_capture_variables.cc",
"ngraph_bridge/ngraph_cluster_manager.cc",
"ngraph_bridge/ngraph_conversions.cc",
"ngraph_bridge/ngraph_deassign_clusters.cc",
"ngraph_bridge/ngraph_encapsulate_clusters.cc",
"ngraph_bridge/ngraph_encapsulate_impl.cc",
Expand All @@ -76,17 +79,20 @@ cc_binary(
"ngraph_bridge/ngraph_utils.cc",
"ngraph_bridge/tf_deadness_analysis.cc",
"ngraph_bridge/tf_graphcycles.cc",
"ngraph_bridge/ops/ngraph_ops.cc",
"ngraph_bridge/version.cc",
"ngraph_bridge/grappler/ngraph_optimizer.cc",
"ngraph_bridge/grappler/ngraph_add_identityn.cc",
"logging/ngraph_log.cc",
"logging/tf_graph_writer.cc",
],
linkshared = 1,
deps = [
":ngraph_bridge_headers",
"@local_config_tf//:libtensorflow_framework",
"@local_config_tf//:tf_header_lib",
"@org_tensorflow//tensorflow/core:core_cpu_headers_lib",
"@org_tensorflow//tensorflow/core/grappler/clusters:cluster",
"@org_tensorflow//tensorflow/core/grappler/optimizers:custom_graph_optimizer_registry",
"@org_tensorflow//tensorflow/core:framework_headers_lib",
"@org_tensorflow//tensorflow/core:protos_all_cc",
"@ngraph//:ngraph_headers",
"@ngraph//:ngraph_core",
"@ngraph//:ngraph_version",
Expand All @@ -97,18 +103,46 @@ cc_binary(
"-D_FORTIFY_SOURCE=2",
"-Wformat",
"-Wformat-security",
"-Wformat",
"-fstack-protector-all",
"-D NDEBUG",
'-D SHARED_LIB_PREFIX=\\"lib\\"',
'-D SHARED_LIB_SUFFIX=\\".so\\"',
'-D NGRAPH_BRIDGE_STATIC_LIB_ENABLE',
'-D NGRAPH_TF_USE_GRAPPLER_OPTIMIZER',
"-I ngraph_bridge",
"-I logging",
"-I external/ngraph/src",
] + CXX_ABI,
linkstatic = True,
linkopts = [
"-Wl,-z,noexecstack",
"-Wl,-z,relro",
"-Wl,-z,now",
],
visibility = ["//visibility:public"],
alwayslink = 1,
)

tf_cc_binary(
name = 'hello_tf',
srcs = [
"examples/cpp/hello_tf.cpp",
],
deps = [
"@org_tensorflow//tensorflow/cc:client_session",
"@org_tensorflow//tensorflow/cc:ops",
"@org_tensorflow//tensorflow/core:tensorflow",
":ngraph_bridge_lib",
"@ngraph//:cpu_backend",
],
copts = [
"-pthread",
"-std=c++11",
"-D_FORTIFY_SOURCE=2",
"-Wformat",
"-Wformat-security",
"-fstack-protector-all",
"-I ngraph_bridge",
"-I external/ngraph/src",
"-I logging",
] + CXX_ABI,
linkstatic=True,
visibility = ["//visibility:public"],
)
56 changes: 43 additions & 13 deletions bazel/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,51 @@
# ==============================================================================

workspace(name = "ngraph_bridge")
load("@//tf_configure:tf_configure.bzl", "tf_configure")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

load("@//tf_configure:tf_configure.bzl", "tf_configure")
tf_configure(
name = "local_config_tf",
)

# TensorFlow depends on "io_bazel_rules_closure" so we need this here.
# Needs to be kept in sync with the same target in TensorFlow's WORKSPACE file.
http_archive(
name = "io_bazel_rules_closure",
sha256 = "5b00383d08dd71f28503736db0500b6fb4dda47489ff5fc6bed42557c07c6ba9",
strip_prefix = "rules_closure-308b05b2419edb5c8ee0471b67a40403df940149",
urls = [
"https://storage.googleapis.com/mirror.tensorflow.org/github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz",
"https://github.com/bazelbuild/rules_closure/archive/308b05b2419edb5c8ee0471b67a40403df940149.tar.gz", # 2019-06-13
],
)

http_archive(
name = "bazel_skylib",
sha256 = "2ef429f5d7ce7111263289644d233707dba35e39696377ebab8b0bc701f7818e",
urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/0.8.0/bazel-skylib.0.8.0.tar.gz"],
)

http_archive(
name = "org_tensorflow",
sha256 = "aa2a6a1daafa3af66807cfe0bc77bfe1144a9a53df9a96bab52e3e575b3047ed",
strip_prefix = "tensorflow-1.14.0",
urls = [
"http://mirror.tensorflow.org/github.com/tensorflow/tensorflow/archive/v1.14.0.tar.gz",
"https://github.com/tensorflow/tensorflow/archive/v1.14.0.tar.gz",
],
)
load("@org_tensorflow//tensorflow:workspace.bzl", "tf_workspace")
tf_workspace(path_prefix = "", tf_repo_name = "org_tensorflow")

http_archive(
name = "ngraph",
build_file = "//:bazel/ngraph.BUILD",
sha256 = "030a0c22a098a958e1856b7930bdd7d1694ec882b61de3108afa8e59ff960e42",
strip_prefix = "ngraph-0.25.1-rc.0",
sha256 = "d3e0ebf807dd4179c91a41c80639b75f5ea8ca39cdfe3a5697da56a7df894f11",
strip_prefix = "ngraph-0.25.1-rc.2",
urls = [
"https://mirror.bazel.build/github.com/NervanaSystems/ngraph/archive/v0.25.1-rc.0.tar.gz",
"https://github.com/NervanaSystems/ngraph/archive/v0.25.1-rc.0.tar.gz"
"https://mirror.bazel.build/github.com/NervanaSystems/ngraph/archive/v0.25.1-rc.2.tar.gz",
"https://github.com/NervanaSystems/ngraph/archive/v0.25.1-rc.2.tar.gz"
],
)

Expand Down Expand Up @@ -69,21 +99,21 @@ http_archive(
http_archive(
name = "mkl_dnn",
build_file = "//:bazel/mkl_dnn.BUILD",
sha256 = "38a1c02104ee9f630c1ad68164119cd58ad0aaf59e04ccbe7bd5781add7bfbea",
strip_prefix = "mkl-dnn-0.18",
sha256 = "1ae0e8a1a3df58deadc08ca0a01f8d3720600b26ca9e53685493e8e8250243b2",
strip_prefix = "mkl-dnn-0.20.2",
urls = [
"http://mirror.tensorflow.org/github.com/intel/mkl-dnn/archive/v0.18.tar.gz",
"https://github.com/intel/mkl-dnn/archive/v0.18.tar.gz",
"http://mirror.tensorflow.org/github.com/intel/mkl-dnn/archive/v0.20.2.tar.gz",
"https://github.com/intel/mkl-dnn/archive/v0.20.2.tar.gz",
],
)

http_archive(
name = "mkl_linux",
build_file = "//:bazel/mkl.BUILD",
sha256 = "f4129843d5c2996419f96f10928edd02b2150998861a088dc7cfa1b6a058102a",
strip_prefix = "mklml_lnx_2019.0.3.20190220",
sha256 = "a936d6b277a33d2a027a024ea8e65df62bd2e162c7ca52c48486ed9d5dc27160",
strip_prefix = "mklml_lnx_2019.0.5.20190502",
urls = [
"http://mirror.tensorflow.org/github.com/intel/mkl-dnn/releases/download/v0.18/mklml_lnx_2019.0.3.20190220.tgz",
"https://github.com/intel/mkl-dnn/releases/download/v0.18/mklml_lnx_2019.0.3.20190220.tgz",
"http://mirror.tensorflow.org/github.com/intel/mkl-dnn/releases/download/v0.20/mklml_lnx_2019.0.5.20190502.tgz",
"https://github.com/intel/mkl-dnn/releases/download/v0.20/mklml_lnx_2019.0.5.20190502.tgz",
],
)
8 changes: 6 additions & 2 deletions bazel/mkl_dnn.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ template_rule(
out = "include/mkldnn_version.h",
substitutions = {
"@MKLDNN_VERSION_MAJOR@": "0",
"@MKLDNN_VERSION_MINOR@": "18",
"@MKLDNN_VERSION_PATCH@": "0",
"@MKLDNN_VERSION_MINOR@": "20",
"@MKLDNN_VERSION_PATCH@": "2",
"@MKLDNN_VERSION_HASH@": "N/A",
},
)
Expand All @@ -61,6 +61,8 @@ cc_library(
"src/cpu/*.hpp",
"src/cpu/gemm/*.cpp",
"src/cpu/gemm/*.hpp",
"src/cpu/gemm/bf16/*.hpp",
"src/cpu/gemm/bf16/*.cpp",
"src/cpu/gemm/f32/*.cpp",
"src/cpu/gemm/f32/*.hpp",
"src/cpu/gemm/s8x8s32/*.cpp",
Expand Down Expand Up @@ -111,6 +113,8 @@ cc_library(
"src/cpu/*.hpp",
"src/cpu/gemm/*.cpp",
"src/cpu/gemm/*.hpp",
"src/cpu/gemm/bf16/*.hpp",
"src/cpu/gemm/bf16/*.cpp",
"src/cpu/gemm/f32/*.cpp",
"src/cpu/gemm/f32/*.hpp",
"src/cpu/gemm/s8x8s32/*.cpp",
Expand Down
Loading

0 comments on commit 99b49ba

Please sign in to comment.