Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
68ec623d
Commit
68ec623d
authored
Aug 22, 2018
by
Robert Kimball
Committed by
Scott Cyphers
Aug 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Statically link cpu backend into ngraph shared library (#1444)" (#1457)
This reverts commit
5ab5a129
.
parent
5ab5a129
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
52 deletions
+38
-52
CMakeLists.txt
src/ngraph/CMakeLists.txt
+13
-30
CMakeLists.txt
src/ngraph/codegen/CMakeLists.txt
+1
-1
CMakeLists.txt
src/ngraph/runtime/cpu/CMakeLists.txt
+6
-4
cpu_backend.cpp
src/ngraph/runtime/cpu/cpu_backend.cpp
+13
-14
CMakeLists.txt
src/ngraph/runtime/interpreter/CMakeLists.txt
+0
-1
CMakeLists.txt
src/tools/nbench/CMakeLists.txt
+3
-0
CMakeLists.txt
test/CMakeLists.txt
+2
-2
No files found.
src/ngraph/CMakeLists.txt
View file @
68ec623d
...
...
@@ -188,25 +188,24 @@ include_directories("${NGRAPH_INCLUDE_PATH}")
add_subdirectory
(
codegen
)
add_subdirectory
(
runtime
)
add_library
(
ngraph_core STATIC
${
SRC
}
)
target_compile_definitions
(
ngraph_core PRIVATE SHARED_LIB_EXT=
"
${
CMAKE_SHARED_LIBRARY_SUFFIX
}
"
)
set_target_properties
(
ngraph_core PROPERTIES VERSION
${
NGRAPH_VERSION
}
SOVERSION
${
NGRAPH_API_VERSION
}
)
target_link_libraries
(
ngraph_core PUBLIC libjson
)
target_compile_definitions
(
ngraph_core PUBLIC NGRAPH_VERSION=
"
${
NGRAPH_VERSION
}
"
)
target_compile_options
(
ngraph_core PRIVATE -fPIC
)
add_library
(
ngraph SHARED
${
SRC
}
)
target_compile_definitions
(
ngraph PRIVATE SHARED_LIB_EXT=
"
${
CMAKE_SHARED_LIBRARY_SUFFIX
}
"
)
set_target_properties
(
ngraph PROPERTIES VERSION
${
NGRAPH_VERSION
}
SOVERSION
${
NGRAPH_API_VERSION
}
)
target_link_libraries
(
ngraph PUBLIC libjson
)
target_compile_definitions
(
ngraph PUBLIC NGRAPH_VERSION=
"
${
NGRAPH_VERSION
}
"
)
if
(
NGRAPH_ONNX_IMPORT_ENABLE
)
add_dependencies
(
ngraph
_core
onnx_import
)
add_dependencies
(
ngraph onnx_import
)
endif
()
if
(
NOT APPLE
)
set_property
(
TARGET ngraph
_core
APPEND_STRING PROPERTY LINK_FLAGS
" -Wl,--rpath,$ORIGIN"
)
set_property
(
TARGET ngraph APPEND_STRING PROPERTY LINK_FLAGS
" -Wl,--rpath,$ORIGIN"
)
# nGraph links against one or more libraries (ex. LLVM) but we don't want to
# export these symbols as part of the DSO. This is a GNU ld (and derivatives) specific
# option so making this portable is still an open issue. As a note for the future,
# this is not an issue on Windows and LLVM's lld does support --exclude-libs.
set_property
(
TARGET ngraph
_core
APPEND_STRING PROPERTY LINK_FLAGS
" -Wl,--exclude-libs,ALL"
)
set_property
(
TARGET ngraph APPEND_STRING PROPERTY LINK_FLAGS
" -Wl,--exclude-libs,ALL"
)
# GCC invokes the linker with --as-needed by default which doesn't work for us
# because generated code needs to find symbols in these DSOs at runtime.
...
...
@@ -215,35 +214,19 @@ if (NOT APPLE)
# _do_ need to be linked with --as-needed with a higher priority for the
# Intel OpenMP runtime so we don't mix libgomp and libiomp5
if
(
CMAKE_CXX_COMPILER_ID STREQUAL
"GNU"
)
set_property
(
TARGET ngraph
_core
APPEND_STRING PROPERTY LINK_FLAGS
" -Wl,--no-as-needed"
)
set_property
(
TARGET ngraph APPEND_STRING PROPERTY LINK_FLAGS
" -Wl,--no-as-needed"
)
endif
()
endif
()
# Defines macro in C++ to load backend plugin
target_include_directories
(
ngraph
_core
PUBLIC
"
${
NGRAPH_INCLUDE_PATH
}
"
)
target_include_directories
(
ngraph PUBLIC
"
${
NGRAPH_INCLUDE_PATH
}
"
)
if
(
NOT WIN32
)
target_link_libraries
(
ngraph
_core
PUBLIC dl pthread
)
target_link_libraries
(
ngraph PUBLIC dl pthread
)
endif
()
if
(
NGRAPH_ONNX_IMPORT_ENABLE
)
target_sources
(
ngraph_core PRIVATE $<TARGET_OBJECTS:onnx_import_interface>
)
target_link_libraries
(
ngraph_core PRIVATE onnx_import
)
endif
()
add_library
(
ngraph SHARED
)
set_target_properties
(
ngraph PROPERTIES VERSION
${
NGRAPH_VERSION
}
SOVERSION
${
NGRAPH_API_VERSION
}
)
if
(
APPLE
)
target_link_libraries
(
ngraph PUBLIC -Wl,-force_load ngraph_core
)
else
()
target_link_libraries
(
ngraph PUBLIC -Wl,--whole-archive ngraph_core -Wl,--no-whole-archive
)
endif
()
if
(
NGRAPH_CPU_ENABLE
)
if
(
APPLE
)
target_link_libraries
(
ngraph PUBLIC -Wl,-force_load cpu_backend
)
else
()
target_link_libraries
(
ngraph PUBLIC -Wl,--whole-archive cpu_backend -Wl,--no-whole-archive
)
endif
()
target_sources
(
ngraph PRIVATE $<TARGET_OBJECTS:onnx_import_interface>
)
target_link_libraries
(
ngraph PRIVATE onnx_import
)
endif
()
#-----------------------------------------------------------------------------------------------
...
...
src/ngraph/codegen/CMakeLists.txt
View file @
68ec623d
...
...
@@ -76,6 +76,6 @@ if ((NGRAPH_CPU_ENABLE AND NOT NGRAPH_DEX_ONLY) OR NGRAPH_GPU_ENABLE)
set_target_properties
(
codegen PROPERTIES VERSION
${
NGRAPH_VERSION
}
SOVERSION
${
NGRAPH_API_VERSION
}
)
add_dependencies
(
codegen header_resource libmkldnn libeigen
)
target_include_directories
(
codegen SYSTEM PUBLIC
${
CMAKE_BINARY_DIR
}
)
target_link_libraries
(
codegen PRIVATE libllvm ngraph
_core
)
target_link_libraries
(
codegen PRIVATE libllvm ngraph
)
install
(
TARGETS codegen DESTINATION
${
NGRAPH_INSTALL_LIB
}
)
endif
()
src/ngraph/runtime/cpu/CMakeLists.txt
View file @
68ec623d
...
...
@@ -133,9 +133,8 @@ endif()
if
(
NGRAPH_CPU_ENABLE
)
set
(
NGRAPH_CPU_DEBUGINFO_ENABLE 0 CACHE STRING
"Enable debuginfo in the CPU backend"
)
add_library
(
cpu_backend STATIC
${
SRC
}
)
set_target_properties
(
cpu_backend PROPERTIES VERSION
${
NGRAPH_VERSION
}
)
target_compile_options
(
cpu_backend PRIVATE -fPIC
)
add_library
(
cpu_backend SHARED
${
SRC
}
)
set_target_properties
(
cpu_backend PROPERTIES VERSION
${
NGRAPH_VERSION
}
SOVERSION
${
NGRAPH_API_VERSION
}
)
if
(
NGRAPH_DEX_ONLY
)
target_compile_definitions
(
cpu_backend PRIVATE
"NGRAPH_DEX_ONLY"
)
endif
()
...
...
@@ -149,9 +148,12 @@ if (NGRAPH_CPU_ENABLE)
endif
()
add_dependencies
(
cpu_backend ext_mkldnn ext_eigen
)
target_link_libraries
(
cpu_backend PUBLIC ngraph
_core
libmkldnn libeigen libjson libtbb
)
target_link_libraries
(
cpu_backend PUBLIC ngraph libmkldnn libeigen libjson libtbb
)
if
(
NOT NGRAPH_DEX_ONLY
)
target_link_libraries
(
cpu_backend PUBLIC codegen
)
endif
()
target_include_directories
(
cpu_backend SYSTEM PUBLIC libmkldnn
)
set_target_properties
(
cpu_backend PROPERTIES LIBRARY_OUTPUT_DIRECTORY
${
NGRAPH_BUILD_DIR
}
)
install
(
TARGETS cpu_backend LIBRARY DESTINATION
${
NGRAPH_INSTALL_LIB
}
)
endif
()
src/ngraph/runtime/cpu/cpu_backend.cpp
View file @
68ec623d
...
...
@@ -17,7 +17,6 @@
#include <tbb/tbb_stddef.h>
#include "ngraph/graph_util.hpp"
#include "ngraph/runtime/backend_manager.hpp"
#include "ngraph/runtime/cpu/cpu_backend.hpp"
#include "ngraph/runtime/cpu/cpu_call_frame.hpp"
#include "ngraph/runtime/cpu/cpu_external_function.hpp"
...
...
@@ -27,21 +26,21 @@
using
namespace
ngraph
;
using
namespace
std
;
namespace
extern
"C"
const
char
*
get_ngraph_version_string
()
{
runtime
::
Backend
*
new_backend
(
const
char
*
configuration_string
)
{
// Force TBB to link to the backend
tbb
::
TBB_runtime_interface_version
();
return
new
runtime
::
cpu
::
CPU_Backend
();
}
return
NGRAPH_VERSION
;
}
static
class
NGRAPH_CPUStaticInit
{
public
:
NGRAPH_CPUStaticInit
()
{
runtime
::
BackendManager
::
register_backend
(
"CPU"
,
new_backend
);
}
~
NGRAPH_CPUStaticInit
()
{}
}
s_init
;
extern
"C"
runtime
::
Backend
*
new_backend
(
const
char
*
configuration_string
)
{
// Force TBB to link to the backend
tbb
::
TBB_runtime_interface_version
();
return
new
runtime
::
cpu
::
CPU_Backend
();
}
extern
"C"
void
delete_backend
(
runtime
::
Backend
*
backend
)
{
delete
backend
;
}
shared_ptr
<
runtime
::
cpu
::
CPU_CallFrame
>
runtime
::
cpu
::
CPU_Backend
::
make_call_frame
(
...
...
src/ngraph/runtime/interpreter/CMakeLists.txt
View file @
68ec623d
...
...
@@ -27,7 +27,6 @@ if (NGRAPH_INTERPRETER_ENABLE)
set_target_properties
(
interpreter_backend PROPERTIES VERSION
${
NGRAPH_VERSION
}
SOVERSION
${
NGRAPH_API_VERSION
}
)
target_link_libraries
(
interpreter_backend PUBLIC ngraph
)
set_target_properties
(
interpreter_backend PROPERTIES LIBRARY_OUTPUT_DIRECTORY
${
NGRAPH_BUILD_DIR
}
)
target_compile_options
(
interpreter_backend PRIVATE -fPIC
)
install
(
TARGETS interpreter_backend
LIBRARY DESTINATION
"
${
NGRAPH_INSTALL_LIB
}
"
...
...
src/tools/nbench/CMakeLists.txt
View file @
68ec623d
...
...
@@ -22,6 +22,9 @@ set (SRC
add_executable
(
nbench
${
SRC
}
)
target_link_libraries
(
nbench ngraph
)
if
(
NGRAPH_CPU_ENABLE
)
target_link_libraries
(
nbench cpu_backend
)
endif
()
if
(
NGRAPH_INTELGPU_ENABLE
)
target_link_libraries
(
nbench intelgpu_backend
)
endif
()
...
...
test/CMakeLists.txt
View file @
68ec623d
...
...
@@ -131,7 +131,7 @@ endif()
if
(
NGRAPH_CPU_ENABLE
)
# The INTERPRETER backend is required for graph_partition, convolution, and backwards unit tests
target_link_libraries
(
unit-test interpreter_backend
)
target_link_libraries
(
unit-test
cpu_backend
interpreter_backend
)
target_link_libraries
(
unit-test libmkldnn
)
endif
()
...
...
@@ -150,7 +150,7 @@ endif()
add_custom_target
(
unit-test-check
COMMAND
${
PROJECT_BINARY_DIR
}
/test/unit-test \
${
ARGS
}
DEPENDS unit-test
nbench
DEPENDS unit-test
)
add_custom_target
(
check
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment