Skip to content

Commit 1c5616b

Browse files
committed
Merge branch 'develop' of github.com:PaddlePaddle/Paddle into large_model_design_doc
2 parents cc1e949 + 26ff5a5 commit 1c5616b

File tree

2,610 files changed

+101875
-27212
lines changed

Some content is hidden

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

2,610 files changed

+101875
-27212
lines changed

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ BasedOnStyle: Google
1919
IndentWidth: 2
2020
TabWidth: 2
2121
ContinuationIndentWidth: 4
22-
AccessModifierOffset: -2 # The private/protected/public has no indent in class
22+
AccessModifierOffset: -1 # The private/protected/public has no indent in class
2323
Standard: Cpp11
2424
AllowAllParametersOfDeclarationOnNextLine: true
2525
BinPackParameters: false

.gitignore

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,3 @@ third_party/
2525

2626
# clion workspace.
2727
cmake-build-*
28-
29-
# generated while compiling
30-
paddle/pybind/pybind.h
31-
CMakeFiles
32-
cmake_install.cmake
33-
paddle/.timestamp
34-
python/paddlepaddle.egg-info/
35-
paddle/fluid/pybind/pybind.h
36-
python/paddle/version.py

.pre-commit-config.yaml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
repos:
12
- repo: https://github.com/Lucas-C/pre-commit-hooks.git
23
sha: v1.0.1
34
hooks:
@@ -22,9 +23,25 @@
2223
- id: clang-format-with-version-check
2324
name: clang-format
2425
description: Format files with ClangFormat.
25-
entry: bash ./.clang_format.hook -i
26+
entry: bash ./tools/codestyle/clang_format.hook -i
2627
language: system
2728
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto)$
29+
- repo: local
30+
hooks:
31+
- id: cpplint-cpp-source
32+
name: cpplint
33+
description: Check C++ code style using cpplint.py.
34+
entry: bash ./tools/codestyle/cpplint_pre_commit.hook
35+
language: system
36+
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx)$
37+
- repo: local
38+
hooks:
39+
- id: pylint-doc-string
40+
name: pylint
41+
description: Check python docstring style using docstring_checker.
42+
entry: bash ./tools/codestyle/pylint_pre_commit.hook
43+
language: system
44+
files: \.(py)$
2845
- repo: https://github.com/PaddlePaddle/pre-commit-golang
2946
sha: 8337620115c25ff8333f1b1a493bd031049bd7c0
3047
hooks:
@@ -35,7 +52,7 @@
3552
hooks:
3653
- id: copyright_checker
3754
name: copyright_checker
38-
entry: python ./.copyright.hook
55+
entry: python ./tools/codestyle/copyright.hook
3956
language: system
4057
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|py)$
4158
exclude: (?!.*third_party)^.*$ | (?!.*book)^.*$

.travis.yml

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,45 +12,24 @@ services:
1212
os:
1313
- linux
1414
env:
15-
- JOB=build_doc
15+
- JOB=doc
1616
- JOB=check_style
1717
- JOB=build_android
1818
addons:
19-
apt:
20-
packages:
21-
- gcc-4.8
22-
- g++-4.8
23-
- git
24-
- build-essential
25-
- python
26-
- python-pip
27-
- python2.7-dev
28-
- python-wheel
29-
- libboost-dev
30-
- curl
31-
- swig
32-
- graphviz
33-
- clang-format-3.8
34-
- automake
35-
- libtool
36-
- ccache
37-
ssh_known_hosts: 52.76.173.135
19+
ssh_known_hosts: 13.229.163.131
3820
before_install:
39-
- if [[ "$JOB" == "check_style" ]]; then sudo ln -s /usr/bin/clang-format-3.8 /usr/bin/clang-format; fi
40-
# Paddle is using protobuf 3.1 currently. Protobuf 3.2 breaks the compatibility. So we specify the python
41-
# protobuf version.
42-
- sudo pip install -r $TRAVIS_BUILD_DIR/python/requirements.txt
43-
- sudo pip install wheel sphinx==1.5.6 recommonmark sphinx-rtd-theme==0.1.9 virtualenv pre-commit LinkChecker
21+
# For pylint dockstring checker
22+
- sudo pip install pylint pytest astroid isort
4423
- |
4524
function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; }
4625
script:
4726
- |
4827
# 43min timeout
49-
if [[ "$JOB" == "build_android" ]]; then timeout 2580 docker run -it --rm -v "$TRAVIS_BUILD_DIR:/paddle" paddlepaddle/paddle:latest-dev-android;
50-
else timeout 2580 paddle/scripts/travis/${JOB}.sh; fi;
51-
RESULT=$?; if [ $RESULT -eq 0 ] || [ $RESULT -eq 142 ]; then true; else exit 1; fi;
28+
paddle/scripts/paddle_docker_build.sh ${JOB}
29+
if [ $? -eq 0 ] || [ $? -eq 142 ]; then true; else exit 1; fi;
5230
- |
53-
if [[ "$JOB" != "build_doc" ]]; then exit 0; fi;
31+
if [[ "$JOB" != "doc" ]]; then exit 0; fi;
32+
# For document only
5433
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then exit 0; fi;
5534
if [[ "$TRAVIS_BRANCH" != "develop" && ! "$TRAVIS_BRANCH" =~ ^v[[:digit:]]+\.[[:digit:]]+(\.[[:digit:]]+)?(-\S*)?$ ]]; then exit 0; fi;
5635
export DEPLOY_DOCS_SH=https://raw.githubusercontent.com/PaddlePaddle/PaddlePaddle.org/master/scripts/deploy/deploy_docs.sh

