Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
8e609e5
Fix for NGRAPH_DISTRIBUTED (#413)
vishakha-nervana Dec 27, 2019
f75e9a2
sarkars/Decrease size of test and print error message (#416)
sayantan-nervana Dec 27, 2019
5b65448
Bani / Const Op handling for empty and shorter vector values NGTF-244…
bani-intelaipg Dec 27, 2019
9d03c31
Sarkars/Ops cherrypick from r19 (#396)
sayantan-nervana Dec 30, 2019
d85e9bc
sindhu/register backends (#392)
sindhu-nervana Dec 31, 2019
fa0d491
Kanvi/fused BMMT support (#404)
kanvi-nervana Dec 31, 2019
d2bb123
Kanvi/Make hello_tf bazel example fail in case of no backend (#397)
kanvi-nervana Jan 2, 2020
f090ce8
Vishakh1/round mode br (#353) (#418)
kanvi-nervana Jan 2, 2020
2a10214
sarkars/Fix int32-int64 issue. Removing convert op (#357) (#419)
kanvi-nervana Jan 3, 2020
8080379
mbubula/BatchMatMul fix (#387)
mbubula Jan 6, 2020
1712662
Remove proxy info from Dockerfile.ubuntu18.04 (#417)
ashahba Jan 7, 2020
0e694f1
sarkars/Add some utilities to reset the effect of M and A (#424)
sayantan-nervana Jan 7, 2020
81fbef4
Kanvi/create a dummy backend for testing (#420)
kanvi-nervana Jan 8, 2020
93dd641
sarkars/Move all maps (#422)
sayantan-nervana Jan 8, 2020
0c6bfc8
Kanvi/add missing unref (#425)
kanvi-nervana Jan 10, 2020
36107db
Jitendra/fix for mem leak (#428)
jitendra42 Jan 13, 2020
7ee3752
Merge remote-tracking branch 'origin/master' into shrestha/tag_rc3
Jan 14, 2020
c9c4254
shrestha/upgrade ngraph to v0.28.0-rc.0 (#427)
Jan 14, 2020
265d60a
Merge remote-tracking branch 'origin/master' into shrestha/tag_rc3
Jan 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ if (NOT USE_PRE_BUILT_NGRAPH)
ExternalProject_Add(
ext_ngraph
GIT_REPOSITORY https://github.com/NervanaSystems/ngraph
GIT_TAG v0.27.1-rc.1
GIT_TAG v0.28.0-rc.0
CMAKE_ARGS
-DNGRAPH_DISTRIBUTED_ENABLE=${NGRAPH_DISTRIBUTED_ENABLE}
-DNGRAPH_INSTALL_PREFIX=${NGRAPH_ARTIFACTS_DIR}
Expand All @@ -275,6 +275,9 @@ if (NOT USE_PRE_BUILT_NGRAPH)
endif()
set(NGRAPH_INSTALL_DIR ${NGRAPH_ARTIFACTS_DIR})

if(NGRAPH_BRIDGE_STATIC_LIB_ENABLE)
add_definitions(-DNGRAPH_BRIDGE_STATIC_LIB_ENABLE)
endif()

if(OS_VERSION STREQUAL "\"centos\"")
set(LIB "lib64")
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.22.0-rc1
git checkout v0.22.0-rc2

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

Expand Down
1 change: 1 addition & 0 deletions bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ cc_library(
"-Wno-strict-overflow",
'-D NGRAPH_BRIDGE_STATIC_LIB_ENABLE',
'-D NGRAPH_TF_USE_GRAPPLER_OPTIMIZER',
'-D NGRAPH_CPU_STATIC_LIB_ENABLE',
"-I ngraph_bridge",
"-I logging",
"-I external/ngraph/src",
Expand Down
8 changes: 4 additions & 4 deletions bazel/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ tf_workspace(path_prefix = "", tf_repo_name = "org_tensorflow")
http_archive(
name = "ngraph",
build_file = "//:bazel/ngraph.BUILD",
sha256 = "903991dfdb63304bc08bebab68e0fcb3e62690763b886c42178f363a0beb00f4",
strip_prefix = "ngraph-0.27.1-rc.1",
sha256 = "be59da1e04840b3980d3bcba7925b99ac2007e37e3952ef7c77caedba9734654",
strip_prefix = "ngraph-0.28.0-rc.0",
urls = [
"https://mirror.bazel.build/github.com/NervanaSystems/ngraph/archive/v0.27.1-rc.1.tar.gz",
"https://github.com/NervanaSystems/ngraph/archive/v0.27.1-rc.1.tar.gz"
"https://mirror.bazel.build/github.com/NervanaSystems/ngraph/archive/v0.28.0-rc.0.tar.gz",
"https://github.com/NervanaSystems/ngraph/archive/v0.28.0-rc.0.tar.gz"
],
)

Expand Down
10 changes: 7 additions & 3 deletions bazel/ngraph.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ cc_library(
"-fstack-protector-all",
'-D SHARED_LIB_PREFIX=\\"lib\\"',
'-D SHARED_LIB_SUFFIX=\\".so\\"',
'-D NGRAPH_VERSION=\\"v0.27.1-rc.1\\"',
'-D NGRAPH_VERSION=\\"v0.28.0-rc.0\\"',
"-D NGRAPH_DEX_ONLY",
'-D PROJECT_ROOT_DIR=\\"\\"',
'-D NGRAPH_STATIC_LIB_ENABLE',
'-D NGRAPH_DYNAMIC_COMPONENTS_ENABLE',
'-D NGRAPH_ENABLE_CPU_CONV_AUTO',
'-D NGRAPH_USE_LEGACY_MKLDNN',
"-march=native",
"-mtune=native",
"-Wall",
Expand Down Expand Up @@ -111,9 +112,10 @@ cc_library(
"-fstack-protector-all",
'-D SHARED_LIB_PREFIX=\\"lib\\"',
'-D SHARED_LIB_SUFFIX=\\".so\\"',
'-D NGRAPH_VERSION=\\"v0.27.1-rc.1\\"',
'-D NGRAPH_VERSION=\\"v0.28.0-rc.0\\"',
"-D NGRAPH_DEX_ONLY",
'-D PROJECT_ROOT_DIR=\\"\\"',
'-D NGRAPH_USE_LEGACY_MKLDNN',
] + CXX_ABI,
linkopts = [
"-Wl,-z,noexecstack",
Expand Down Expand Up @@ -166,6 +168,7 @@ cc_library(
"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/cum_sum.cpp",
"src/ngraph/runtime/cpu/builder/dot.cpp",
"src/ngraph/runtime/cpu/builder/dropout.cpp",
"src/ngraph/runtime/cpu/builder/embedding_lookup.cpp",
Expand Down Expand Up @@ -269,10 +272,11 @@ cc_library(
"-fstack-protector-all",
'-D SHARED_LIB_PREFIX=\\"lib\\"',
'-D SHARED_LIB_SUFFIX=\\".so\\"',
'-D NGRAPH_VERSION=\\"v0.27.1-rc.1\\"',
'-D NGRAPH_VERSION=\\"v0.28.0-rc.0\\"',
"-D NGRAPH_DEX_ONLY",
'-D PROJECT_ROOT_DIR=\\"\\"',
'-D NGRAPH_CPU_STATIC_LIB_ENABLE',
'-D NGRAPH_USE_LEGACY_MKLDNN=\\"TRUE\\"',
"-march=native",
"-mtune=native",
"-Wall",
Expand Down
3 changes: 2 additions & 1 deletion build_ngtf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def main():
'''

# Component versions
ngraph_version = "v0.27.1-rc.1"
ngraph_version = "v0.28.0-rc.0"
tf_version = "v1.14.0"

# Command line parser options
Expand Down Expand Up @@ -412,6 +412,7 @@ def main():

if (arguments.use_ngraph_staticlibs):
ngraph_tf_cmake_flags.extend(["-DNGRAPH_BRIDGE_STATIC_LIB_ENABLE=TRUE"])

if (arguments.debug_build):
ngraph_tf_cmake_flags.extend(["-DCMAKE_BUILD_TYPE=Debug"])

Expand Down
21 changes: 15 additions & 6 deletions examples/cpp/hello_tf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,20 @@
using namespace std;

// Prints the available backends
void PrintAvailableBackends() {
int PrintAvailableBackends() {
// Get the list of backends
auto supported_backends =
tensorflow::ngraph_bridge::BackendManager::GetSupportedBackendNames();
vector<string> backends(supported_backends.begin(), supported_backends.end());

cout << "Available backends: " << endl;
if (backends.empty()) {
std::cout << "No backend available " << std::endl;
return -1;
}
std::cout << "Available backends: " << std::endl;
for (auto& backend_name : backends) {
cout << "Backend: " << backend_name << std::endl;
std::cout << "Backend: " << backend_name << std::endl;
}
return 0;
}

// Create a simple computation graph and run
Expand Down Expand Up @@ -116,13 +120,18 @@ void PrintVersion() {
? std::string("Yes")
: std::string("No"))
<< std::endl;

PrintAvailableBackends();
std::cout << std::endl;
}

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

// Print the avialable backends and if none are available
// error out
if (PrintAvailableBackends()) {
return -1;
}

// Run a simple example
RunSimpleNetworkExample();

Expand Down
4 changes: 4 additions & 0 deletions examples/cpp/inference/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ if (APPLE)
add_definitions(-DTEST_SINGLE_INSTANCE)
endif()

if(NGRAPH_BRIDGE_STATIC_LIB_ENABLE)
add_definitions(-DNGRAPH_BRIDGE_STATIC_LIB_ENABLE)
endif()

if(NGRAPH_BRIDGE_STATIC_LIB_ENABLE)
target_link_libraries(${APP_NAME}
-Wl,--whole-archive
Expand Down
7 changes: 7 additions & 0 deletions examples/cpp/inference/infer_multiple_networks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ int main(int argc, char** argv) {
return -1;
}

// Register cpu backend for static linking
// [TODO]: Revisit this to see if we can remove registering here and register
// only in BackendManager.
#if defined(NGRAPH_BRIDGE_STATIC_LIB_ENABLE)
ngraph_register_cpu_backend();
#endif

const char* backend = "CPU";
if (SetNGraphBackend(backend) != tf::Status::OK()) {
std::cout << "Error: Cannot set the backend: " << backend << std::endl;
Expand Down
5 changes: 5 additions & 0 deletions examples/cpp/inference/infer_single_network.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ int main(int argc, char** argv) {
return -1;
}

// Register cpu backend for static linking
#if defined(NGRAPH_BRIDGE_STATIC_LIB_ENABLE)
ngraph_register_cpu_backend();
#endif

const char* backend = "CPU";
if (SetNGraphBackend(backend) != tf::Status::OK()) {
std::cout << "Error: Cannot set the backend: " << backend << std::endl;
Expand Down
12 changes: 12 additions & 0 deletions ngraph_bridge/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ if(NGRAPH_TF_ENABLE_VARIABLES_AND_OPTIMIZERS)
add_definitions(-DNGRAPH_TF_ENABLE_VARIABLES_AND_OPTIMIZERS)
endif()

if(NGRAPH_BRIDGE_STATIC_LIB_ENABLE)
add_definitions(-DNGRAPH_BRIDGE_STATIC_LIB_ENABLE)
endif()

if(NGRAPH_CPU_STATIC_LIB_ENABLE)
add_definitions(-DNGRAPH_CPU_STATIC_LIB_ENABLE)
endif()

if(NGRAPH_INTERPRETER_STATIC_LIB_ENABLE)
add_definitions(-DNGRAPH_INTERPRETER_STATIC_LIB_ENABLE)
endif()


if(NGRAPH_TF_USE_GRAPPLER_OPTIMIZER)
list(REMOVE_ITEM SRC ngraph_rewrite_pass.cc)
Expand Down
8 changes: 6 additions & 2 deletions ngraph_bridge/enable_variable_ops/ngraph_rewrite_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,12 @@ class NGraphEncapsulationPass : public NGraphRewritePass {

// 4. Encapsulate clusters then, if requested, dump the graphs.
FunctionDefLibrary* fdeflib_new = new FunctionDefLibrary();
TF_RETURN_IF_ERROR(EncapsulateClusters(options.graph->get(), idx,
fdeflib_new, config_map, {0, {}}));
auto status = EncapsulateClusters(options.graph->get(), idx, fdeflib_new,
config_map, {0, {}});
if (status != Status::OK()) {
delete (fdeflib_new);
return status;
}
// TODO: not using fdeflib_new in this path. Only grappler path uses it
free(fdeflib_new);
if (DumpEncapsulatedGraphs()) {
Expand Down
10 changes: 7 additions & 3 deletions ngraph_bridge/grappler/ngraph_optimizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,13 @@ Status NgraphOptimizer::Optimize(tensorflow::grappler::Cluster* cluster,

// 4. Encapsulate clusters then, if requested, dump the graphs.
FunctionDefLibrary* fdeflib_new = new FunctionDefLibrary();
TF_RETURN_IF_ERROR(
// TODO: right now _ngraph_aot_requested is passed along in config_map.
EncapsulateClusters(&graph, idx, fdeflib_new, config_map, aot_info));
// TODO: right now _ngraph_aot_requested is passed along in config_map.
auto status =
EncapsulateClusters(&graph, idx, fdeflib_new, config_map, aot_info);
if (status != Status::OK()) {
delete (fdeflib_new);
return status;
}
if (DumpEncapsulatedGraphs()) {
DumpGraphs(graph, idx, "encapsulated", "Graph with Clusters Encapsulated");
}
Expand Down
4 changes: 4 additions & 0 deletions ngraph_bridge/ngraph_assign_clusters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,10 @@ Status GetNodeCluster(const Node* node, int* cluster) {
return s;
}

void ResetAssignClusters(Graph* graph) {
ClearAttribute(graph, {"_ngraph_cluster"});
}

} // namespace ngraph_bridge

} // namespace tensorflow
2 changes: 2 additions & 0 deletions ngraph_bridge/ngraph_assign_clusters.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ namespace tensorflow {
namespace ngraph_bridge {

Status AssignClusters(Graph* graph);
// reset the effect of AssignClusters
void ResetAssignClusters(Graph* graph);
Status GetNodeCluster(const Node* node, int* cluster);

} // namespace ngraph_bridge
Expand Down
22 changes: 22 additions & 0 deletions ngraph_bridge/ngraph_backend_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ Status BackendManager::SetBackendName(const string& backend_name) {
}

Status BackendManager::CreateBackend(const string& backend_name) {
// Register backends for static linking
#if defined(NGRAPH_CPU_STATIC_LIB_ENABLE)
ngraph_register_cpu_backend();
#endif
#if defined(NGRAPH_INTERPRETER_STATIC_LIB_ENABLE)
ngraph_register_interpreter_backend();
#endif

std::lock_guard<std::mutex> lock(BackendManager::ng_backend_map_mutex_);
auto itr = BackendManager::ng_backend_map_.find(backend_name);
// if backend does not exist create it
Expand Down Expand Up @@ -126,10 +134,24 @@ void BackendManager::UnlockBackend(const string& backend_name) {

// Returns the nGraph supported backend names
vector<string> BackendManager::GetSupportedBackendNames() {
// Register backends for static linking
#if defined(NGRAPH_CPU_STATIC_LIB_ENABLE)
ngraph_register_cpu_backend();
#endif
#if defined(NGRAPH_INTERPRETER_STATIC_LIB_ENABLE)
ngraph_register_interpreter_backend();
#endif
return ng::runtime::BackendManager::get_registered_backends();
}

size_t BackendManager::GetNumOfSupportedBackends() {
// Register backends for static linking
#if defined(NGRAPH_CPU_STATIC_LIB_ENABLE)
ngraph_register_cpu_backend();
#endif
#if defined(NGRAPH_INTERPRETER_STATIC_LIB_ENABLE)
ngraph_register_interpreter_backend();
#endif
return ng::runtime::BackendManager::get_registered_backends().size();
}

Expand Down
Loading