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
cc5ddd2f
Commit
cc5ddd2f
authored
May 14, 2018
by
Yixing Lao
Committed by
Robert Kimball
May 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Build NNP with ngraph as a library (#1005)
* Enable NNP reverse build, clean up ngraph repo * clean mkldnn cmake
parent
b74742ec
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
2 additions
and
222 deletions
+2
-222
external_mkldnn.cmake
cmake/external_mkldnn.cmake
+0
-4
external_nnp_transformer.cmake
cmake/external_nnp_transformer.cmake
+0
-162
apply-code-format.sh
maint/apply-code-format.sh
+1
-3
check-code-format.sh
maint/check-code-format.sh
+1
-3
CMakeLists.txt
src/ngraph/CMakeLists.txt
+0
-32
CMakeLists.txt
test/CMakeLists.txt
+0
-17
CMakeLists.txt
third-party/CMakeLists.txt
+0
-1
No files found.
cmake/external_mkldnn.cmake
View file @
cc5ddd2f
...
...
@@ -83,8 +83,4 @@ if(NGRAPH_CPU_ENABLE)
set
(
MKLDNN_INCLUDE_DIR
"
${
EXTERNAL_PROJECTS_ROOT
}
/mkldnn/include"
PARENT_SCOPE
)
set
(
MKLDNN_LIB_DIR
"
${
EXTERNAL_PROJECTS_ROOT
}
/mkldnn/lib"
PARENT_SCOPE
)
# Other .cmake files in current scope (e.g. NNP Transformer) needs this path as well
set
(
MKLDNN_INCLUDE_DIR
"
${
EXTERNAL_PROJECTS_ROOT
}
/mkldnn/include"
)
set
(
MKLDNN_LIB_DIR
"
${
EXTERNAL_PROJECTS_ROOT
}
/mkldnn/lib"
)
endif
()
cmake/external_nnp_transformer.cmake
deleted
100644 → 0
View file @
b74742ec
# ******************************************************************************
# Copyright 2017-2018 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.
# ******************************************************************************
# To build ngraph with NNP transformer using pre-build Argon API
# ```
# cmake -DNGRAPH_NNP_ENABLE=True -DNGRAPH_PREBUILD_ARGON_API_PATH=$HOME/dev/system/_out/debug-x86_64-Linux ..
# make -j
# ```
# Enable ExternalProject CMake module
include
(
ExternalProject
)
if
(
NGRAPH_NNP_ENABLE
)
# We require pre-build Argon API library
if
(
NOT DEFINED NGRAPH_PREBUILD_ARGON_API_PATH
)
message
(
FATAL_ERROR
"NGRAPH_PREBUILD_ARGON_API_PATH not defined, set it with -DNGRAPH_PREBUILD_ARGON_API_PATH="
)
endif
()
# Repository
if
(
DEFINED CUSTOM_NNP_TRANSFORMER_GIT_REPOSITORY
)
set
(
NNP_TRANSFORMER_GIT_REPOSITORY
${
CUSTOM_NNP_TRANSFORMER_GIT_REPOSITORY
}
)
else
()
set
(
NNP_TRANSFORMER_GIT_REPOSITORY https://github.com/NervanaSystems/nnp-transformer.git
)
endif
()
# Set nnp_transformer tag
# Notes:
# - Before we have ngraph CI job for nnp transformer, ngraph master might not be
# compatible with nnp transformer. To ensure compatibility, checkout the ngraph commit point
# where the following `NNP_TRANSFORMER_GIT_TAG` is set and build ngraph with nnp using this
# commit.
# - After we have ngraph CI job for nnp transformer, ngraph master will be compatible with
# nnp transformer guaranteed by CI.
set
(
NNP_TRANSFORMER_GIT_TAG master
)
# Determines where nnp-transformer will be located
set
(
NNP_TRANSFORMER_PREFIX
${
CMAKE_CURRENT_BINARY_DIR
}
/nnp_transformer
)
# Print
message
(
STATUS
"NGRAPH_INCLUDE_PATH:
${
NGRAPH_INCLUDE_PATH
}
"
)
message
(
STATUS
"LLVM_INCLUDE_DIR:
${
LLVM_INCLUDE_DIR
}
"
)
message
(
STATUS
"NGRAPH_PREBUILD_ARGON_API_PATH:
${
NGRAPH_PREBUILD_ARGON_API_PATH
}
"
)
# The 'BUILD_BYPRODUCTS' argument was introduced in CMake 3.2
if
(
${
CMAKE_VERSION
}
VERSION_LESS 3.2
)
if
(
DEFINED CUSTOM_NNP_TRANSFORMER_DIR
)
ExternalProject_Add
(
ext_nnp_transformer
SOURCE_DIR
${
CUSTOM_NNP_TRANSFORMER_DIR
}
PREFIX
${
NNP_TRANSFORMER_PREFIX
}
UPDATE_COMMAND
""
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
-DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
-DNGRAPH_INSTALL_PREFIX=
${
NNP_TRANSFORMER_PREFIX
}
-DPREBUILD_ARGON_API_PATH=
${
NGRAPH_PREBUILD_ARGON_API_PATH
}
-DEXTERNAL_NGRAPH_INCLUDE_DIR=
${
NGRAPH_INCLUDE_PATH
}
-DINSTALLED_HEADERS_PATH=
${
CMAKE_INSTALL_PREFIX
}
/include
-DMKLDNN_INCLUDE_DIR=
${
MKLDNN_INCLUDE_DIR
}
-DNGRAPH_DISTRIBUTED_ENABLE=
${
NGRAPH_DISTRIBUTED_ENABLE
}
BUILD_ALWAYS 1
)
else
()
ExternalProject_Add
(
ext_nnp_transformer
GIT_REPOSITORY
${
NNP_TRANSFORMER_GIT_REPOSITORY
}
GIT_TAG
${
NNP_TRANSFORMER_GIT_TAG
}
PREFIX
${
NNP_TRANSFORMER_PREFIX
}
UPDATE_COMMAND
""
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
-DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
-DNGRAPH_INSTALL_PREFIX=
${
NNP_TRANSFORMER_PREFIX
}
-DPREBUILD_ARGON_API_PATH=
${
NGRAPH_PREBUILD_ARGON_API_PATH
}
-DEXTERNAL_NGRAPH_INCLUDE_DIR=
${
NGRAPH_INCLUDE_PATH
}
-DINSTALLED_HEADERS_PATH=
${
CMAKE_INSTALL_PREFIX
}
/include
-DMKLDNN_INCLUDE_DIR=
${
MKLDNN_INCLUDE_DIR
}
-DNGRAPH_DISTRIBUTED_ENABLE=
${
NGRAPH_DISTRIBUTED_ENABLE
}
BUILD_ALWAYS 1
)
endif
()
else
()
if
(
DEFINED CUSTOM_NNP_TRANSFORMER_DIR
)
ExternalProject_Add
(
ext_nnp_transformer
SOURCE_DIR
${
CUSTOM_NNP_TRANSFORMER_DIR
}
PREFIX
${
NNP_TRANSFORMER_PREFIX
}
UPDATE_COMMAND
""
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
-DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
-DNGRAPH_INSTALL_PREFIX=
${
NNP_TRANSFORMER_PREFIX
}
-DPREBUILD_ARGON_API_PATH=
${
NGRAPH_PREBUILD_ARGON_API_PATH
}
-DEXTERNAL_NGRAPH_INCLUDE_DIR=
${
NGRAPH_INCLUDE_PATH
}
-DINSTALLED_HEADERS_PATH=
${
CMAKE_INSTALL_PREFIX
}
/include
-DMKLDNN_INCLUDE_DIR=
${
MKLDNN_INCLUDE_DIR
}
-DNGRAPH_DISTRIBUTED_ENABLE=
${
NGRAPH_DISTRIBUTED_ENABLE
}
BUILD_BYPRODUCTS
${
NNP_TRANSFORMER_PREFIX
}
BUILD_ALWAYS 1
)
else
()
ExternalProject_Add
(
ext_nnp_transformer
GIT_REPOSITORY
${
NNP_TRANSFORMER_GIT_REPOSITORY
}
GIT_TAG
${
NNP_TRANSFORMER_GIT_TAG
}
PREFIX
${
NNP_TRANSFORMER_PREFIX
}
UPDATE_COMMAND
""
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
-DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
-DNGRAPH_INSTALL_PREFIX=
${
NNP_TRANSFORMER_PREFIX
}
-DPREBUILD_ARGON_API_PATH=
${
NGRAPH_PREBUILD_ARGON_API_PATH
}
-DEXTERNAL_NGRAPH_INCLUDE_DIR=
${
NGRAPH_INCLUDE_PATH
}
-DINSTALLED_HEADERS_PATH=
${
CMAKE_INSTALL_PREFIX
}
/include
-DMKLDNN_INCLUDE_DIR=
${
MKLDNN_INCLUDE_DIR
}
-DNGRAPH_DISTRIBUTED_ENABLE=
${
NGRAPH_DISTRIBUTED_ENABLE
}
BUILD_BYPRODUCTS
${
NNP_TRANSFORMER_PREFIX
}
BUILD_ALWAYS 1
)
endif
()
endif
()
ExternalProject_Get_Property
(
ext_nnp_transformer source_dir
)
set
(
NNP_TRANSFORMER_SOURCE_DIR
${
source_dir
}
PARENT_SCOPE
)
set
(
NNP_TRANSFORMER_INCLUDE_DIR
${
NNP_TRANSFORMER_PREFIX
}
/include PARENT_SCOPE
)
set
(
NNP_TRANSFORMER_LIB_DIR
${
NNP_TRANSFORMER_PREFIX
}
/lib PARENT_SCOPE
)
set
(
ARGON_API_INCLUDE_DIR
${
NGRAPH_PREBUILD_ARGON_API_PATH
}
/include PARENT_SCOPE
)
set
(
ARGON_API_LIB_DIR
${
NGRAPH_PREBUILD_ARGON_API_PATH
}
/lib
)
# Used by find_library below
set
(
ARGON_API_LIB_DIR
${
NGRAPH_PREBUILD_ARGON_API_PATH
}
/lib PARENT_SCOPE
)
# Find prebuild nnp library
find_library
(
ARGON_API_LIBS
NAMES
argon_api
optimizer
ir_builder
umd
flex
disasm
HINTS
${
ARGON_API_LIB_DIR
}
$ENV{LD_LIBRARY_PATH}
)
endif
()
maint/apply-code-format.sh
View file @
cc5ddd2f
...
...
@@ -42,12 +42,10 @@ bash_lib_status "Verified that '${CLANG_FORMAT_PROG}' has version '${REQUIRED_CL
pushd
"
${
THIS_SCRIPT_DIR
}
/.."
declare
NNP_SRC_DIR
=
"build/third-party/nnp_transformer/src/ext_nnp_transformer/src"
declare
NNP_TEST_DIR
=
"build/third-party/nnp_transformer/src/ext_nnp_transformer/test"
declare
PYBIND_WRAPPER
=
"python/pyngraph"
declare
ROOT_SUBDIR
for
ROOT_SUBDIR
in
src doc/examples
test
${
NNP_SRC_DIR
}
${
NNP_TEST_DIR
}
${
PYBIND_WRAPPER
}
;
do
for
ROOT_SUBDIR
in
src doc/examples
test
${
PYBIND_WRAPPER
}
;
do
if
!
[[
-d
"
${
ROOT_SUBDIR
}
"
]]
;
then
bash_lib_status
"In directory '
$(
pwd
)
', no subdirectory named '
${
ROOT_SUBDIR
}
' was found."
else
...
...
maint/check-code-format.sh
View file @
cc5ddd2f
...
...
@@ -45,12 +45,10 @@ declare NUM_FILES_CHECKED=0
pushd
"
${
THIS_SCRIPT_DIR
}
/.."
declare
NNP_SRC_DIR
=
"build/third-party/nnp_transformer/src/ext_nnp_transformer/src"
declare
NNP_TEST_DIR
=
"build/third-party/nnp_transformer/src/ext_nnp_transformer/test"
declare
PYBIND_WRAPPER
=
"python/pyngraph"
declare
ROOT_SUBDIR
for
ROOT_SUBDIR
in
src doc/examples
test
${
NNP_SRC_DIR
}
${
NNP_TEST_DIR
}
${
PYBIND_WRAPPER
}
;
do
for
ROOT_SUBDIR
in
src doc/examples
test
${
PYBIND_WRAPPER
}
;
do
if
!
[[
-d
"
${
ROOT_SUBDIR
}
"
]]
;
then
bash_lib_status
"In directory '
$(
pwd
)
', no subdirectory named '
${
ROOT_SUBDIR
}
' was found."
else
...
...
src/ngraph/CMakeLists.txt
View file @
cc5ddd2f
...
...
@@ -293,11 +293,6 @@ endif()
endif
()
endif
()
if
(
NGRAPH_NNP_ENABLE
)
link_directories
(
${
NNP_TRANSFORMER_LIB_DIR
}
)
include_directories
(
${
NNP_TRANSFORMER_INCLUDE_DIR
}
)
endif
()
add_library
(
ngraph SHARED
${
SRC
}
)
set_target_properties
(
ngraph PROPERTIES VERSION
${
NGRAPH_VERSION
}
SOVERSION
${
NGRAPH_API_VERSION
}
)
if
(
NGRAPH_CPU_ENABLE AND LLVM_INCLUDE_DIR AND MKLDNN_INCLUDE_DIR
)
...
...
@@ -332,10 +327,6 @@ if (NOT APPLE)
endif
()
# Defines macro in C++ to load backend plugin
if
(
NGRAPH_NNP_ENABLE
)
target_compile_definitions
(
ngraph PRIVATE NGRAPH_NNP_ENABLE
)
endif
()
target_include_directories
(
ngraph PUBLIC
"
${
NGRAPH_INCLUDE_PATH
}
"
)
target_link_libraries
(
ngraph PRIVATE dl
)
...
...
@@ -368,14 +359,6 @@ if(MPI_CXX_INCLUDE_PATH)
target_link_libraries
(
ngraph PRIVATE
${
MPI_CXX_LIBRARIES
}
)
endif
()
# NNP
if
(
NGRAPH_NNP_ENABLE
)
target_link_libraries
(
ngraph PRIVATE
${
NNP_TRANSFORMER_LIB_DIR
}
/libnnp.so
)
target_link_libraries
(
ngraph PRIVATE
${
ARGON_API_LIBS
}
)
add_dependencies
(
ngraph ext_nnp_transformer
)
add_dependencies
(
ext_nnp_transformer ext_llvm
)
endif
()
#-----------------------------------------------------------------------------------------------
# Installation logic...
#-----------------------------------------------------------------------------------------------
...
...
@@ -406,18 +389,3 @@ if (NGRAPH_TBB_ENABLE)
FILES_MATCHING REGEX
"/libtbb_debug
${
CMAKE_SHARED_LIBRARY_SUFFIX
}
(
\\
.[0-9]+)*$"
)
endif
()
if
(
NGRAPH_NNP_ENABLE
)
install
(
DIRECTORY
${
NNP_TRANSFORMER_LIB_DIR
}
/
DESTINATION
${
NGRAPH_INSTALL_LIB
}
FILES_MATCHING PATTERN
"*.so"
)
install
(
DIRECTORY
${
NNP_TRANSFORMER_INCLUDE_DIR
}
/
DESTINATION
${
NGRAPH_INSTALL_INCLUDE
}
FILES_MATCHING PATTERN
"*.hpp"
)
install
(
DIRECTORY
${
NNP_TRANSFORMER_INCLUDE_DIR
}
/
DESTINATION
${
NGRAPH_INSTALL_INCLUDE
}
FILES_MATCHING PATTERN
"*.h"
)
endif
()
test/CMakeLists.txt
View file @
cc5ddd2f
...
...
@@ -92,17 +92,6 @@ if(NGRAPH_GPU_ENABLE AND LLVM_INCLUDE_DIR)
set
(
BACKEND_NAMES
${
BACKEND_NAMES
}
"GPU"
)
endif
()
if
(
NGRAPH_NNP_ENABLE
)
include_directories
(
SYSTEM
${
NNP_TRANSFORMER_INCLUDE_DIR
}
)
set
(
BACKEND_NAMES
${
BACKEND_NAMES
}
"NNP_TESTER"
)
set
(
BACKEND_NAMES
${
BACKEND_NAMES
}
"NNPI"
)
set
(
BACKEND_NAMES
${
BACKEND_NAMES
}
"NNPI_TESTER"
)
set
(
ADDITIONAL_NNP_TEST
${
NNP_TRANSFORMER_SOURCE_DIR
}
/test/test_nnp_backend.cpp
)
# Ensures ADDITIONAL_NNP_TEST are a dependency on nnp transformer
add_custom_command
(
OUTPUT
${
ADDITIONAL_NNP_TEST
}
DEPENDS ext_nnp_transformer COMMAND
""
)
set
(
SRC
${
SRC
}
${
ADDITIONAL_NNP_TEST
}
)
endif
()
if
(
NGRAPH_DISTRIBUTED_ENABLE AND MPI_C_INCLUDE_PATH
)
include_directories
(
SYSTEM
${
MPI_C_INCLUDE_PATH
}
${
MPI_CXX_INCLUDE_PATH
}
)
link_directories
(
${
MPI_C_LIBRARIES
}
${
MPI_CXX_LIBRARIES
}
)
...
...
@@ -177,12 +166,6 @@ endif()
target_link_libraries
(
unit-test ngraph libgtest pthread
)
target_link_libraries
(
unit-test
${
CMAKE_DL_LIBS
}
)
if
(
NGRAPH_NNP_ENABLE
)
# A framework like TF shall not need to link `libnnp.so`, but shall call via libngraph.so.
# Since we're testing non-public APIs in libnnp.so, we link it directly here.
target_link_libraries
(
unit-test
${
NNP_TRANSFORMER_LIB_DIR
}
/libnnp.so
)
endif
()
add_dependencies
(
unit-test ngraph libgtest ext_json
)
include_directories
(
SYSTEM
${
JSON_INCLUDE_DIR
}
)
...
...
third-party/CMakeLists.txt
View file @
cc5ddd2f
...
...
@@ -28,4 +28,3 @@ else()
include
(
../cmake/external_llvm.cmake
)
endif
()
include
(
../cmake/external_tbb.cmake
)
include
(
../cmake/external_nnp_transformer.cmake
)
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