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
6f171de6
Commit
6f171de6
authored
Feb 06, 2018
by
Jayaram Bobba
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into jbobba/mkldnn-outlining
parents
a5b75e36
8bccef1a
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
327 additions
and
76 deletions
+327
-76
CMakeLists.txt
CMakeLists.txt
+10
-2
INSTALL
INSTALL
+45
-0
external_eigen.cmake
cmake/external_eigen.cmake
+2
-2
external_gtest.cmake
cmake/external_gtest.cmake
+2
-0
external_llvm.cmake
cmake/external_llvm.cmake
+58
-37
external_llvm_prebuilt.cmake
cmake/external_llvm_prebuilt.cmake
+137
-0
external_mkldnn.cmake
cmake/external_mkldnn.cmake
+1
-1
external_tbb.cmake
cmake/external_tbb.cmake
+11
-9
Makefile
contrib/docker/Makefile
+2
-2
CMakeLists.txt
src/ngraph/CMakeLists.txt
+19
-11
compiler.cpp
src/ngraph/codegen/compiler.cpp
+3
-0
json.hpp
src/ngraph/json.hpp
+6
-1
cpu_external_function.cpp
src/ngraph/runtime/cpu/cpu_external_function.cpp
+6
-1
int_call_frame.cpp
src/ngraph/runtime/interpreter/int_call_frame.cpp
+2
-2
CMakeLists.txt
src/resource/CMakeLists.txt
+12
-3
main.cpp
src/resource/main.cpp
+4
-0
util.cpp
src/resource/util.cpp
+2
-4
CMakeLists.txt
third-party/CMakeLists.txt
+5
-1
No files found.
CMakeLists.txt
View file @
6f171de6
...
...
@@ -23,7 +23,7 @@ endif()
project
(
ngraph
)
SET
(
GCC_MIN_VERSION 4.
9
)
SET
(
GCC_MIN_VERSION 4.
8
)
SET
(
CLANG_MIN_VERSION 3.8
)
if
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"GNU"
)
...
...
@@ -39,6 +39,10 @@ else()
message
(
WARNING
"You are using an unsupported compiler! Compilation has only been tested with Clang (
${
CLANG_MIN_VERSION
}
and up) and GCC (
${
GCC_MIN_VERSION
}
and up). "
)
endif
()
if
(
$ENV{NGRAPH_USE_PREBUILT_LLVM}
)
set
(
NGRAPH_USE_PREBUILT_LLVM TRUE
)
endif
()
# These variables are undocumented but useful.
set
(
CMAKE_DISABLE_SOURCE_CHANGES ON
)
set
(
CMAKE_DISABLE_IN_SOURCE_BUILD ON
)
...
...
@@ -97,7 +101,11 @@ endif()
# Set true if CPU backend is built by default
if
(
NOT DEFINED NGRAPH_CPU_ENABLE
)
SET
(
NGRAPH_CPU_ENABLE TRUE
)
set
(
NGRAPH_CPU_ENABLE TRUE
)
endif
()
if
(
NOT DEFINED NGRAPH_TBB_ENABLE
)
set
(
NGRAPH_TBB_ENABLE
${
NGRAPH_CPU_ENABLE
}
)
endif
()
#-----------------------------------------------------------------------------------------------
...
...
INSTALL
0 → 100644
View file @
6f171de6
Currently two platforms are known to work:
- Ubuntu 16.04
- CentOS 7.4
Ubuntu 16.04 Prerequisites
==========================
Compilers currently known to work are gcc-5.4.0, clang-3.9, and gcc-4.8.5.
If you are using gcc-5.4.0 or clang-3.9, it is recommended to add the
option `-DNGRAPH_USE_PREBUILT_LLVM=TRUE` to the `cmake` command. This causes
the build system to fetch a pre-built tarball of LLVM+Clang from `llvm.org`,
which substantially cuts down on build times.
If you are using gcc-4.8, it may be necessary to add symlinksfrom `gcc` to
`gcc-4.8`, and from `g++` to `g++-4.8`, in your PATH, even if you have
specify CMAKE_C_COMPILER and CMAKE_CXX_COMPILER when building. (You should
NOT supply the `-DNGRAPH_USE_PREBUILT_LLVM` flag in this case, because the
prebuilt tarball supplied on llvm.org is not compatible with a gcc-4.8
based build.)
CentOS 7.4 Prerequisites
========================
CentOS supplies an older version of CMake that is not compatible with
LLVM-5.0.1, which we build as an external dependency. There are two options:
1. (requires root privileges) install the the `cmake3` package from EPEL, or
2. (does not require root privileges) build CMake (3.1 or newer) from source,
and run it from its build directory.
General Instructions
====================
These instructions assume that your system has been prepared in accordance
with the above prerequisites.
$ cd private-ngraph-cpp
$ mkdir build
$ cd build
$ cmake .. \
-DCMAKE_C_COMPILER=<path to C compiler> \
-DCMAKE_CXX_COMPILER=<path to C++ compiler>
$ make -j install
cmake/external_eigen.cmake
View file @
6f171de6
...
...
@@ -30,7 +30,7 @@ if (${CMAKE_VERSION} VERSION_LESS 3.2)
GIT_REPOSITORY
${
EIGEN_GIT_URL
}
GIT_TAG
${
EIGEN_GIT_TAG
}
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
EIGEN_INSTALL_DIR
}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
EIGEN_INSTALL_DIR
}
-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
-DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
)
else
()
ExternalProject_Add
(
...
...
@@ -38,7 +38,7 @@ else()
GIT_REPOSITORY
${
EIGEN_GIT_URL
}
GIT_TAG
${
EIGEN_GIT_TAG
}
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
EIGEN_INSTALL_DIR
}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
EIGEN_INSTALL_DIR
}
-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
-DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
BUILD_BYPRODUCTS
"
${
EIGEN_INSTALL_DIR
}
/include/eigen3"
)
endif
()
...
...
cmake/external_gtest.cmake
View file @
6f171de6
...
...
@@ -31,6 +31,7 @@ if (${CMAKE_VERSION} VERSION_LESS 3.2)
# Disable install step
INSTALL_COMMAND
""
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
)
else
()
ExternalProject_Add
(
...
...
@@ -41,6 +42,7 @@ else()
# Disable install step
INSTALL_COMMAND
""
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
BUILD_BYPRODUCTS
"
${
CMAKE_CURRENT_BINARY_DIR
}
/gtest/src/gtest-build/googlemock/gtest/libgtest.a"
)
endif
()
...
...
cmake/external_llvm.cmake
View file @
6f171de6
...
...
@@ -15,47 +15,69 @@ include(ExternalProject)
if
((
NGRAPH_CPU_ENABLE OR NGRAPH_GPU_ENABLE
)
AND
(
NOT
${
CMAKE_SYSTEM_NAME
}
MATCHES
"Darwin"
)
AND
(
NOT
${
CMAKE_SYSTEM_NAME
}
MATCHES
"Windows"
))
message
(
STATUS
"Fetching LLVM from llvm.org"
)
set
(
LLVM_RELEASE_URL http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-linux-x86_64-ubuntu16.04.tar.xz
)
set
(
LLVM_SHA1_HASH 9cb81c92aa4d3f9707a9b8413c4d24b8dee90c59
)
set
(
CMAKE_DISABLE_SOURCE_CHANGES ON
)
set
(
CMAKE_DISABLE_IN_SOURCE_BUILD ON
)
# Override default LLVM binaries
if
(
PREBUILT_LLVM
)
if
(
NOT DEFINED PREBUILT_LLVM_HASH
)
message
(
FATAL_ERROR
"SHA1 hash of prebuilt llvm tarball not provided in PREBUILT_LLVM_HASH."
)
endif
()
set
(
LLVM_RELEASE_URL
${
PREBUILT_LLVM
}
)
set
(
LLVM_SHA1_HASH
${
PREBUILT_LLVM_HASH
}
)
endif
()
set
(
RELEASE_TAG release_50
)
set
(
EXTERNAL_INSTALL_LOCATION
${
CMAKE_CURRENT_BINARY_DIR
}
/ext_llvm-prefix
)
ExternalProject_Add
(
clang
GIT_REPOSITORY https://github.com/llvm-mirror/clang.git
GIT_TAG
${
RELEASE_TAG
}
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
INSTALL_COMMAND
""
UPDATE_COMMAND
""
)
ExternalProject_Get_Property
(
clang SOURCE_DIR
)
set
(
CLANG_SOURCE_DIR
${
SOURCE_DIR
}
)
ExternalProject_Add
(
openmp
GIT_REPOSITORY https://github.com/llvm-mirror/openmp.git
GIT_TAG
${
RELEASE_TAG
}
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
INSTALL_COMMAND
""
UPDATE_COMMAND
""
)
# The 'BUILD_BYPRODUCTS' argument was introduced in CMake 3.2.
if
(
${
CMAKE_VERSION
}
VERSION_LESS 3.2
)
ExternalProject_Add
(
ext_llvm
URL
${
LLVM_RELEASE_URL
}
URL_HASH SHA1=
${
LLVM_SHA1_HASH
}
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
INSTALL_COMMAND
""
UPDATE_COMMAND
""
)
ExternalProject_Get_Property
(
openmp SOURCE_DIR
)
set
(
OPENMP_SOURCE_DIR
${
SOURCE_DIR
}
)
if
(
DEFINED CMAKE_ASM_COMPILER
)
set
(
LLVM_CMAKE_ASM_COMPILER
${
CMAKE_ASM_COMPILER
}
)
else
()
ExternalProject_Add
(
ext_llvm
URL
${
LLVM_RELEASE_URL
}
URL_HASH SHA1=
${
LLVM_SHA1_HASH
}
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
INSTALL_COMMAND
""
UPDATE_COMMAND
""
BUILD_BYPRODUCTS
"
${
CMAKE_CURRENT_BINARY_DIR
}
/ext_llvm-prefix/src/ext_llvm/lib/libLLVMCore.a"
)
set
(
LLVM_CMAKE_ASM_COMPILER
${
CMAKE_C_COMPILER
}
)
endif
()
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
)
ExternalProject_Add
(
ext_llvm
DEPENDS clang openmp
GIT_REPOSITORY https://github.com/llvm-mirror/llvm.git
GIT_TAG
${
RELEASE_TAG
}
CMAKE_ARGS -DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
-DCMAKE_ASM_COMPILER=
${
LLVM_CMAKE_ASM_COMPILER
}
-DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
-DCMAKE_INSTALL_PREFIX=
${
EXTERNAL_INSTALL_LOCATION
}
-DCMAKE_BUILD_TYPE=Release
-DLLVM_ENABLE_ASSERTIONS=OFF
-DLLVM_INCLUDE_TESTS=OFF
-DLLVM_INCLUDE_EXAMPLES=OFF
-DLLVM_BUILD_TOOLS=ON
-DLLVM_TARGETS_TO_BUILD=X86
-DLLVM_EXTERNAL_CLANG_SOURCE_DIR=
${
CLANG_SOURCE_DIR
}
-DLLVM_EXTERNAL_OPENMP_SOURCE_DIR=
${
OPENMP_SOURCE_DIR
}
UPDATE_COMMAND
""
)
ExternalProject_Get_Property
(
ext_llvm SOURCE_DIR
)
ExternalProject_Get_Property
(
ext_llvm BINARY_DIR
)
ExternalProject_Get_Property
(
ext_llvm INSTALL_DIR
)
set
(
LLVM_INCLUDE_DIR
"
${
INSTALL_DIR
}
/include"
PARENT_SCOPE
)
set
(
LLVM_INCLUDE_DIR
"
${
SOURCE_DIR
}
/include"
)
# used by other external projects in current scope
set
(
LLVM_LIB_DIR
"
${
INSTALL_DIR
}
/lib"
PARENT_SCOPE
)
set
(
LLVM_LINK_LIBS
clangTooling
...
...
@@ -135,5 +157,4 @@ if((NGRAPH_CPU_ENABLE OR NGRAPH_GPU_ENABLE) AND (NOT ${CMAKE_SYSTEM_NAME} MATCHE
z
m
PARENT_SCOPE
)
endif
()
cmake/external_llvm_prebuilt.cmake
0 → 100644
View file @
6f171de6
# 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.
include
(
ExternalProject
)
if
((
NGRAPH_CPU_ENABLE OR NGRAPH_GPU_ENABLE
)
AND
(
NOT
${
CMAKE_SYSTEM_NAME
}
MATCHES
"Darwin"
)
AND
(
NOT
${
CMAKE_SYSTEM_NAME
}
MATCHES
"Windows"
))
message
(
STATUS
"Fetching LLVM from llvm.org"
)
# Override default LLVM binaries
if
(
NOT DEFINED LLVM_TARBALL_URL
)
set
(
LLVM_TARBALL_URL http://releases.llvm.org/5.0.1/clang+llvm-5.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz
)
endif
()
if
(
NOT DEFINED LLVM_SHA1_HASH
)
set
(
LLVM_SHA1_HASH 2fddf9a90b182fa594786be6923e58f5ead71e9c
)
endif
()
# The 'BUILD_BYPRODUCTS' argument was introduced in CMake 3.2.
if
(
${
CMAKE_VERSION
}
VERSION_LESS 3.2
)
ExternalProject_Add
(
ext_llvm
URL
${
LLVM_TARBALL_URL
}
URL_HASH SHA1=
${
LLVM_SHA1_HASH
}
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
INSTALL_COMMAND
""
UPDATE_COMMAND
""
)
else
()
ExternalProject_Add
(
ext_llvm
URL
${
LLVM_TARBALL_URL
}
URL_HASH SHA1=
${
LLVM_SHA1_HASH
}
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
INSTALL_COMMAND
""
UPDATE_COMMAND
""
BUILD_BYPRODUCTS
"
${
CMAKE_CURRENT_BINARY_DIR
}
/ext_llvm-prefix/src/ext_llvm/lib/libLLVMCore.a"
)
endif
()
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
clangTooling
clangFrontendTool
clangFrontend
clangDriver
clangSerialization
clangCodeGen
clangParse
clangSema
clangStaticAnalyzerFrontend
clangStaticAnalyzerCheckers
clangStaticAnalyzerCore
clangAnalysis
clangARCMigrate
clangRewriteFrontend
clangEdit
clangAST
clangLex
clangBasic
LLVMLTO
LLVMPasses
LLVMObjCARCOpts
LLVMSymbolize
LLVMDebugInfoPDB
LLVMDebugInfoDWARF
LLVMMIRParser
LLVMCoverage
LLVMTableGen
LLVMDlltoolDriver
LLVMOrcJIT
LLVMObjectYAML
LLVMLibDriver
LLVMOption
LLVMX86Disassembler
LLVMX86AsmParser
LLVMX86CodeGen
LLVMGlobalISel
LLVMSelectionDAG
LLVMAsmPrinter
LLVMDebugInfoCodeView
LLVMDebugInfoMSF
LLVMX86Desc
LLVMMCDisassembler
LLVMX86Info
LLVMX86AsmPrinter
LLVMX86Utils
LLVMMCJIT
LLVMLineEditor
LLVMInterpreter
LLVMExecutionEngine
LLVMRuntimeDyld
LLVMCodeGen
LLVMTarget
LLVMCoroutines
LLVMipo
LLVMInstrumentation
LLVMVectorize
LLVMScalarOpts
LLVMLinker
LLVMIRReader
LLVMAsmParser
LLVMInstCombine
LLVMTransformUtils
LLVMBitWriter
LLVMAnalysis
LLVMProfileData
LLVMObject
LLVMMCParser
LLVMMC
LLVMBitReader
LLVMCore
LLVMBinaryFormat
LLVMSupport
LLVMDemangle
tinfo
z
m
PARENT_SCOPE
)
endif
()
cmake/external_mkldnn.cmake
View file @
6f171de6
...
...
@@ -17,7 +17,7 @@ include(ExternalProject)
# Fetch and install MKL-DNN
#----------------------------------------------------------------------------------------------------------
if
(
NOT
${
CMAKE_SYSTEM_NAME
}
MATCHES
"Darwin"
)
if
(
N
GRAPH_CPU_ENABLE AND N
OT
${
CMAKE_SYSTEM_NAME
}
MATCHES
"Darwin"
)
set
(
MKLDNN_GIT_REPO_URL https://github.com/intel/mkl-dnn
)
set
(
MKLDNN_GIT_TAG
"3e1f8f5"
)
...
...
cmake/external_tbb.cmake
View file @
6f171de6
...
...
@@ -15,15 +15,17 @@
# Fetch and configure TBB
#----------------------------------------------------------------------------------------------------------
set
(
TBB_GIT_REPO_URL https://github.com/01org/tbb
)
set
(
TBB_GIT_TAG
"tbb_2018"
)
if
(
NGRAPH_TBB_ENABLE
)
set
(
TBB_GIT_REPO_URL https://github.com/01org/tbb
)
set
(
TBB_GIT_TAG
"tbb_2018"
)
if
(
NOT
${
CMAKE_SYSTEM_NAME
}
MATCHES
"Darwin"
)
configure_file
(
${
CMAKE_SOURCE_DIR
}
/cmake/tbb_fetch.cmake.in
${
CMAKE_CURRENT_BINARY_DIR
}
/tbb/CMakeLists.txt
)
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
-G
"
${
CMAKE_GENERATOR
}
"
.
WORKING_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/tbb"
)
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
--build .
WORKING_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/tbb"
)
if
(
NOT
${
CMAKE_SYSTEM_NAME
}
MATCHES
"Darwin"
)
configure_file
(
${
CMAKE_SOURCE_DIR
}
/cmake/tbb_fetch.cmake.in
${
CMAKE_CURRENT_BINARY_DIR
}
/tbb/CMakeLists.txt
)
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
-G
"
${
CMAKE_GENERATOR
}
"
.
WORKING_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/tbb"
)
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
--build .
WORKING_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
/tbb"
)
set
(
TBB_ROOT
${
CMAKE_CURRENT_BINARY_DIR
}
/tbb/tbb-src PARENT_SCOPE
)
set
(
TBB_ROOT
${
CMAKE_CURRENT_BINARY_DIR
}
/tbb/tbb-src PARENT_SCOPE
)
endif
()
endif
()
contrib/docker/Makefile
View file @
6f171de6
...
...
@@ -29,8 +29,8 @@ DBUILD_DIR = ${DIR}/contrib/docker/.build-${DBUILD_VERSION}
# For gcc builds, we do NOT regard warnings as errors
# For clang builds, we DO make warnings into errors
CMAKE_OPTIONS_COMMON
=
-DNGRAPH_BUILD_DOXYGEN_DOCS
=
ON
-DNGRAPH_BUILD_SPHINX_DOCS
=
ON
-DCMAKE_BUILD_TYPE
=
RelWithDebInfo
CMAKE_OPTIONS_GCC
=
$CMAKE_OPTIONS_COMMON
-DNGRAPH_INSTALL_PREFIX
=
${
DOCKUSER_HOME
}
/ngraph-cpp-test/BUILD-GCC/ngraph_dist
CMAKE_OPTIONS_CLANG
=
$CMAKE_OPTIONS_COMMON
-DNGRAPH_INSTALL_PREFIX
=
${
DOCKUSER_HOME
}
/ngraph-cpp-test/BUILD-CLANG/ngraph_dist
-DCMAKE_CXX_COMPILER
=
clang++-3.9
-DCMAKE_C_COMPILER
=
clang-3.9
-DNGRAPH_WARNINGS_AS_ERRORS
=
ON
CMAKE_OPTIONS_GCC
=
$CMAKE_OPTIONS_COMMON
-DNGRAPH_INSTALL_PREFIX
=
${
DOCKUSER_HOME
}
/ngraph-cpp-test/BUILD-GCC/ngraph_dist
-DNGRAPH_USE_PREBUILT_LLVM
=
TRUE
CMAKE_OPTIONS_CLANG
=
$CMAKE_OPTIONS_COMMON
-DNGRAPH_INSTALL_PREFIX
=
${
DOCKUSER_HOME
}
/ngraph-cpp-test/BUILD-CLANG/ngraph_dist
-DCMAKE_CXX_COMPILER
=
clang++-3.9
-DCMAKE_C_COMPILER
=
clang-3.9
-DNGRAPH_WARNINGS_AS_ERRORS
=
ON
-DNGRAPH_USE_PREBUILT_LLVM
=
TRUE
CALLER_UID
:=
$(
shell
id
-u
)
CALLER_GID
:=
$(
shell
id
-g
)
...
...
src/ngraph/CMakeLists.txt
View file @
6f171de6
...
...
@@ -137,14 +137,16 @@ if (NGRAPH_CPU_ENABLE AND LLVM_INCLUDE_DIR AND
MKLDNN_INCLUDE_DIR
)
find_package
(
ZLIB REQUIRED
)
include
(
${
TBB_ROOT
}
/cmake/TBBBuild.cmake
)
tbb_build
(
TBB_ROOT
${
TBB_ROOT
}
MAKE_ARGS compiler=clang tbb_build_dir=
${
CMAKE_CURRENT_BINARY_DIR
}
/tbb_build
tbb_build_prefix=tbb CONFIG_DIR TBB_DIR
)
find_package
(
TBB REQUIRED tbb
)
if
(
NOT TBB_FOUND
)
message
(
FATAL_ERROR
"TBB is needed by the CPU backend and was not found"
)
else
()
message
(
STATUS
"Found TBB and imported target
${
TBB_IMPORTED_TARGETS
}
"
)
if
(
NGRAPH_TBB_ENABLE
)
include
(
${
TBB_ROOT
}
/cmake/TBBBuild.cmake
)
tbb_build
(
TBB_ROOT
${
TBB_ROOT
}
MAKE_ARGS tbb_build_dir=
${
CMAKE_CURRENT_BINARY_DIR
}
/tbb_build
tbb_build_prefix=tbb CONFIG_DIR TBB_DIR
)
find_package
(
TBB REQUIRED tbb
)
if
(
NOT TBB_FOUND
)
message
(
FATAL_ERROR
"TBB is needed by the CPU backend and was not found"
)
else
()
message
(
STATUS
"Found TBB and imported target
${
TBB_IMPORTED_TARGETS
}
"
)
endif
()
endif
()
include_directories
(
SYSTEM
${
LLVM_INCLUDE_DIR
}
${
MKLDNN_INCLUDE_DIR
}
)
...
...
@@ -172,8 +174,14 @@ if (NGRAPH_CPU_ENABLE AND LLVM_INCLUDE_DIR AND
# The built-in headers are in a version-specific directory
# This must be kept in sync with the LLVM + Clang version in use
set_source_files_properties
(
codegen/compiler.cpp PROPERTIES COMPILE_FLAGS
"-fno-rtti"
)
set_source_files_properties
(
codegen/compiler.cpp PROPERTIES COMPILE_DEFINITIONS
"EIGEN_HEADERS_PATH=
\"
${
EIGEN_INCLUDE_DIR
}
\"
;MKLDNN_HEADERS_PATH=
\"
${
MKLDNN_INCLUDE_DIR
}
\"
;CLANG_BUILTIN_HEADERS_PATH=
\"
${
LLVM_LIB_DIR
}
/clang/5.0.0/include
\"
;TBB_HEADERS_PATH=
\"
${
TBB_ROOT
}
/include
\"
;NGRAPH_HEADERS_PATH=
\"
${
NGRAPH_INCLUDE_PATH
}
\"
;INSTALLED_HEADERS_PATH=
\"
${
CMAKE_INSTALL_PREFIX
}
/include
\"
;"
)
if
(
NGRAPH_TBB_ENABLE
)
set_source_files_properties
(
codegen/compiler.cpp PROPERTIES COMPILE_DEFINITIONS
"EIGEN_HEADERS_PATH=
\"
${
EIGEN_INCLUDE_DIR
}
\"
;MKLDNN_HEADERS_PATH=
\"
${
MKLDNN_INCLUDE_DIR
}
\"
;CLANG_BUILTIN_HEADERS_PATH=
\"
${
LLVM_LIB_DIR
}
/clang/5.0.1/include
\"
;TBB_HEADERS_PATH=
\"
${
TBB_ROOT
}
/include
\"
;NGRAPH_HEADERS_PATH=
\"
${
NGRAPH_INCLUDE_PATH
}
\"
;INSTALLED_HEADERS_PATH=
\"
${
CMAKE_INSTALL_PREFIX
}
/include
\"
;NGRAPH_TBB_ENABLE;"
)
set_source_files_properties
(
runtime/cpu/cpu_external_function.cpp PROPERTIES COMPILE_DEFINITIONS
"NGRAPH_TBB_ENABLE"
)
else
()
set_source_files_properties
(
codegen/compiler.cpp PROPERTIES COMPILE_DEFINITIONS
"EIGEN_HEADERS_PATH=
\"
${
EIGEN_INCLUDE_DIR
}
\"
;MKLDNN_HEADERS_PATH=
\"
${
MKLDNN_INCLUDE_DIR
}
\"
;CLANG_BUILTIN_HEADERS_PATH=
\"
${
LLVM_LIB_DIR
}
/clang/5.0.1/include
\"
;NGRAPH_HEADERS_PATH=
\"
${
NGRAPH_INCLUDE_PATH
}
\"
;INSTALLED_HEADERS_PATH=
\"
${
CMAKE_INSTALL_PREFIX
}
/include
\"
;"
)
endif
()
set
(
NGRAPH_CPU_DEBUGINFO_ENABLE 0 CACHE STRING
"Enable debuginfo in the CPU backend"
)
set_property
(
SOURCE codegen/compiler.cpp APPEND_STRING PROPERTY COMPILE_DEFINITIONS
"NGCPU_DEBUGINFO=
${
NGRAPH_CPU_DEBUGINFO_ENABLE
}
;"
)
...
...
@@ -292,7 +300,7 @@ if (NOT APPLE)
DESTINATION
"
${
NGRAPH_INSTALL_LIB
}
"
)
if
(
NGRAPH_
CPU
_ENABLE
)
if
(
NGRAPH_
TBB
_ENABLE
)
install
(
DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/tbb_build/tbb_release/
DESTINATION
${
NGRAPH_INSTALL_LIB
}
FILES_MATCHING PATTERN
"libtbb.so.*"
...
...
src/ngraph/codegen/compiler.cpp
View file @
6f171de6
...
...
@@ -270,6 +270,9 @@ std::unique_ptr<codegen::Module>
const
string
&
source
)
{
PreprocessorOptions
&
preprocessor_options
=
m_compiler
->
getInvocation
().
getPreprocessorOpts
();
preprocessor_options
.
RetainRemappedFileBuffers
=
true
;
if
(
!
m_precompiled_header_valid
&&
m_precomiled_header_source
.
empty
()
==
false
)
{
generate_pch
(
m_precomiled_header_source
);
...
...
src/ngraph/json.hpp
View file @
6f171de6
...
...
@@ -66,7 +66,12 @@ SOFTWARE.
#error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers"
#endif
#elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER))
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40900
// [Modified by Intel] The minimum GCC version below has been changed to
// gcc-4.8.5, from gcc-4.9.0. This library is not warranted to work with
// 4.8.5 due to certain compiler/runtime bugs, but testing seems to
// indicate that our usage of it is not actually triggering those bugs,
// since the relevant templates do not happen to be instantiated.
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40805
#error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
#endif
#endif
...
...
src/ngraph/runtime/cpu/cpu_external_function.cpp
View file @
6f171de6
...
...
@@ -93,6 +93,7 @@
#include "ngraph/runtime/cpu/cpu_emitter.hpp"
#include "ngraph/runtime/cpu/cpu_external_function.hpp"
#include "ngraph/runtime/cpu/ops/matmul_bias.hpp"
#include "ngraph/runtime/cpu/pass/cpu_fusion.hpp"
#include "ngraph/runtime/host_tensor_view.hpp"
using
namespace
std
;
...
...
@@ -223,6 +224,7 @@ void runtime::cpu::CPU_ExternalFunction::compile()
pass
::
Manager
pass_manager
;
// For now, just make everyone row-major.
pass_manager
.
register_pass
<
pass
::
CPUFusion
>
();
pass_manager
.
register_pass
<
pass
::
AssignLayout
<
descriptor
::
layout
::
DenseTensorViewLayout
>>
();
pass_manager
.
register_pass
<
pass
::
Liveness
>
();
pass_manager
.
register_pass
<
pass
::
MemoryLayout
>
(
64
);
...
...
@@ -247,7 +249,10 @@ void runtime::cpu::CPU_ExternalFunction::compile()
R"(// Generated by the NGraph CPU backend
#include <cmath>
#include <Eigen/Dense>
)"
;
writer
+=
R"(#include <Eigen/Dense>
#include "ngraph/runtime/aligned_buffer.hpp"
#include "ngraph/runtime/cpu/cpu_eigen_utils.hpp"
...
...
src/ngraph/runtime/interpreter/int_call_frame.cpp
View file @
6f171de6
...
...
@@ -313,7 +313,7 @@ void runtime::interpreter::INT_CallFrame::perform_nan_check(
const
float
*
data
=
reinterpret_cast
<
float
*>
(
tv
->
get_data_ptr
());
for
(
size_t
i
=
0
;
i
<
tv
->
get_element_count
();
i
++
)
{
if
(
isnan
(
data
[
i
]))
if
(
std
::
isnan
(
data
[
i
]))
{
if
(
op
)
{
...
...
@@ -332,7 +332,7 @@ void runtime::interpreter::INT_CallFrame::perform_nan_check(
const
double
*
data
=
reinterpret_cast
<
double
*>
(
tv
->
get_data_ptr
());
for
(
size_t
i
=
0
;
i
<
tv
->
get_element_count
();
i
++
)
{
if
(
isnan
(
data
[
i
]))
if
(
std
::
isnan
(
data
[
i
]))
{
if
(
op
)
{
...
...
src/resource/CMakeLists.txt
View file @
6f171de6
...
...
@@ -25,12 +25,21 @@ if (NGRAPH_CPU_ENABLE AND NOT APPLE)
set
(
HEADER_PATHS
"EIGEN_HEADERS_PATH=
\"
${
EIGEN_INCLUDE_DIR
}
\"
"
"MKLDNN_HEADERS_PATH=
\"
${
MKLDNN_INCLUDE_DIR
}
\"
"
"CLANG_BUILTIN_HEADERS_PATH=
\"
${
LLVM_LIB_DIR
}
/clang/5.0.0/include
\"
"
"TBB_HEADERS_PATH=
\"
${
TBB_ROOT
}
/include
\"
"
"CLANG_BUILTIN_HEADERS_PATH=
\"
${
LLVM_LIB_DIR
}
/clang/5.0.1/include
\"
"
"NGRAPH_HEADERS_PATH=
\"
${
NGRAPH_INCLUDE_PATH
}
\"
"
)
if
(
NGRAPH_TBB_ENABLE
)
list
(
APPEND HEADER_PATHS
"TBB_HEADERS_PATH=
\"
${
TBB_ROOT
}
/include
\"
"
)
endif
()
if
(
NGRAPH_TBB_ENABLE
)
set
(
NGRAPH_TBB_OPTION
"NGRAPH_TBB_ENABLE"
)
else
()
set
(
NGRAPH_TBB_OPTION
""
)
endif
()
message
(
"HEADER_PATHS
${
HEADER_PATHS
}
"
)
set_source_files_properties
(
main.cpp PROPERTIES COMPILE_DEFINITIONS
"
${
HEADER_PATHS
}
"
)
set_source_files_properties
(
main.cpp PROPERTIES COMPILE_DEFINITIONS
"
${
HEADER_PATHS
}
;
${
NGRAPH_TBB_OPTION
}
"
)
endif
()
src/resource/main.cpp
View file @
6f171de6
...
...
@@ -87,13 +87,17 @@ int main(int argc, char** argv)
vector
<
ResourceInfo
>
include_paths
;
include_paths
.
push_back
({
CLANG_BUILTIN_HEADERS_PATH
,
{},
true
});
include_paths
.
push_back
({
"/usr/include/x86_64-linux-gnu"
,
{
"asm"
,
"sys"
,
"bits"
,
"gnu"
}});
include_paths
.
push_back
({
"/usr/include"
,
{
"asm"
,
"sys"
,
"bits"
,
"gnu"
}});
include_paths
.
push_back
({
"/usr/include"
,
{
"linux"
,
"asm-generic"
}});
include_paths
.
push_back
({
cpp0
,
{
"bits"
}});
include_paths
.
push_back
({
"/usr/include/c++/4.8.2/x86_64-redhat-linux"
,
{
"bits"
}});
include_paths
.
push_back
({
cpp1
,
{
"bits"
,
"ext"
,
"debug"
,
"backward"
}});
include_paths
.
push_back
({
EIGEN_HEADERS_PATH
,
{},
true
});
include_paths
.
push_back
({
MKLDNN_HEADERS_PATH
,
{},
true
});
include_paths
.
push_back
({
NGRAPH_HEADERS_PATH
,
{},
true
});
#ifdef NGRAPH_TBB_ENABLE
include_paths
.
push_back
({
TBB_HEADERS_PATH
,
{},
true
});
#endif
if
(
output_path
.
empty
())
{
...
...
src/resource/util.cpp
View file @
6f171de6
...
...
@@ -130,6 +130,8 @@ void iterate_files_worker(const string& path,
{
DIR
*
dir
;
struct
dirent
*
ent
;
// If we cannot open the directory, we silently ignore it.
if
((
dir
=
opendir
(
path
.
c_str
()))
!=
nullptr
)
{
while
((
ent
=
readdir
(
dir
))
!=
nullptr
)
...
...
@@ -160,10 +162,6 @@ void iterate_files_worker(const string& path,
}
closedir
(
dir
);
}
else
{
throw
std
::
runtime_error
(
"error enumerating file "
+
path
);
}
}
void
iterate_files
(
const
string
&
path
,
...
...
third-party/CMakeLists.txt
View file @
6f171de6
...
...
@@ -14,6 +14,10 @@
include
(
../cmake/external_gtest.cmake
)
include
(
../cmake/external_eigen.cmake
)
include
(
../cmake/external_mkldnn.cmake
)
include
(
../cmake/external_llvm.cmake
)
if
(
NGRAPH_USE_PREBUILT_LLVM OR DEFINED LLVM_TARBALL_URL
)
include
(
../cmake/external_llvm_prebuilt.cmake
)
else
()
include
(
../cmake/external_llvm.cmake
)
endif
()
include
(
../cmake/external_tbb.cmake
)
include
(
../cmake/external_argon_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