From 71aa4e65ef65e74e16034f95bcd66a98332adc97 Mon Sep 17 00:00:00 2001 From: Anthony Platanios Date: Mon, 21 Aug 2017 17:10:49 -0400 Subject: [PATCH] Eager API inclusion to the dynamic library build target (#12399) * Exposed and included the eager tensor execution C API to the TensorFlow dynamic library. * Updated BUILD to fix the sorting issue. --- tensorflow/BUILD | 2 + tensorflow/c/eager/BUILD | 76 +++++++++++++++++++------------ tensorflow/c/exported_symbols.lds | 1 + 3 files changed, 50 insertions(+), 29 deletions(-) diff --git a/tensorflow/BUILD b/tensorflow/BUILD index f34fcb23ca9..4dc84889137 100644 --- a/tensorflow/BUILD +++ b/tensorflow/BUILD @@ -473,6 +473,7 @@ cc_binary( "//tensorflow/c:c_api", "//tensorflow/c:exported_symbols.lds", "//tensorflow/c:version_script.lds", + "//tensorflow/c/eager:c_api", "//tensorflow/core:tensorflow", ], ) @@ -482,6 +483,7 @@ cc_binary( linkshared = 1, deps = [ "//tensorflow/c:c_api", + "//tensorflow/c/eager:c_api", "//tensorflow/cc:cc_ops", "//tensorflow/cc:client_session", "//tensorflow/cc:scope", diff --git a/tensorflow/c/eager/BUILD b/tensorflow/c/eager/BUILD index 112eea0b409..85c4e4fd93c 100644 --- a/tensorflow/c/eager/BUILD +++ b/tensorflow/c/eager/BUILD @@ -1,28 +1,39 @@ # Experimental extensions to the C API for eager execution of kernels. licenses(["notice"]) # Apache 2.0 -cc_library( +load( + "//tensorflow:tensorflow.bzl", + "tf_cc_test", + "tf_copts", + "tf_cuda_library", +) + +tf_cuda_library( name = "c_api", srcs = ["c_api.cc"], hdrs = ["c_api.h"], - visibility = [ - "//tensorflow:internal", - "//tensorflow/python/eager:__pkg__", - ], - deps = [ - ":runtime", - "//tensorflow/c:c_api", - "//tensorflow/c:c_api_internal", - "//tensorflow/core:core_cpu_internal", - "//tensorflow/core:framework", - "//tensorflow/core:framework_internal", - "//tensorflow/core:lib", - "//tensorflow/core:lib_internal", - "//tensorflow/core:protos_all_cc", - ], + copts = tf_copts(), + visibility = ["//visibility:public"], + deps = select({ + "//tensorflow:android": [ + ":c_api_internal", + "//tensorflow/core:android_tensorflow_lib_lite", + ], + "//conditions:default": [ + ":runtime", + "//tensorflow/c:c_api", + "//tensorflow/c:c_api_internal", + "//tensorflow/core:core_cpu_internal", + "//tensorflow/core:framework", + "//tensorflow/core:framework_internal", + "//tensorflow/core:lib", + "//tensorflow/core:lib_internal", + "//tensorflow/core:protos_all_cc", + ], + }), ) -cc_test( +tf_cc_test( name = "c_api_test", srcs = ["c_api_test.cc"], deps = [ @@ -34,24 +45,31 @@ cc_test( ], ) -cc_library( +tf_cuda_library( name = "runtime", srcs = ["runtime.cc"], hdrs = ["runtime.h"], + copts = tf_copts(), visibility = ["//tensorflow:internal"], - deps = [ - "//tensorflow/c:c_api", - "//tensorflow/core:core_cpu", - "//tensorflow/core:core_cpu_internal", - "//tensorflow/core:framework", - "//tensorflow/core:framework_internal", - "//tensorflow/core:lib", - "//tensorflow/core:lib_internal", - "//tensorflow/core:protos_all_cc", - ], + deps = select({ + "//tensorflow:android": [ + ":c_api_internal", + "//tensorflow/core:android_tensorflow_lib_lite", + ], + "//conditions:default": [ + "//tensorflow/c:c_api", + "//tensorflow/core:core_cpu", + "//tensorflow/core:core_cpu_internal", + "//tensorflow/core:framework", + "//tensorflow/core:framework_internal", + "//tensorflow/core:lib", + "//tensorflow/core:lib_internal", + "//tensorflow/core:protos_all_cc", + ], + }), ) -cc_test( +tf_cc_test( name = "runtime_test", srcs = ["runtime_test.cc"], deps = [ diff --git a/tensorflow/c/exported_symbols.lds b/tensorflow/c/exported_symbols.lds index a14bdaa48be..41f0637c99c 100644 --- a/tensorflow/c/exported_symbols.lds +++ b/tensorflow/c/exported_symbols.lds @@ -1 +1,2 @@ _TF_* +_TFE_*