Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
9d4425dd
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
694
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
9d4425dd
编写于
11月 12, 2018
作者:
T
Tao Luo
提交者:
GitHub
11月 12, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14227 from baojun-nervana/intel/ngraph_cmake
Adding Intel nGraph build
上级
8f9bfad2
5d20c422
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
110 addition
and
0 deletion
+110
-0
CMakeLists.txt
CMakeLists.txt
+4
-0
cmake/external/ngraph.cmake
cmake/external/ngraph.cmake
+92
-0
paddle/scripts/paddle_build.sh
paddle/scripts/paddle_build.sh
+2
-0
python/setup.py.in
python/setup.py.in
+12
-0
未找到文件。
CMakeLists.txt
浏览文件 @
9d4425dd
...
...
@@ -41,6 +41,7 @@ option(WITH_GPU "Compile PaddlePaddle with NVIDIA GPU" ${CUDA_F
option
(
WITH_AMD_GPU
"Compile PaddlePaddle with AMD GPU"
OFF
)
option
(
WITH_AVX
"Compile PaddlePaddle with AVX intrinsics"
${
AVX_FOUND
}
)
option
(
WITH_MKL
"Compile PaddlePaddle with MKL support."
${
AVX_FOUND
}
)
option
(
WITH_NGRAPH
"Compile PaddlePaddle with nGraph support."
OFF
)
option
(
WITH_DSO
"Compile PaddlePaddle with dynamic linked CUDA"
ON
)
option
(
WITH_TESTING
"Compile PaddlePaddle with unit testing"
OFF
)
option
(
WITH_SWIG_PY
"Compile PaddlePaddle with inference api"
ON
)
...
...
@@ -103,6 +104,8 @@ if(ANDROID OR IOS)
"Disable RDMA when cross-compiling for Android and iOS"
FORCE
)
set
(
WITH_MKL OFF CACHE STRING
"Disable MKL when cross-compiling for Android and iOS"
FORCE
)
set
(
WITH_NGRAPH OFF CACHE STRING
"Disable nGraph when cross-compiling for Android and iOS"
FORCE
)
set
(
WITH_GOLANG OFF CACHE STRING
"Disable golang when cross-compiling for Android and iOS"
FORCE
)
...
...
@@ -171,6 +174,7 @@ include(external/protobuf) # download, build, install protobuf
include
(
external/python
)
# download, build, install python
include
(
external/openblas
)
# download, build, install openblas
include
(
external/mkldnn
)
# download, build, install mkldnn
include
(
external/ngraph
)
# download, build, install nGraph
include
(
external/swig
)
# download, build, install swig
include
(
external/boost
)
# download boost
include
(
external/any
)
# download libn::any
...
...
cmake/external/ngraph.cmake
0 → 100644
浏览文件 @
9d4425dd
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# 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.
add_library
(
ngraph INTERFACE
)
IF
(
WIN32 OR APPLE
)
MESSAGE
(
WARNING
"Windows or Mac is not supported with nGraph in Paddle yet."
"Force WITH_NGRAPH=OFF"
)
SET
(
WITH_NGRAPH OFF CACHE STRING
"Disable nGraph in Windows and MacOS"
FORCE
)
ENDIF
()
IF
(
${
WITH_NGRAPH
}
AND NOT
${
WITH_MKLDNN
}
)
MESSAGE
(
WARNING
"nGraph needs mkl-dnn to be enabled."
"Force WITH_NGRAPH=OFF"
)
SET
(
WITH_NGRAPH OFF CACHE STRING
"Disable nGraph if mkl-dnn is disabled"
FORCE
)
ENDIF
()
IF
(
NOT
${
WITH_NGRAPH
}
)
return
()
ENDIF
()
INCLUDE
(
ExternalProject
)
SET
(
NGRAPH_PROJECT
"extern_ngraph"
)
SET
(
NGRAPH_VERSION
"0.9"
)
SET
(
NGRAPH_GIT_TAG
"f9fd9d4cc318dc59dd4b68448e7fbb5f67a28bd0"
)
SET
(
NGRAPH_SOURCES_DIR
${
THIRD_PARTY_PATH
}
/ngraph
)
SET
(
NGRAPH_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/ngraph
)
SET
(
NGRAPH_INC_DIR
${
NGRAPH_INSTALL_DIR
}
/include
)
SET
(
NGRAPH_SHARED_LIB_NAME libngraph.so.
${
NGRAPH_VERSION
}
)
SET
(
NGRAPH_CPU_LIB_NAME libcpu_backend.so
)
SET
(
NGRAPH_TBB_LIB_NAME libtbb.so.2
)
SET
(
NGRAPH_GIT_REPO
"https://github.com/NervanaSystems/ngraph.git"
)
ExternalProject_Add
(
${
NGRAPH_PROJECT
}
${
EXTERNAL_PROJECT_LOG_ARGS
}
DEPENDS
${
MKLDNN_PROJECT
}
${
MKLML_PROJECT
}
GIT_REPOSITORY
${
NGRAPH_GIT_REPO
}
GIT_TAG
${
NGRAPH_GIT_TAG
}
PREFIX
${
NGRAPH_SOURCES_DIR
}
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
NGRAPH_INSTALL_DIR
}
CMAKE_ARGS -DNGRAPH_UNIT_TEST_ENABLE=FALSE
CMAKE_ARGS -DNGRAPH_TOOLS_ENABLE=FALSE
CMAKE_ARGS -DNGRAPH_INTERPRETER_ENABLE=FALSE
CMAKE_ARGS -DNGRAPH_DEX_ONLY=TRUE
CMAKE_ARGS -DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
CMAKE_ARGS -DMKLDNN_INCLUDE_DIR=
${
MKLDNN_INC_DIR
}
CMAKE_ARGS -DMKLDNN_LIB_DIR=
${
MKLDNN_INSTALL_DIR
}
/lib
)
if
(
UNIX AND NOT APPLE
)
include
(
GNUInstallDirs
)
SET
(
NGRAPH_LIB_DIR
${
NGRAPH_INSTALL_DIR
}
/
${
CMAKE_INSTALL_LIBDIR
}
)
else
()
SET
(
NGRAPH_LIB_DIR
${
NGRAPH_INSTALL_DIR
}
/lib
)
endif
()
MESSAGE
(
STATUS
"nGraph lib will be installed at:
${
NGRAPH_LIB_DIR
}
"
)
SET
(
NGRAPH_SHARED_LIB
${
NGRAPH_LIB_DIR
}
/
${
NGRAPH_SHARED_LIB_NAME
}
)
SET
(
NGRAPH_CPU_LIB
${
NGRAPH_LIB_DIR
}
/
${
NGRAPH_CPU_LIB_NAME
}
)
SET
(
NGRAPH_TBB_LIB
${
NGRAPH_LIB_DIR
}
/
${
NGRAPH_TBB_LIB_NAME
}
)
# Workaround for nGraph expecting mklml to be in mkldnn install directory.
ExternalProject_Add_Step
(
${
NGRAPH_PROJECT
}
PrepareMKL
COMMAND
${
CMAKE_COMMAND
}
-E create_symlink
${
MKLML_LIB
}
${
MKLDNN_INSTALL_DIR
}
/lib/libmklml_intel.so
COMMAND
${
CMAKE_COMMAND
}
-E create_symlink
${
MKLML_IOMP_LIB
}
${
MKLDNN_INSTALL_DIR
}
/lib/libiomp5.so
DEPENDEES download
DEPENDERS configure
)
add_dependencies
(
ngraph
${
NGRAPH_PROJECT
}
)
target_compile_definitions
(
ngraph INTERFACE -DPADDLE_WITH_NGRAPH
)
target_include_directories
(
ngraph INTERFACE
${
NGRAPH_INC_DIR
}
)
target_link_libraries
(
ngraph INTERFACE
${
NGRAPH_SHARED_LIB
}
)
LIST
(
APPEND external_project_dependencies ngraph
)
paddle/scripts/paddle_build.sh
浏览文件 @
9d4425dd
...
...
@@ -139,6 +139,7 @@ function cmake_gen() {
-DWITH_AMD_GPU=
${
WITH_AMD_GPU
:-
OFF
}
-DWITH_DISTRIBUTE=
${
WITH_DISTRIBUTE
:-
OFF
}
-DWITH_MKL=
${
WITH_MKL
:-
ON
}
-DWITH_NGRAPH=
${
WITH_NGRAPH
:-
OFF
}
-DWITH_AVX=
${
WITH_AVX
:-
OFF
}
-DWITH_GOLANG=
${
WITH_GOLANG
:-
OFF
}
-DCUDA_ARCH_NAME=
${
CUDA_ARCH_NAME
:-
All
}
...
...
@@ -171,6 +172,7 @@ EOF
-DWITH_AMD_GPU
=
${
WITH_AMD_GPU
:-
OFF
}
\
-DWITH_DISTRIBUTE
=
${
WITH_DISTRIBUTE
:-
OFF
}
\
-DWITH_MKL
=
${
WITH_MKL
:-
ON
}
\
-DWITH_NGRAPH
=
${
WITH_NGRAPH
:-
OFF
}
\
-DWITH_AVX
=
${
WITH_AVX
:-
OFF
}
\
-DWITH_GOLANG
=
${
WITH_GOLANG
:-
OFF
}
\
-DCUDA_ARCH_NAME
=
${
CUDA_ARCH_NAME
:-
All
}
\
...
...
python/setup.py.in
浏览文件 @
9d4425dd
...
...
@@ -174,6 +174,18 @@ if '${CMAKE_BUILD_TYPE}' == 'Release':
raise Exception("patch libmkldnn.so failed, command: %s" % command)
package_data['paddle.libs']+=['libmkldnn.so.0']
shutil.copy('${MKLDNN_SHARED_LIB}', libs_path)
if '${WITH_NGRAPH}' == 'ON':
if '${CMAKE_BUILD_TYPE}' == 'Release':
# only change rpath in Release mode.
command = "patchelf --set-rpath '$ORIGIN/' ${NGRAPH_SHARED_LIB}"
if os.system(command) != 0:
raise Exception("patch ${NGRAPH_SHARED_LIB_NAME} failed, command: %s" % command)
shutil.copy('${NGRAPH_SHARED_LIB}', libs_path)
shutil.copy('${NGRAPH_CPU_LIB}', libs_path)
shutil.copy('${NGRAPH_TBB_LIB}', libs_path)
package_data['paddle.libs']+=['${NGRAPH_SHARED_LIB_NAME}',
'${NGRAPH_CPU_LIB_NAME}',
'${NGRAPH_TBB_LIB_NAME}']
# remove unused paddle/libs/__init__.py
os.remove(libs_path+'/__init__.py')
package_dir['paddle.libs']=libs_path
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录