Skip to content

Commit ce99419

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into optimize-pyreader
test=develop
2 parents cc7f551 + 1001f8e commit ce99419

File tree

441 files changed

+20727
-5260
lines changed

Some content is hidden

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

441 files changed

+20727
-5260
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: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,12 @@ option(WITH_DISTRIBUTE "Compile with distributed support" OFF)
6262
option(USE_EIGEN_FOR_BLAS "Use matrix multiplication in Eigen" OFF)
6363
option(EIGEN_USE_THREADS "Compile with multi-threaded Eigen" OFF)
6464
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)
6665
option(WITH_CONTRIB "Compile the third-party contributation" OFF)
6766
option(REPLACE_ENFORCE_GLOG "Replace PADDLE_ENFORCE with glog/CHECK for better debug." OFF)
6867
option(WITH_ANAKIN "Compile with Anakin library" OFF)
6968
option(WITH_GRPC "Use grpc as the default rpc framework" ${WITH_DISTRIBUTE})
7069
option(WITH_BRPC_RDMA "Use brpc rdma as the rpc protocal" OFF)
71-
option(WITH_INFERENCE "Compile fluid inference library" ON)
70+
option(ON_INFER "Turn on inference optimization." OFF)
7271
option(WITH_INFERENCE_API_TEST "Test fluid inference high-level api interface" OFF)
7372
option(WITH_SYSTEM_BLAS "Use system blas library" OFF)
7473
option(PY_VERSION "Compile PaddlePaddle with python3 support" ${PY_VERSION})
@@ -127,6 +126,9 @@ set(THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING
127126
set(FLUID_INSTALL_DIR "${CMAKE_BINARY_DIR}/fluid_install_dir" CACHE STRING
128127
"A path setting fluid shared and static libraries")
129128

129+
set(FLUID_INFERENCE_INSTALL_DIR "${CMAKE_BINARY_DIR}/fluid_inference_install_dir" CACHE STRING
130+
"A path setting fluid inference shared and static libraries")
131+
130132
if (WITH_C_API AND WITH_PYTHON)
131133
message(WARNING "It is suggest not embedded a python interpreter in Paddle "
132134
"when using C-API. It will give an unpredictable behavior when using a "
@@ -176,6 +178,7 @@ include(external/eigen) # download eigen3
176178
include(external/pybind11) # download pybind11
177179
include(external/cares)
178180
include(external/cub)
181+
include(external/xxhash) # download xxhash
179182

180183
if (NOT WIN32)
181184
# there is no official support of snappystream, warpctc, nccl, cupti in windows
@@ -298,3 +301,11 @@ if(WITH_DOC)
298301
find_python_module(recommonmark REQUIRED)
299302
add_subdirectory(doc)
300303
endif()
304+
305+
if (ON_INFER)
306+
message(STATUS "On inference mode, will take place some specific optimization.")
307+
add_definitions(-DPADDLE_ON_INFERENCE)
308+
else()
309+
#TODO(luotao), combine this warning with `make inference_lib_dist` command.
310+
message(WARNING "On inference mode, will take place some specific optimization. Turn on the ON_INFER flag when building inference_lib only.")
311+
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/xxhash.cmake

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
INCLUDE(ExternalProject)
2+
3+
set(XXHASH_SOURCE_DIR ${THIRD_PARTY_PATH}/xxhash)
4+
set(XXHASH_INSTALL_DIR ${THIRD_PARTY_PATH}/install/xxhash)
5+
set(XXHASH_INCLUDE_DIR "${XXHASH_INSTALL_DIR}/include")
6+
7+
IF(WITH_STATIC_LIB)
8+
SET(BUILD_CMD make lib)
9+
ELSE()
10+
IF(APPLE)
11+
SET(BUILD_CMD sed -i \"\" "s/-Wstrict-prototypes -Wundef/-Wstrict-prototypes -Wundef -fPIC/g" ${XXHASH_SOURCE_DIR}/src/extern_xxhash/Makefile && make lib)
12+
ELSE(APPLE)
13+
SET(BUILD_CMD sed -i "s/-Wstrict-prototypes -Wundef/-Wstrict-prototypes -Wundef -fPIC/g" ${XXHASH_SOURCE_DIR}/src/extern_xxhash/Makefile && make lib)
14+
ENDIF(APPLE)
15+
ENDIF()
16+
17+
ExternalProject_Add(
18+
extern_xxhash
19+
${EXTERNAL_PROJECT_LOG_ARGS}
20+
GIT_REPOSITORY "https://github.com/Cyan4973/xxHash"
21+
GIT_TAG "v0.6.5"
22+
PREFIX ${XXHASH_SOURCE_DIR}
23+
DOWNLOAD_NAME "xxhash"
24+
UPDATE_COMMAND ""
25+
CONFIGURE_COMMAND ""
26+
BUILD_IN_SOURCE 1
27+
PATCH_COMMAND
28+
BUILD_COMMAND ${BUILD_CMD}
29+
INSTALL_COMMAND export PREFIX=${XXHASH_INSTALL_DIR}/ && make install
30+
TEST_COMMAND ""
31+
)
32+
33+
set(XXHASH_LIBRARIES "${XXHASH_INSTALL_DIR}/lib/libxxhash.a")
34+
INCLUDE_DIRECTORIES(${XXHASH_INCLUDE_DIR})
35+
36+
add_library(xxhash STATIC IMPORTED GLOBAL)
37+
set_property(TARGET xxhash PROPERTY IMPORTED_LOCATION ${XXHASH_LIBRARIES})
38+
include_directories(${XXHASH_INCLUDE_DIR})
39+
add_dependencies(xxhash extern_xxhash)
40+
41+
LIST(APPEND external_project_dependencies xxhash)
42+
43+
IF(WITH_C_API)
44+
INSTALL(DIRECTORY ${XXHASH_INCLUDE_DIR} DESTINATION third_party/xxhash)
45+
IF(ANDROID)
46+
INSTALL(FILES ${XXHASH_LIBRARIES} DESTINATION third_party/xxhash/lib/${ANDROID_ABI})
47+
ELSE()
48+
INSTALL(FILES ${XXHASH_LIBRARIES} DESTINATION third_party/xxhash/lib)
49+
ENDIF()
50+
ENDIF()

cmake/generic.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,13 @@ function(cc_library TARGET_NAME)
261261
add_dependencies(${TARGET_NAME} mklml)
262262
target_link_libraries(${TARGET_NAME} "-L${MKLML_LIB_DIR} -liomp5 -Wl,--as-needed")
263263
endif()
264+
# remove link to python, see notes at:
265+
# https://github.com/pybind/pybind11/blob/master/docs/compiling.rst#building-manually
266+
if("${cc_library_DEPS};" MATCHES "python;")
267+
list(REMOVE_ITEM cc_library_DEPS python)
268+
add_dependencies(${TARGET_NAME} python)
269+
target_link_libraries(${TARGET_NAME} "-Wl,-undefined,dynamic_lookup")
270+
endif()
264271
target_link_libraries(${TARGET_NAME} ${cc_library_DEPS})
265272
add_dependencies(${TARGET_NAME} ${cc_library_DEPS})
266273
endif()
@@ -311,6 +318,8 @@ function(cc_test TARGET_NAME)
311318
set_property(TEST ${TARGET_NAME} PROPERTY ENVIRONMENT FLAGS_cpu_deterministic=true)
312319
set_property(TEST ${TARGET_NAME} PROPERTY ENVIRONMENT FLAGS_init_allocated_mem=true)
313320
set_property(TEST ${TARGET_NAME} PROPERTY ENVIRONMENT FLAGS_cudnn_deterministic=true)
321+
# No unit test should exceed 10 minutes.
322+
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT 600)
314323
endif()
315324
endfunction(cc_test)
316325

@@ -629,6 +638,8 @@ function(py_test TARGET_NAME)
629638
PYTHONPATH=${PADDLE_BINARY_DIR}/python ${py_test_ENVS}
630639
${PYTHON_EXECUTABLE} -u ${py_test_SRCS} ${py_test_ARGS}
631640
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
641+
# No unit test should exceed 10 minutes.
642+
set_tests_properties(${TARGET_NAME} PROPERTIES TIMEOUT 600)
632643
endif()
633644
endfunction()
634645

0 commit comments

Comments
 (0)