Skip to content

Commit 1604421

Browse files
author
Shrestha Malik
authored
Merge pull request #434 from tensorflow/shrestha/tag_rc3
Shrestha/merge master
2 parents 64e85a3 + 265d60a commit 1604421

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2234
-1067
lines changed

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ if (NOT USE_PRE_BUILT_NGRAPH)
248248
ExternalProject_Add(
249249
ext_ngraph
250250
GIT_REPOSITORY https://github.com/NervanaSystems/ngraph
251-
GIT_TAG v0.27.1-rc.1
251+
GIT_TAG v0.28.0-rc.0
252252
CMAKE_ARGS
253253
-DNGRAPH_DISTRIBUTED_ENABLE=${NGRAPH_DISTRIBUTED_ENABLE}
254254
-DNGRAPH_INSTALL_PREFIX=${NGRAPH_ARTIFACTS_DIR}
@@ -275,6 +275,9 @@ if (NOT USE_PRE_BUILT_NGRAPH)
275275
endif()
276276
set(NGRAPH_INSTALL_DIR ${NGRAPH_ARTIFACTS_DIR})
277277

278+
if(NGRAPH_BRIDGE_STATIC_LIB_ENABLE)
279+
add_definitions(-DNGRAPH_BRIDGE_STATIC_LIB_ENABLE)
280+
endif()
278281

279282
if(OS_VERSION STREQUAL "\"centos\"")
280283
set(LIB "lib64")

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Once TensorFlow's dependencies are installed, clone the `ngraph-bridge` repo:
8888

8989
git clone https://github.com/tensorflow/ngraph-bridge.git
9090
cd ngraph-bridge
91-
git checkout v0.22.0-rc1
91+
git checkout v0.22.0-rc2
9292

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

bazel/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ cc_library(
134134
"-Wno-strict-overflow",
135135
'-D NGRAPH_BRIDGE_STATIC_LIB_ENABLE',
136136
'-D NGRAPH_TF_USE_GRAPPLER_OPTIMIZER',
137+
'-D NGRAPH_CPU_STATIC_LIB_ENABLE',
137138
"-I ngraph_bridge",
138139
"-I logging",
139140
"-I external/ngraph/src",

bazel/WORKSPACE

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ tf_workspace(path_prefix = "", tf_repo_name = "org_tensorflow")
5555
http_archive(
5656
name = "ngraph",
5757
build_file = "//:bazel/ngraph.BUILD",
58-
sha256 = "903991dfdb63304bc08bebab68e0fcb3e62690763b886c42178f363a0beb00f4",
59-
strip_prefix = "ngraph-0.27.1-rc.1",
58+
sha256 = "be59da1e04840b3980d3bcba7925b99ac2007e37e3952ef7c77caedba9734654",
59+
strip_prefix = "ngraph-0.28.0-rc.0",
6060
urls = [
61-
"https://mirror.bazel.build/github.com/NervanaSystems/ngraph/archive/v0.27.1-rc.1.tar.gz",
62-
"https://github.com/NervanaSystems/ngraph/archive/v0.27.1-rc.1.tar.gz"
61+
"https://mirror.bazel.build/github.com/NervanaSystems/ngraph/archive/v0.28.0-rc.0.tar.gz",
62+
"https://github.com/NervanaSystems/ngraph/archive/v0.28.0-rc.0.tar.gz"
6363
],
6464
)
6565

bazel/ngraph.BUILD

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,13 @@ cc_library(
6868
"-fstack-protector-all",
6969
'-D SHARED_LIB_PREFIX=\\"lib\\"',
7070
'-D SHARED_LIB_SUFFIX=\\".so\\"',
71-
'-D NGRAPH_VERSION=\\"v0.27.1-rc.1\\"',
71+
'-D NGRAPH_VERSION=\\"v0.28.0-rc.0\\"',
7272
"-D NGRAPH_DEX_ONLY",
7373
'-D PROJECT_ROOT_DIR=\\"\\"',
7474
'-D NGRAPH_STATIC_LIB_ENABLE',
7575
'-D NGRAPH_DYNAMIC_COMPONENTS_ENABLE',
7676
'-D NGRAPH_ENABLE_CPU_CONV_AUTO',
77+
'-D NGRAPH_USE_LEGACY_MKLDNN',
7778
"-march=native",
7879
"-mtune=native",
7980
"-Wall",
@@ -111,9 +112,10 @@ cc_library(
111112
"-fstack-protector-all",
112113
'-D SHARED_LIB_PREFIX=\\"lib\\"',
113114
'-D SHARED_LIB_SUFFIX=\\".so\\"',
114-
'-D NGRAPH_VERSION=\\"v0.27.1-rc.1\\"',
115+
'-D NGRAPH_VERSION=\\"v0.28.0-rc.0\\"',
115116
"-D NGRAPH_DEX_ONLY",
116117
'-D PROJECT_ROOT_DIR=\\"\\"',
118+
'-D NGRAPH_USE_LEGACY_MKLDNN',
117119
] + CXX_ABI,
118120
linkopts = [
119121
"-Wl,-z,noexecstack",
@@ -166,6 +168,7 @@ cc_library(
166168
"src/ngraph/runtime/cpu/builder/convert.cpp",
167169
"src/ngraph/runtime/cpu/builder/convert_layout.cpp",
168170
"src/ngraph/runtime/cpu/builder/convolution.cpp",
171+
"src/ngraph/runtime/cpu/builder/cum_sum.cpp",
169172
"src/ngraph/runtime/cpu/builder/dot.cpp",
170173
"src/ngraph/runtime/cpu/builder/dropout.cpp",
171174
"src/ngraph/runtime/cpu/builder/embedding_lookup.cpp",
@@ -269,10 +272,11 @@ cc_library(
269272
"-fstack-protector-all",
270273
'-D SHARED_LIB_PREFIX=\\"lib\\"',
271274
'-D SHARED_LIB_SUFFIX=\\".so\\"',
272-
'-D NGRAPH_VERSION=\\"v0.27.1-rc.1\\"',
275+
'-D NGRAPH_VERSION=\\"v0.28.0-rc.0\\"',
273276
"-D NGRAPH_DEX_ONLY",
274277
'-D PROJECT_ROOT_DIR=\\"\\"',
275278
'-D NGRAPH_CPU_STATIC_LIB_ENABLE',
279+
'-D NGRAPH_USE_LEGACY_MKLDNN=\\"TRUE\\"',
276280
"-march=native",
277281
"-mtune=native",
278282
"-Wall",

build_ngtf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def main():
5353
'''
5454

5555
# Component versions
56-
ngraph_version = "v0.27.1-rc.1"
56+
ngraph_version = "v0.28.0-rc.0"
5757
tf_version = "v1.14.0"
5858

5959
# Command line parser options
@@ -412,6 +412,7 @@ def main():
412412

413413
if (arguments.use_ngraph_staticlibs):
414414
ngraph_tf_cmake_flags.extend(["-DNGRAPH_BRIDGE_STATIC_LIB_ENABLE=TRUE"])
415+
415416
if (arguments.debug_build):
416417
ngraph_tf_cmake_flags.extend(["-DCMAKE_BUILD_TYPE=Debug"])
417418

examples/cpp/hello_tf.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,20 @@
3535
using namespace std;
3636

3737
// Prints the available backends
38-
void PrintAvailableBackends() {
38+
int PrintAvailableBackends() {
3939
// Get the list of backends
4040
auto supported_backends =
4141
tensorflow::ngraph_bridge::BackendManager::GetSupportedBackendNames();
4242
vector<string> backends(supported_backends.begin(), supported_backends.end());
43-
44-
cout << "Available backends: " << endl;
43+
if (backends.empty()) {
44+
std::cout << "No backend available " << std::endl;
45+
return -1;
46+
}
47+
std::cout << "Available backends: " << std::endl;
4548
for (auto& backend_name : backends) {
46-
cout << "Backend: " << backend_name << std::endl;
49+
std::cout << "Backend: " << backend_name << std::endl;
4750
}
51+
return 0;
4852
}
4953

5054
// Create a simple computation graph and run
@@ -116,13 +120,18 @@ void PrintVersion() {
116120
? std::string("Yes")
117121
: std::string("No"))
118122
<< std::endl;
119-
120-
PrintAvailableBackends();
123+
std::cout << std::endl;
121124
}
122125

123126
int main(int argc, char** argv) {
124127
PrintVersion();
125128

129+
// Print the avialable backends and if none are available
130+
// error out
131+
if (PrintAvailableBackends()) {
132+
return -1;
133+
}
134+
126135
// Run a simple example
127136
RunSimpleNetworkExample();
128137

examples/cpp/inference/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ if (APPLE)
6161
add_definitions(-DTEST_SINGLE_INSTANCE)
6262
endif()
6363

64+
if(NGRAPH_BRIDGE_STATIC_LIB_ENABLE)
65+
add_definitions(-DNGRAPH_BRIDGE_STATIC_LIB_ENABLE)
66+
endif()
67+
6468
if(NGRAPH_BRIDGE_STATIC_LIB_ENABLE)
6569
target_link_libraries(${APP_NAME}
6670
-Wl,--whole-archive

examples/cpp/inference/infer_multiple_networks.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ int main(int argc, char** argv) {
164164
return -1;
165165
}
166166

167+
// Register cpu backend for static linking
168+
// [TODO]: Revisit this to see if we can remove registering here and register
169+
// only in BackendManager.
170+
#if defined(NGRAPH_BRIDGE_STATIC_LIB_ENABLE)
171+
ngraph_register_cpu_backend();
172+
#endif
173+
167174
const char* backend = "CPU";
168175
if (SetNGraphBackend(backend) != tf::Status::OK()) {
169176
std::cout << "Error: Cannot set the backend: " << backend << std::endl;

examples/cpp/inference/infer_single_network.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ int main(int argc, char** argv) {
160160
return -1;
161161
}
162162

163+
// Register cpu backend for static linking
164+
#if defined(NGRAPH_BRIDGE_STATIC_LIB_ENABLE)
165+
ngraph_register_cpu_backend();
166+
#endif
167+
163168
const char* backend = "CPU";
164169
if (SetNGraphBackend(backend) != tf::Status::OK()) {
165170
std::cout << "Error: Cannot set the backend: " << backend << std::endl;

0 commit comments

Comments
 (0)