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
1c5abc19
Commit
1c5abc19
authored
Dec 27, 2017
by
Yixing Lao
Committed by
Yixing Lao
Dec 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support build from ngraph repo with argon as external
parent
2d2fc8c2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
103 additions
and
13 deletions
+103
-13
external_argon.cmake
cmake/external_argon.cmake
+81
-0
external_llvm.cmake
cmake/external_llvm.cmake
+1
-0
CMakeLists.txt
src/ngraph/CMakeLists.txt
+16
-13
CMakeLists.txt
test/CMakeLists.txt
+4
-0
CMakeLists.txt
third-party/CMakeLists.txt
+1
-0
No files found.
cmake/external_argon.cmake
0 → 100644
View file @
1c5abc19
# Copyright 2017 Nervana Systems Inc.
# 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 Argon backend
# * Option 1: Build argon-api from scratch
# ```
# cmake -DNGRAPH_ARGON_ENABLE=True ..
# make -j
# ```
# * Option 2: Using pre-build argon-api
# Use PREBUILD_ARGON_PATH to specify the pre-build argon-api path
# ```
# cmake -DNGRAPH_ARGON_ENABLE=True -DPREBUILD_ARGON_PATH=$HOME/dev/system/_out/debug-x86_64-Linux ..
# make -j
# ```
# Enable ExternalProject CMake module
include
(
ExternalProject
)
if
(
NGRAPH_ARGON_ENABLE
)
# Repository
set
(
ARGON_CMAKE_GIT_REPOSITORY git@github.com:NervanaSystems/argon-transformer.git
)
set
(
ARGON_CMAKE_GIT_TAG yixing/reverse-build
)
set
(
ARGON_CMAKE_PREFIX
${
CMAKE_CURRENT_BINARY_DIR
}
/argon
)
if
(
NOT DEFINED PREBUILD_ARGON_PATH
)
set
(
PREBUILD_ARGON_PATH
""
)
endif
()
# Print
message
(
STATUS
"NGRAPH_INCLUDE_PATH:
${
NGRAPH_INCLUDE_PATH
}
"
)
message
(
STATUS
"LLVM_INCLUDE_DIR:
${
LLVM_INCLUDE_DIR
}
"
)
message
(
STATUS
"PREBUILD_ARGON_PATH:
${
PREBUILD_ARGON_PATH
}
"
)
# The 'BUILD_BYPRODUCTS' argument was introduced in CMake 3.2
if
(
${
CMAKE_VERSION
}
VERSION_LESS 3.2
)
ExternalProject_Add
(
ext_argon
GIT_REPOSITORY
${
ARGON_CMAKE_GIT_REPOSITORY
}
GIT_TAG
${
ARGON_CMAKE_GIT_TAG
}
PREFIX
${
ARGON_CMAKE_PREFIX
}
UPDATE_COMMAND
""
INSTALL_COMMAND
""
CMAKE_ARGS -DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
-DPREBUILD_ARGON_PATH=
${
PREBUILD_ARGON_PATH
}
-DARGON_AS_EXTERNAL=True
-DEXTERNAL_NGRAPH_INCLUDE_DIR=
${
NGRAPH_INCLUDE_PATH
}
-DLLVM_INCLUDE_DIR=
${
LLVM_INCLUDE_DIR
}
BUILD_ALWAYS 1
)
else
()
ExternalProject_Add
(
ext_argon
GIT_REPOSITORY
${
ARGON_CMAKE_GIT_REPOSITORY
}
GIT_TAG
${
ARGON_CMAKE_GIT_TAG
}
PREFIX
${
ARGON_CMAKE_PREFIX
}
UPDATE_COMMAND
""
INSTALL_COMMAND
""
CMAKE_ARGS -DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
-DPREBUILD_ARGON_PATH=
${
PREBUILD_ARGON_PATH
}
-DARGON_AS_EXTERNAL=True
-DEXTERNAL_NGRAPH_INCLUDE_DIR=
${
NGRAPH_INCLUDE_PATH
}
-DLLVM_INCLUDE_DIR=
${
LLVM_INCLUDE_DIR
}
BUILD_BYPRODUCTS
${
ARGON_CMAKE_PREFIX
}
BUILD_ALWAYS 1
)
endif
()
ExternalProject_Get_Property
(
ext_argon source_dir binary_dir
)
set
(
ARGON_INCLUDE_DIR
"
${
source_dir
}
/argon/src"
PARENT_SCOPE
)
set
(
ARGON_LIB_DIR
"
${
binary_dir
}
/argon"
PARENT_SCOPE
)
endif
()
cmake/external_llvm.cmake
View file @
1c5abc19
...
...
@@ -54,6 +54,7 @@ if((NGRAPH_CPU_ENABLE OR USE_CUDA) AND (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin
ExternalProject_Get_Property
(
ext_llvm source_dir
)
set
(
LLVM_INCLUDE_DIR
"
${
source_dir
}
/include"
PARENT_SCOPE
)
set
(
LLVM_INCLUDE_DIR
"
${
source_dir
}
/include"
)
# used by other external projects in current scope
set
(
LLVM_LIB_DIR
"
${
source_dir
}
/lib"
PARENT_SCOPE
)
set
(
LLVM_LINK_LIBS
...
...
src/ngraph/CMakeLists.txt
View file @
1c5abc19
...
...
@@ -178,6 +178,10 @@ if (NGRAPH_CPU_ENABLE AND LLVM_INCLUDE_DIR AND
"NGCPU_DEBUGINFO=
${
NGRAPH_CPU_DEBUGINFO_ENABLE
}
"
)
endif
()
if
(
NGRAPH_ARGON_ENABLE
)
link_directories
(
${
ARGON_LIB_DIR
}
)
endif
()
add_library
(
ngraph SHARED
${
SRC
}
)
if
(
NGRAPH_CPU_ENABLE AND LLVM_INCLUDE_DIR AND MKLDNN_INCLUDE_DIR
)
# Generate the resource file containing all headers used by the codegen compiler
...
...
@@ -212,23 +216,16 @@ endif()
# plugin is specified at compile time but the corresponding library could not be resolved at run-
# time, an error will be generated.
# E.g. assume compiling with Argon and Xpu, then -DRUNTIME_PLUGIN_LIBS="libargon.so:libxpu.so".
if
(
DEFINED RUNTIME_PLUGIN_LIBS
)
target_compile_definitions
(
ngraph PRIVATE RUNTIME_PLUGIN_LIBS=
${
RUNTIME_PLUGIN_LIBS
}
)
else
()
target_compile_definitions
(
ngraph PRIVATE RUNTIME_PLUGIN_LIBS=
""
)
if
(
NGRAPH_ARGON_ENABLE
)
set
(
RUNTIME_PLUGIN_LIBS
"libargon.so"
)
# TODO: currently hardcoded argon lib name if enabled
endif
()
# This is used to ensure that libngraph.so and libargon.so are in the same directory for dlopen.
# Effective at build time. Does not affect `make install` logics.
if
(
DEFINED COMMON_LIBRARY_OUTPUT_DIRECTORY
)
set_target_properties
(
ngraph PROPERTIES
LIBRARY_OUTPUT_DIRECTORY
${
COMMON_LIBRARY_OUTPUT_DIRECTORY
}
)
if
(
DEFINED RUNTIME_PLUGIN_LIBS
)
target_compile_definitions
(
ngraph PRIVATE RUNTIME_PLUGIN_LIBS=
"
${
RUNTIME_PLUGIN_LIBS
}
"
)
else
()
set_target_properties
(
ngraph PROPERTIES
LIBRARY_OUTPUT_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
)
target_compile_definitions
(
ngraph PRIVATE RUNTIME_PLUGIN_LIBS=
""
)
endif
()
message
(
STATUS
"LIBRARY_OUTPUT_DIRECTORY set to:
${
COMMON_LIBRARY_OUTPUT_DIRECTORY
}
"
)
target_include_directories
(
ngraph PUBLIC
"
${
NGRAPH_INCLUDE_PATH
}
"
)
...
...
@@ -254,6 +251,12 @@ if(NGRAPH_GPU_ENABLE AND CUDA_LIBRARIES)
target_link_libraries
(
ngraph PRIVATE
${
CUDA_LIBRARIES
}
${
CUDNN_LIBRARIES
}
)
endif
()
# Argon
if
(
NGRAPH_ARGON_ENABLE
)
target_link_libraries
(
ngraph PRIVATE argon
)
add_dependencies
(
ngraph ext_argon
)
add_dependencies
(
ext_argon ext_llvm
)
endif
()
#-----------------------------------------------------------------------------------------------
# Installation logic...
...
...
test/CMakeLists.txt
View file @
1c5abc19
...
...
@@ -79,6 +79,10 @@ if(NGRAPH_GPU_ENABLE)
# set(BACKEND_NAMES ${BACKEND_NAMES} "GPU")
endif
()
if
(
NGRAPH_ARGON_ENABLE
)
set
(
BACKEND_NAMES
${
BACKEND_NAMES
}
"ARGON"
)
endif
()
foreach
(
BACKEND_NAME
${
BACKEND_NAMES
}
)
configure_file
(
backend_test.in.cpp backend_test_
${
BACKEND_NAME
}
.cpp
)
configure_file
(
convolution_test.in.cpp convolution_test_
${
BACKEND_NAME
}
.cpp
)
...
...
third-party/CMakeLists.txt
View file @
1c5abc19
...
...
@@ -16,3 +16,4 @@ include( ../cmake/external_eigen.cmake )
include
(
../cmake/external_mkldnn.cmake
)
include
(
../cmake/external_llvm.cmake
)
include
(
../cmake/external_tbb.cmake
)
include
(
../cmake/external_argon.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