AUTHORS.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
|---|---|
33
| abhinavarora | Abhinav Arora |
44
| backyes | Yan-Fei Wang |
5+
| baiyfbupt | Yi-Fan Bai |
56
| beckett1124 | Bin Qi |
6-
| JiayiFeng | Jia-Yi Feng |
7+
| ChengduoZH | Cheng-Duo Zhao|
78
| chengxiaohua1105 | Xiao-Hua Cheng |
89
| cxwangyi, yiwangbaidu, wangkuiyi | Yi Wang |
910
| cxysteven | Xing-Yi Cheng |
1011
| dzhwinter | Zhi-Hong Dong |
12+
| dragonwarrior | Long Wang |
13+
| dyning | Yuning Du |
1114
| emailweixu | Wei Xu |
1215
| gangliao | Gang Liao |
1316
| gongweibao | Wei-Bao Gong |
@@ -16,6 +19,10 @@
1619
| hedaoyuan | Dao-Yuan He |
1720
| helinwang | He-Lin Wang |
1821
| jacquesqiao | Long-Fei Qiao |
22+
| jczaja | Jacek Czaja |
23+
| JiayiFeng | Jia-Yi Feng |
24+
| kbinias | Krzysztof Binias |
25+
| kexinzhao | Ke-Xin Zhao |
1926
| kuke | Yi-Bing Liu |
2027
| lcy-seso | Ying Cao |
2128
| lipeng-unisound | Peng Li |
@@ -24,15 +31,20 @@
2431
| llxxxll | Yong-Feng Liu |
2532
| luotao01 | Tao Luo |
2633
| lzhao4ever | Liang Zhao |
34+
| mozga-intel | Mateusz Ozga |
2735
| NHZlX | Zhao-Long Xing |
36+
| Noplz | Yuan Gao |
2837
| pakchoi | Chuan-Jiang Song |
38+
| panyx0718 | Xin Pan |
2939
| pengli09 | Peng Li |
3040
| pkuyym | Ya-Ming Yang |
41+
| pzelazko-intel | Pawel Zelazko |
3142
| QiJune | Jun Qi |
3243
| qingqing01 | Qing-Qing Dang |
3344
| reyoung | Yang Yu |
3445
| Superjom | Chun-Wei Yan |
3546
| tianbingsz | Tian-Bing Xu |
47+
| tpatejko | Tomasz Patejko |
3648
| typhoonzero | Yi Wu |
3749
| wanghaoshuang | Hao-Shuang Wang |
3850
| wangyang59 | Yang Wang |

CMakeLists.txt

