diff --git a/bazel/BUILD b/bazel/BUILD index 8e8cc859a..e30eef426 100644 --- a/bazel/BUILD +++ b/bazel/BUILD @@ -23,7 +23,6 @@ cc_library( "ngraph_bridge/ngraph_builder.h", "ngraph_bridge/ngraph_backend_config.h", "ngraph_bridge/ngraph_backend_manager.h", - "ngraph_bridge/ngraph_bridge_registry.h", "ngraph_bridge/ngraph_capture_variables.h", "ngraph_bridge/ngraph_cluster_manager.h", "ngraph_bridge/ngraph_conversions.h", @@ -62,7 +61,6 @@ cc_binary( "ngraph_bridge/ngraph_assign_clusters.h", "ngraph_bridge/ngraph_builder.cc", "ngraph_bridge/ngraph_backend_manager.cc", - "ngraph_bridge/ngraph_bridge_registry.cc", "ngraph_bridge/ngraph_capture_variables.cc", "ngraph_bridge/ngraph_cluster_manager.cc", "ngraph_bridge/ngraph_deassign_clusters.cc", diff --git a/examples/cpp/infer_multiple_networks/CMakeLists.txt b/examples/cpp/infer_multiple_networks/CMakeLists.txt index ab4f123d5..cde84970f 100644 --- a/examples/cpp/infer_multiple_networks/CMakeLists.txt +++ b/examples/cpp/infer_multiple_networks/CMakeLists.txt @@ -60,9 +60,10 @@ if (APPLE) endif() if(NGRAPH_BRIDGE_STATIC_LIB_ENABLE) - target_link_libraries( - infer_multiple_networks - ngraph_bridge_static + target_link_libraries(infer_multiple_networks + -Wl,--whole-archive + ngraph_bridge_static + -Wl,--no-whole-archive ngraph_lib lib_cpu_backend_static lib_interpreter_backend_static diff --git a/examples/cpp/infer_single/CMakeLists.txt b/examples/cpp/infer_single/CMakeLists.txt index 99567f951..49f607350 100644 --- a/examples/cpp/infer_single/CMakeLists.txt +++ b/examples/cpp/infer_single/CMakeLists.txt @@ -58,8 +58,10 @@ if (APPLE) endif() if(NGRAPH_BRIDGE_STATIC_LIB_ENABLE) - target_link_libraries( - infer_single ngraph_bridge_static + target_link_libraries(infer_single + -Wl,--whole-archive + ngraph_bridge_static + -Wl,--no-whole-archive ngraph_lib lib_cpu_backend_static lib_interpreter_backend_static diff --git a/ngraph_bridge/CMakeLists.txt b/ngraph_bridge/CMakeLists.txt index 0f8312bab..79b665d79 100644 --- a/ngraph_bridge/CMakeLists.txt +++ b/ngraph_bridge/CMakeLists.txt @@ -36,7 +36,6 @@ set(SRC ngraph_assign_clusters.cc ngraph_builder.cc ngraph_backend_manager.cc - ngraph_bridge_registry.cc ngraph_capture_variables.cc ngraph_cluster_manager.cc ngraph_conversions.cc @@ -147,7 +146,6 @@ if(NGRAPH_BRIDGE_STATIC_LIB_ENABLE) target_link_libraries( ${LIB_NAME_STATIC} - ngraph_logger ngraph_logger ${TensorFlow_FRAMEWORK_LIBRARY} ngraph_lib diff --git a/ngraph_bridge/enable_variable_ops/ops/ngraph_ops.cc b/ngraph_bridge/enable_variable_ops/ops/ngraph_ops.cc index 866d4cbb2..7b97b87d4 100644 --- a/ngraph_bridge/enable_variable_ops/ops/ngraph_ops.cc +++ b/ngraph_bridge/enable_variable_ops/ops/ngraph_ops.cc @@ -16,8 +16,6 @@ #include "tensorflow/core/common_runtime/optimization_registry.h" -#include "ngraph_bridge/ngraph_bridge_registry.h" - namespace tensorflow { namespace ngraph_bridge { @@ -101,9 +99,5 @@ REGISTER_OP("NGraphVariable") .SetIsStateful() .SetShapeFn(shape_inference::ExplicitShape); -#ifdef NGRAPH_BRIDGE_STATIC_LIB_ENABLE -void register_ngraph_enable_variable_ops() {} -#endif - } // namespace ngraph_bridge -} // namespace tensorflow \ No newline at end of file +} // namespace tensorflow diff --git a/ngraph_bridge/ngraph_bridge_registry.cc b/ngraph_bridge/ngraph_bridge_registry.cc deleted file mode 100644 index 2d1b7858e..000000000 --- a/ngraph_bridge/ngraph_bridge_registry.cc +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright 2019 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ - -#include "ngraph_bridge/ngraph_bridge_registry.h" - -namespace tensorflow { - -namespace ngraph_bridge { - -// Dummy function for bridge specific ops -// so when built static, the linker will include -// all the object files which it would not do normally. -#ifdef NGRAPH_BRIDGE_STATIC_LIB_ENABLE -void register_ngraph_bridge() { -#ifdef NGRAPH_TF_ENABLE_VARIABLES_AND_OPTIMIZERS - register_ngraph_enable_variable_ops(); -#else - register_ngraph_ops(); -#endif -} -#endif -} -} diff --git a/ngraph_bridge/ngraph_bridge_registry.h b/ngraph_bridge/ngraph_bridge_registry.h deleted file mode 100644 index 5e2a49589..000000000 --- a/ngraph_bridge/ngraph_bridge_registry.h +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright 2019 Intel Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *******************************************************************************/ -#pragma once - -namespace tensorflow { - -namespace ngraph_bridge { - -// Created a dummy function for bridge specific ops -// so when built static, the linker will include -// all the object files which it would not do normally. -#ifdef NGRAPH_BRIDGE_STATIC_LIB_ENABLE -void register_ngraph_bridge(); -#if defined(NGRAPH_TF_ENABLE_VARIABLES_AND_OPTIMIZERS) -void register_ngraph_enable_variable_ops(); -#else -void register_ngraph_ops(); -#endif -#endif -} -} \ No newline at end of file diff --git a/ngraph_bridge/ngraph_encapsulate_clusters.cc b/ngraph_bridge/ngraph_encapsulate_clusters.cc index fcc076c65..022da98f3 100644 --- a/ngraph_bridge/ngraph_encapsulate_clusters.cc +++ b/ngraph_bridge/ngraph_encapsulate_clusters.cc @@ -39,7 +39,6 @@ #include "logging/tf_graph_writer.h" #include "ngraph_bridge/ngraph_api.h" #include "ngraph_bridge/ngraph_assign_clusters.h" -#include "ngraph_bridge/ngraph_bridge_registry.h" #include "ngraph_bridge/ngraph_builder.h" #include "ngraph_bridge/ngraph_cluster_manager.h" #include "ngraph_bridge/ngraph_encapsulate_clusters.h" @@ -100,11 +99,6 @@ Status EncapsulateClusters( // A map from cluster indices to corresponding NGraphEncapsulate nodes. std::map cluster_node_map; -// reference all the bridge ops for static library -#ifdef NGRAPH_BRIDGE_STATIC_LIB_ENABLE - register_ngraph_bridge(); -#endif - // Pass 1: Populate the cluster-index-to-device name map for each existing // cluster. PIGGYBACKING BACKEND TEST HERE, THEY WILL GET COMBINED INTO ONE for (auto node : graph->op_nodes()) { diff --git a/ngraph_bridge/ops/ngraph_ops.cc b/ngraph_bridge/ops/ngraph_ops.cc index a2f5e13ff..ff91415b4 100644 --- a/ngraph_bridge/ops/ngraph_ops.cc +++ b/ngraph_bridge/ops/ngraph_ops.cc @@ -16,8 +16,6 @@ #include "tensorflow/core/common_runtime/optimization_registry.h" -#include "ngraph_bridge/ngraph_bridge_registry.h" - namespace tensorflow { namespace ngraph_bridge { @@ -46,9 +44,5 @@ REGISTER_OP("NGraphVariable") .SetIsStateful() .SetShapeFn(shape_inference::ExplicitShape); -#ifdef NGRAPH_BRIDGE_STATIC_LIB_ENABLE -void register_ngraph_ops() {} -#endif - } // namespace ngraph_bridge } // namespace tensorflow \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e6cc3f2a1..3dad8b060 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -98,9 +98,10 @@ if (APPLE) endif() if(NGRAPH_BRIDGE_STATIC_LIB_ENABLE) - target_link_libraries( - gtest_ngtf - ngraph_bridge_static + target_link_libraries(gtest_ngtf + -Wl,--whole-archive + ngraph_bridge_static + -Wl,--no-whole-archive ngraph_lib lib_cpu_backend_static lib_interpreter_backend_static