Skip to content

Commit 38d32c9

Browse files
committed
merge develop
test=develop
2 parents eb18d53 + 9f68e9a commit 38d32c9

File tree

630 files changed

+31358
-7455
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

630 files changed

+31358
-7455
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ third_party/
2828
build_*
2929
# clion workspace.
3030
cmake-build-*
31+
model_test

CMakeLists.txt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ option(WITH_GPU "Compile PaddlePaddle with NVIDIA GPU" ${CUDA_F
4141
option(WITH_AMD_GPU "Compile PaddlePaddle with AMD GPU" OFF)
4242
option(WITH_AVX "Compile PaddlePaddle with AVX intrinsics" ${AVX_FOUND})
4343
option(WITH_MKL "Compile PaddlePaddle with MKL support." ${AVX_FOUND})
44+
option(WITH_NGRAPH "Compile PaddlePaddle with nGraph support." OFF)
4445
option(WITH_DSO "Compile PaddlePaddle with dynamic linked CUDA" ON)
4546
option(WITH_TESTING "Compile PaddlePaddle with unit testing" OFF)
4647
option(WITH_SWIG_PY "Compile PaddlePaddle with inference api" ON)
@@ -62,13 +63,12 @@ option(WITH_DISTRIBUTE "Compile with distributed support" OFF)
6263
option(USE_EIGEN_FOR_BLAS "Use matrix multiplication in Eigen" OFF)
6364
option(EIGEN_USE_THREADS "Compile with multi-threaded Eigen" OFF)
6465
option(WITH_ARM_FP16 "Use half precision support on armv8.2-a cpu" OFF)
65-
option(WITH_FAST_BUNDLE_TEST "Bundle tests that can be run in a single process together to reduce launch overhead" OFF)
6666
option(WITH_CONTRIB "Compile the third-party contributation" OFF)
6767
option(REPLACE_ENFORCE_GLOG "Replace PADDLE_ENFORCE with glog/CHECK for better debug." OFF)
6868
option(WITH_ANAKIN "Compile with Anakin library" OFF)
6969
option(WITH_GRPC "Use grpc as the default rpc framework" ${WITH_DISTRIBUTE})
7070
option(WITH_BRPC_RDMA "Use brpc rdma as the rpc protocal" OFF)
71-
option(WITH_INFERENCE "Compile fluid inference library" ON)
71+
option(ON_INFER "Turn on inference optimization." OFF)
7272
option(WITH_INFERENCE_API_TEST "Test fluid inference high-level api interface" OFF)
7373
option(WITH_SYSTEM_BLAS "Use system blas library" OFF)
7474
option(PY_VERSION "Compile PaddlePaddle with python3 support" ${PY_VERSION})
@@ -104,6 +104,8 @@ if(ANDROID OR IOS)
104104
"Disable RDMA when cross-compiling for Android and iOS" FORCE)
105105
set(WITH_MKL OFF CACHE STRING
106106
"Disable MKL when cross-compiling for Android and iOS" FORCE)
107+
set(WITH_NGRAPH OFF CACHE STRING
108+
"Disable nGraph when cross-compiling for Android and iOS" FORCE)
107109
set(WITH_GOLANG OFF CACHE STRING
108110
"Disable golang when cross-compiling for Android and iOS" FORCE)
109111

@@ -127,6 +129,9 @@ set(THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING
127129
set(FLUID_INSTALL_DIR "${CMAKE_BINARY_DIR}/fluid_install_dir" CACHE STRING
128130
"A path setting fluid shared and static libraries")
129131

132+
set(FLUID_INFERENCE_INSTALL_DIR "${CMAKE_BINARY_DIR}/fluid_inference_install_dir" CACHE STRING
133+
"A path setting fluid inference shared and static libraries")
134+
130135
if (WITH_C_API AND WITH_PYTHON)
131136
message(WARNING "It is suggest not embedded a python interpreter in Paddle "
132137
"when using C-API. It will give an unpredictable behavior when using a "
@@ -169,13 +174,15 @@ include(external/protobuf) # download, build, install protobuf
169174
include(external/python) # download, build, install python
170175
include(external/openblas) # download, build, install openblas
171176
include(external/mkldnn) # download, build, install mkldnn
177+
include(external/ngraph) # download, build, install nGraph
172178
include(external/swig) # download, build, install swig
173179
include(external/boost) # download boost
174180
include(external/any) # download libn::any
175181
include(external/eigen) # download eigen3
176182
include(external/pybind11) # download pybind11
177183
include(external/cares)
178184
include(external/cub)
185+
include(external/xxhash) # download xxhash
179186

180187
if (NOT WIN32)
181188
# there is no official support of snappystream, warpctc, nccl, cupti in windows
@@ -298,3 +305,11 @@ if(WITH_DOC)
298305
find_python_module(recommonmark REQUIRED)
299306
add_subdirectory(doc)
300307
endif()
308+
309+
if (ON_INFER)
310+
message(STATUS "On inference mode, will take place some specific optimization.")
311+
add_definitions(-DPADDLE_ON_INFERENCE)
312+
else()
313+
#TODO(luotao), combine this warning with `make inference_lib_dist` command.
314+
message(WARNING "On inference mode, will take place some specific optimization. Turn on the ON_INFER flag when building inference_lib only.")
315+
endif()

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ RUN pip3 install -U wheel && \
7575
pip3 install -U docopt PyYAML sphinx==1.5.6 && \
7676
pip3 install sphinx-rtd-theme==0.1.9 recommonmark && \
7777
easy_install -U pip && \
78-
pip install -U wheel && \
78+
pip install -U pip setuptools wheel && \
7979
pip install -U docopt PyYAML sphinx==1.5.6 && \
8080
pip install sphinx-rtd-theme==0.1.9 recommonmark
8181

82-
RUN pip3 install pre-commit 'ipython==5.3.0' && \
82+
RUN pip3 install 'pre-commit==1.10.4' 'ipython==5.3.0' && \
8383
pip3 install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
8484
pip3 install opencv-python && \
85-
pip install pre-commit 'ipython==5.3.0' && \
85+
pip install 'pre-commit==1.10.4' 'ipython==5.3.0' && \
8686
pip install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
8787
pip install opencv-python
8888

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33

44
[![Build Status](https://travis-ci.org/PaddlePaddle/Paddle.svg?branch=develop)](https://travis-ci.org/PaddlePaddle/Paddle)
5-
[![Documentation Status](https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat)](http://www.paddlepaddle.org/docs/develop/documentation/en/getstarted/index_en.html)
6-
[![Documentation Status](https://img.shields.io/badge/中文文档-最新-brightgreen.svg)](http://www.paddlepaddle.org/docs/develop/documentation/zh/getstarted/index_cn.html)
5+
[![Documentation Status](https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat)](http://paddlepaddle.org/documentation/docs/en/1.1/getstarted/index_en.html)
6+
[![Documentation Status](https://img.shields.io/badge/中文文档-最新-brightgreen.svg)](http://paddlepaddle.org/documentation/docs/zh/1.1/beginners_guide/index.html)
77
[![Release](https://img.shields.io/github/release/PaddlePaddle/Paddle.svg)](https://github.com/PaddlePaddle/Paddle/releases)
88
[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](LICENSE)
99

@@ -19,17 +19,17 @@ Our vision is to enable deep learning for everyone via PaddlePaddle.
1919
Please refer to our [release announcement](https://github.com/PaddlePaddle/Paddle/releases) to track the latest feature of PaddlePaddle.
2020

2121

22-
### Latest PaddlePaddle Release: [Fluid 0.15.0](https://github.com/PaddlePaddle/Paddle/tree/v0.15.0)
22+
### Latest PaddlePaddle Release: [Fluid 1.1.0](https://github.com/PaddlePaddle/Paddle/tree/release/1.1)
2323
### Install Latest Stable Release:
2424
```
2525
# Linux CPU
2626
pip install paddlepaddle
2727
# Linux GPU cuda9cudnn7
2828
pip install paddlepaddle-gpu
2929
# Linux GPU cuda8cudnn7
30-
pip install paddlepaddle-gpu==0.15.0.post87
30+
pip install paddlepaddle-gpu==1.1.0.post87
3131
# Linux GPU cuda8cudnn5
32-
pip install paddlepaddle-gpu==0.15.0.post85
32+
pip install paddlepaddle-gpu==1.1.0.post85
3333
3434
# For installation on other platform, refer to http://paddlepaddle.org/
3535
```
@@ -76,26 +76,26 @@ pip install paddlepaddle-gpu==0.15.0.post85
7676

7777
## Installation
7878

79-
It is recommended to read [this doc](http://paddlepaddle.org/documentation/docs/zh/0.15.0/new_docs/beginners_guide/install/install_doc.html) on our website.
79+
It is recommended to read [this doc](http://paddlepaddle.org/documentation/docs/zh/1.1/beginners_guide/index.html) on our website.
8080

8181
## Documentation
8282

83-
We provide [English](http://paddlepaddle.org/documentation/docs/en/0.15.0/getstarted/index_en.html) and
84-
[Chinese](http://paddlepaddle.org/documentation/docs/zh/0.15.0/new_docs/beginners_guide/index.html) documentation.
83+
We provide [English](http://paddlepaddle.org/documentation/docs/en/1.1/getstarted/index_en.html) and
84+
[Chinese](http://paddlepaddle.org/documentation/docs/zh/1.1/beginners_guide/index.html) documentation.
8585

8686
- [Deep Learning 101](https://github.com/PaddlePaddle/book)
8787

8888
You might want to start from this online interactive book that can run in a Jupyter Notebook.
8989

90-
- [Distributed Training](http://paddlepaddle.org/documentation/docs/zh/0.15.0/new_docs/user_guides/howto/training/cluster_howto.html)
90+
- [Distributed Training](http://paddlepaddle.org/documentation/docs/zh/1.1/user_guides/howto/training/cluster_howto.html)
9191

9292
You can run distributed training jobs on MPI clusters.
9393

94-
- [Python API](http://paddlepaddle.org/documentation/api/zh/0.15.0/fluid.html)
94+
- [Python API](http://paddlepaddle.org/documentation/api/zh/1.1/fluid.html)
9595

9696
Our new API enables much shorter programs.
9797

98-
- [How to Contribute](http://paddlepaddle.org/documentation/docs/zh/0.15.0/new_docs/advanced_usage/development/contribute_to_paddle.html)
98+
- [How to Contribute](http://paddlepaddle.org/documentation/docs/zh/1.1/advanced_usage/development/contribute_to_paddle.html)
9999

100100
We appreciate your contributions!
101101

benchmark/fluid/args.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,10 @@ def parse_args():
142142
choices=['reduce', 'all_reduce'],
143143
default='all_reduce',
144144
help='Specify the reduce strategy, can be reduce, all_reduce')
145+
parser.add_argument(
146+
'--fuse_broadcast_op',
147+
action='store_true',
148+
help='If set, would fuse multiple broadcast operators into one fused_broadcast operator.'
149+
)
145150
args = parser.parse_args()
146151
return args

benchmark/fluid/fluid_benchmark.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ def train_parallel(train_args, test_args, args, train_prog, test_prog,
177177
else:
178178
build_strategy.reduce_strategy = fluid.BuildStrategy(
179179
).ReduceStrategy.AllReduce
180+
build_strategy.fuse_broadcast_op = args.fuse_broadcast_op
180181

181182
avg_loss = train_args[0]
182183

@@ -240,7 +241,6 @@ def train_parallel(train_args, test_args, args, train_prog, test_prog,
240241

241242
if args.use_fake_data or args.use_reader_op:
242243
try:
243-
244244
fetch_ret = exe.run(fetch_list)
245245
except fluid.core.EOFException as eof:
246246
break

benchmark/fluid/run.sh

100644100755
File mode changed.

cmake/configure.cmake

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,7 @@ if(NOT WITH_PROFILER)
5050
endif(NOT WITH_PROFILER)
5151

5252
if(NOT CMAKE_CROSSCOMPILING)
53-
if(WITH_AVX AND AVX512F_FOUND)
54-
set(SIMD_FLAG ${AVX512F_FLAG})
55-
elseif(WITH_AVX AND AVX2_FOUND)
56-
set(SIMD_FLAG ${AVX2_FLAG})
57-
elseif(WITH_AVX AND AVX_FOUND)
53+
if(WITH_AVX AND AVX_FOUND)
5854
set(SIMD_FLAG ${AVX_FLAG})
5955
elseif(SSE3_FOUND)
6056
set(SIMD_FLAG ${SSE3_FLAG})

cmake/external/mkldnn.cmake

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,14 @@ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
3737
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}" "${MKLDNN_INSTALL_DIR}/lib")
3838

3939
INCLUDE_DIRECTORIES(${MKLDNN_INC_DIR}) # For MKLDNN code to include internal headers.
40-
INCLUDE_DIRECTORIES(${THIRD_PARTY_PATH}/install) # For Paddle code to include mkldnn.h
4140

4241
IF(${CBLAS_PROVIDER} STREQUAL "MKLML")
4342
SET(MKLDNN_DEPENDS ${MKLML_PROJECT})
4443
MESSAGE(STATUS "Build MKLDNN with MKLML ${MKLML_ROOT}")
4544
ELSE()
4645
MESSAGE(FATAL_ERROR "Should enable MKLML when build MKLDNN")
4746
ENDIF()
48-
SET(MKLDNN_FLAG "-Wno-error=strict-overflow -Wno-error=unused-result")
47+
SET(MKLDNN_FLAG "-Wno-error=strict-overflow -Wno-error=unused-result -Wno-error=array-bounds")
4948
SET(MKLDNN_FLAG "${MKLDNN_FLAG} -Wno-unused-result -Wno-unused-value")
5049
SET(MKLDNN_CFLAG "${CMAKE_C_FLAGS} ${MKLDNN_FLAG}")
5150
SET(MKLDNN_CXXFLAG "${CMAKE_CXX_FLAGS} ${MKLDNN_FLAG}")
@@ -54,7 +53,7 @@ ExternalProject_Add(
5453
${EXTERNAL_PROJECT_LOG_ARGS}
5554
DEPENDS ${MKLDNN_DEPENDS}
5655
GIT_REPOSITORY "https://github.com/01org/mkl-dnn.git"
57-
GIT_TAG "64e03a1939e0d526aa8e9f2e3f7dc0ad8d372944"
56+
GIT_TAG "21fb5f2af1dd14e132af4f1b79160977ee487818"
5857
PREFIX ${MKLDNN_SOURCES_DIR}
5958
UPDATE_COMMAND ""
6059
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}

cmake/external/ngraph.cmake

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
add_library(ngraph INTERFACE)
16+
17+
IF(WIN32 OR APPLE)
18+
MESSAGE(WARNING
19+
"Windows or Mac is not supported with nGraph in Paddle yet."
20+
"Force WITH_NGRAPH=OFF")
21+
SET(WITH_NGRAPH OFF CACHE STRING "Disable nGraph in Windows and MacOS" FORCE)
22+
ENDIF()
23+
24+
IF(${WITH_NGRAPH} AND NOT ${WITH_MKLDNN})
25+
MESSAGE(WARNING
26+
"nGraph needs mkl-dnn to be enabled."
27+
"Force WITH_NGRAPH=OFF")
28+
SET(WITH_NGRAPH OFF CACHE STRING "Disable nGraph if mkl-dnn is disabled" FORCE)
29+
ENDIF()
30+
31+
IF(NOT ${WITH_NGRAPH})
32+
return()
33+
ENDIF()
34+
35+
INCLUDE(ExternalProject)
36+
37+
SET(NGRAPH_PROJECT "extern_ngraph")
38+
SET(NGRAPH_VERSION "0.9")
39+
SET(NGRAPH_GIT_TAG "f9fd9d4cc318dc59dd4b68448e7fbb5f67a28bd0")
40+
SET(NGRAPH_SOURCES_DIR ${THIRD_PARTY_PATH}/ngraph)
41+
SET(NGRAPH_INSTALL_DIR ${THIRD_PARTY_PATH}/install/ngraph)
42+
SET(NGRAPH_INC_DIR ${NGRAPH_INSTALL_DIR}/include)
43+
SET(NGRAPH_SHARED_LIB_NAME libngraph.so.${NGRAPH_VERSION})
44+
SET(NGRAPH_CPU_LIB_NAME libcpu_backend.so)
45+
SET(NGRAPH_TBB_LIB_NAME libtbb.so.2)
46+
SET(NGRAPH_GIT_REPO "https://github.com/NervanaSystems/ngraph.git")
47+
48+
ExternalProject_Add(
49+
${NGRAPH_PROJECT}
50+
${EXTERNAL_PROJECT_LOG_ARGS}
51+
DEPENDS ${MKLDNN_PROJECT} ${MKLML_PROJECT}
52+
GIT_REPOSITORY ${NGRAPH_GIT_REPO}
53+
GIT_TAG ${NGRAPH_GIT_TAG}
54+
PREFIX ${NGRAPH_SOURCES_DIR}
55+
UPDATE_COMMAND ""
56+
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${NGRAPH_INSTALL_DIR}
57+
CMAKE_ARGS -DNGRAPH_UNIT_TEST_ENABLE=FALSE
58+
CMAKE_ARGS -DNGRAPH_TOOLS_ENABLE=FALSE
59+
CMAKE_ARGS -DNGRAPH_INTERPRETER_ENABLE=FALSE
60+
CMAKE_ARGS -DNGRAPH_DEX_ONLY=TRUE
61+
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
62+
CMAKE_ARGS -DMKLDNN_INCLUDE_DIR=${MKLDNN_INC_DIR}
63+
CMAKE_ARGS -DMKLDNN_LIB_DIR=${MKLDNN_INSTALL_DIR}/lib
64+
)
65+
66+
if(UNIX AND NOT APPLE)
67+
include(GNUInstallDirs)
68+
SET(NGRAPH_LIB_DIR ${NGRAPH_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR})
69+
else()
70+
SET(NGRAPH_LIB_DIR ${NGRAPH_INSTALL_DIR}/lib)
71+
endif()
72+
MESSAGE(STATUS "nGraph lib will be installed at: ${NGRAPH_LIB_DIR}")
73+
74+
SET(NGRAPH_SHARED_LIB ${NGRAPH_LIB_DIR}/${NGRAPH_SHARED_LIB_NAME})
75+
SET(NGRAPH_CPU_LIB ${NGRAPH_LIB_DIR}/${NGRAPH_CPU_LIB_NAME})
76+
SET(NGRAPH_TBB_LIB ${NGRAPH_LIB_DIR}/${NGRAPH_TBB_LIB_NAME})
77+
78+
# Workaround for nGraph expecting mklml to be in mkldnn install directory.
79+
ExternalProject_Add_Step(
80+
${NGRAPH_PROJECT}
81+
PrepareMKL
82+
COMMAND ${CMAKE_COMMAND} -E create_symlink ${MKLML_LIB} ${MKLDNN_INSTALL_DIR}/lib/libmklml_intel.so
83+
COMMAND ${CMAKE_COMMAND} -E create_symlink ${MKLML_IOMP_LIB} ${MKLDNN_INSTALL_DIR}/lib/libiomp5.so
84+
DEPENDEES download
85+
DEPENDERS configure
86+
)
87+
88+
add_dependencies(ngraph ${NGRAPH_PROJECT})
89+
target_compile_definitions(ngraph INTERFACE -DPADDLE_WITH_NGRAPH)
90+
target_include_directories(ngraph INTERFACE ${NGRAPH_INC_DIR})
91+
target_link_libraries(ngraph INTERFACE ${NGRAPH_SHARED_LIB})
92+
LIST(APPEND external_project_dependencies ngraph)

0 commit comments

Comments
 (0)