Lines changed: 66 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ message(STATUS "CXX compiler: ${CMAKE_CXX_COMPILER}, version: "
2525
message(STATUS "C compiler: ${CMAKE_C_COMPILER}, version: "
2626
"${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
2727

28-
find_package(Sphinx)
2928
if(NOT CMAKE_CROSSCOMPILING)
3029
find_package(CUDA QUIET)
3130
endif(NOT CMAKE_CROSSCOMPILING)
@@ -36,12 +35,12 @@ include(simd)
3635

3736
################################ Configurations #######################################
3837
option(WITH_GPU "Compile PaddlePaddle with NVIDIA GPU" ${CUDA_FOUND})
38+
option(WITH_AMD_GPU "Compile PaddlePaddle with AMD GPU" OFF)
3939
option(WITH_AVX "Compile PaddlePaddle with AVX intrinsics" ${AVX_FOUND})
4040
option(WITH_MKL "Compile PaddlePaddle with MKL support." ${AVX_FOUND})
4141
option(WITH_DSO "Compile PaddlePaddle with dynamic linked CUDA" ON)
4242
option(WITH_TESTING "Compile PaddlePaddle with unit testing" OFF)
4343
option(WITH_SWIG_PY "Compile PaddlePaddle with inference api" ON)
44-
option(WITH_STYLE_CHECK "Compile PaddlePaddle with style check" ON)
4544
option(WITH_PYTHON "Compile PaddlePaddle with python interpreter" ON)
4645
option(WITH_DOUBLE "Compile PaddlePaddle with double precision" OFF)
4746
option(WITH_RDMA "Compile PaddlePaddle with RDMA support" OFF)
@@ -52,15 +51,21 @@ option(WITH_COVERAGE "Compile PaddlePaddle with code coverage" OFF)
5251
option(COVERALLS_UPLOAD "Package code coverage data to coveralls" OFF)
5352
option(ON_TRAVIS "Exclude special unit test on Travis CI" OFF)
5453
option(WITH_C_API "Compile PaddlePaddle with C-API(Prediction)" OFF)
55-
# TODO: Only compile PaddlePaddle fluid version by WITH_FLUID option.
56-
option(WITH_FLUID "Compile PaddlePaddle fluid only(TODO)" ON)
54+
option(WITH_FLUID_ONLY "Compile PaddlePaddle fluid only" OFF)
5755
option(WITH_GOLANG "Compile PaddlePaddle with GOLANG" OFF)
5856
option(GLIDE_INSTALL "Download and install go dependencies " ON)
5957
option(USE_NNPACK "Compile PaddlePaddle with NNPACK library" OFF)
60-
option(WITH_DISTRIBUTE "Compile with grpc distributed support" OFF)
58+
option(WITH_DISTRIBUTE "Compile with distributed support" OFF)
6159
option(USE_EIGEN_FOR_BLAS "Use matrix multiplication in Eigen" OFF)
60+
option(EIGEN_USE_THREADS "Compile with multi-threaded Eigen" OFF)
6261
option(WITH_ARM_FP16 "Use half precision support on armv8.2-a cpu" OFF)
6362
option(WITH_FAST_BUNDLE_TEST "Bundle tests that can be run in a single process together to reduce launch overhead" OFF)
63+
option(WITH_CONTRIB "Compile the third-party contributation" OFF)
64+
option(REPLACE_ENFORCE_GLOG "Replace PADDLE_ENFORCE with glog/CHECK for better debug." OFF)
65+
option(WITH_ANAKIN "Compile with Anakin library" OFF)
66+
option(WITH_GRPC "Use grpc as the default rpc framework" ${WITH_DISTRIBUTE})
67+
option(WITH_BRPC_RDMA "Use brpc rdma as the rpc protocal" OFF)
68+
option(WITH_SYSTEM_BLAS "Use system blas library" OFF)
6469

6570
# CMAKE_BUILD_TYPE
6671
if(NOT CMAKE_BUILD_TYPE)
@@ -101,14 +106,17 @@ endif()
101106
set(THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING
102107
"A path setting third party libraries download & build directories.")
103108

109+
set(FLUID_INSTALL_DIR "${CMAKE_BINARY_DIR}/fluid_install_dir" CACHE STRING
110+
"A path setting fluid shared and static libraries")
111+
104112
if (WITH_C_API AND WITH_PYTHON)
105113
message(WARNING "It is suggest not embedded a python interpreter in Paddle "
106114
"when using C-API. It will give an unpredictable behavior when using a "
107115
"different Python interpreter from compiling.")
108116
endif()
109117

110118
if (WITH_C_API)
111-
set(WITH_FLUID OFF CACHE STRING "Disable install fluid when compile the C_API" FORCE)
119+
set(WITH_FLUID_ONLY OFF CACHE STRING "Disable install fluid when compile the C_API" FORCE)
112120
endif()
113121

114122
if(MOBILE_INFERENCE)
@@ -118,13 +126,18 @@ else()
118126
endif()
119127

120128
set(WITH_MKLML ${WITH_MKL})
121-
if (WITH_MKL AND AVX2_FOUND)
122-
set(WITH_MKLDNN ON)
123-
else()
124-
message(STATUS "Do not have AVX2 intrinsics and disabled MKL-DNN")
125-
set(WITH_MKLDNN OFF)
129+
if (NOT DEFINED WITH_MKLDNN)
130+
if (WITH_MKL AND AVX2_FOUND)
131+
set(WITH_MKLDNN ON)
132+
else()
133+
message(STATUS "Do not have AVX2 intrinsics and disabled MKL-DNN")
134+
set(WITH_MKLDNN OFF)
135+
endif()
126136
endif()
127137

138+
if (REPLACE_ENFORCE_GLOG)
139+
add_definitions("-DREPLACE_ENFORCE_GLOG")
140+
endif()
128141
########################################################################################
129142

130143
include(external/mklml) # download mklml package
@@ -143,16 +156,37 @@ include(external/any) # download libn::any
143156
include(external/eigen) # download eigen3
144157
include(external/pybind11) # download pybind11
145158
include(external/cares)
146-
include(external/grpc)
159+
160+
if(WITH_DISTRIBUTE)
161+
if(WITH_GRPC)
162+
include(external/grpc)
163+
message(STATUS "Use grpc framework.")
164+
else()
165+
message(STATUS "Use brpc framework.")
166+
include(external/leveldb)
167+
include(external/brpc)
168+
endif()
169+
endif()
170+
171+
if(WITH_BRPC_RDMA)
172+
message(STATUS "Use brpc with rdma.")
173+
if(WITH_GRPC)
174+
message(FATAL_ERROR "Can't use grpc with brpc rdma.")
175+
endif()
176+
if(NOT WITH_DISTRIBUTE)
177+
message(FATAL_ERROR "Can't use brpc rdma in no distribute env.")
178+
endif()
179+
endif()
180+
147181
include(external/snappy) # download snappy
148182
include(external/snappystream)
183+
include(external/threadpool)
149184

150185
include(cudnn) # set cudnn libraries, must before configure
151186
include(cupti)
152187
include(configure) # add paddle env configuration
153188
include(generic) # simplify cmake module
154189
include(package) # set paddle packages
155-
include(cpplint) # set paddle c++ style
156190
include(ccache) # set ccache for compilation
157191
include(util) # set unittest and link libs
158192
include(rdma) # set rdma libraries
@@ -163,7 +197,7 @@ include(inference_lib) # add paddle fluid inference libraries
163197

164198

165199
include_directories("${PADDLE_SOURCE_DIR}")
166-
include_directories("${PADDLE_SOURCE_DIR}/paddle/cuda/include")
200+
include_directories("${PADDLE_SOURCE_DIR}/paddle/legacy/cuda/include")
167201
include_directories("${CMAKE_CURRENT_BINARY_DIR}/proto")
168202
include_directories("${CMAKE_CURRENT_BINARY_DIR}/go/pserver/client/c")
169203

@@ -178,7 +212,16 @@ set(EXTERNAL_LIBS
178212

179213
if(WITH_GPU)
180214
include(cuda)
181-
endif(WITH_GPU)
215+
include(tensorrt)
216+
include(external/anakin)
217+
else()
218+
set(WITH_ANAKIN OFF CACHE STRING "Anakin is valid only when GPU is set." FORCE)
219+
endif()
220+
221+
if(WITH_AMD_GPU)
222+
find_package(HIP)
223+
include(hip)
224+
endif(WITH_AMD_GPU)
182225

183226
if(WITH_MKLML)
184227
list(APPEND EXTERNAL_LIBS ${MKLML_IOMP_LIB})
@@ -195,10 +238,10 @@ endif(USE_NNPACK)
195238

196239
add_subdirectory(proto)
197240

198-
if(NOT MOBILE_INFERENCE)
241+
if(NOT MOBILE_INFERENCE AND NOT WITH_FLUID_ONLY)
199242
# "add_subdirectory(go)" should be placed after the following loine,
200243
# because it depends on paddle/optimizer.
201-
add_subdirectory(paddle/optimizer)
244+
add_subdirectory(paddle/legacy/optimizer)
202245
endif()
203246

204247
# "add_subdirectory(paddle)" and "add_subdirectory(python)" should be
@@ -219,5 +262,11 @@ if(WITH_PYTHON)
219262
endif()
220263

221264
if(WITH_DOC)
265+
find_package(Sphinx REQUIRED)
266+
find_python_module(recommonmark REQUIRED)
222267
add_subdirectory(doc)
223268
endif()
269+
270+
if (WITH_CONTRIB)
271+
add_subdirectory(paddle/contrib)
272+
endif()

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ PaddlePaddle uses this [Git branching model](http://nvie.com/posts/a-successful-
5858
create mode 100644 233
5959
```
6060

61+
NOTE: The `yapf` installed by `pip install pre-commit` and `conda install -c conda-forge pre-commit` is slightly different. Paddle developers use `pip install pre-commit`.
62+
6163
1. Build and test
6264

6365
Users can build PaddlePaddle natively on Linux and Mac OS X. But to unify the building environment and to make it easy for debugging, the recommended way is [using Docker](https://github.com/PaddlePaddle/Paddle/blob/develop/doc/howto/dev/build_en.md).
@@ -157,4 +159,4 @@ This will enable VLOG messages generated by `buddy_allocator.{h,cc}` and in the
157159
- verbose level 1: [framework](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/framework)
158160
- verbose level 3: [operators](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/operators)
159161
- verbose level 5: [memory](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/memory), [platform](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/platform)
160-
- verbose level 7: [math](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/math)
162+
- verbose level 7: [math](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/legacy/math)

0 commit comments

Comments
 (0)