Skip to content

Commit ee65272

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into fix_docker_build
2 parents a58d228 + 4fa3cee commit ee65272

File tree

2,484 files changed

+108342
-24721
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,484 files changed

+108342
-24721
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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ python/paddle/v2/fluid/tests/book/image_classification_resnet.inference.model/
55
python/paddle/v2/fluid/tests/book/image_classification_vgg.inference.model/
66
python/paddle/v2/fluid/tests/book/label_semantic_roles.inference.model/
77
*.DS_Store
8+
*.vs
89
build/
910
build_doc/
1011
*.user
@@ -15,6 +16,7 @@ build_doc/
1516
.cproject
1617
.pydevproject
1718
.settings/
19+
CMakeSettings.json
1820
Makefile
1921
.test_env/
2022
third_party/

.pre-commit-config.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ repos:
2323
- id: clang-format-with-version-check
2424
name: clang-format
2525
description: Format files with ClangFormat.
26-
entry: bash ./.clang_format.hook -i
26+
entry: bash ./tools/codestyle/clang_format.hook -i
2727
language: system
2828
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto)$
2929
- repo: local
@@ -34,6 +34,14 @@ repos:
3434
entry: bash ./tools/codestyle/cpplint_pre_commit.hook
3535
language: system
3636
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)$
3745
- repo: https://github.com/PaddlePaddle/pre-commit-golang
3846
sha: 8337620115c25ff8333f1b1a493bd031049bd7c0
3947
hooks:
@@ -44,7 +52,7 @@ repos:
4452
hooks:
4553
- id: copyright_checker
4654
name: copyright_checker
47-
entry: python ./.copyright.hook
55+
entry: python ./tools/codestyle/copyright.hook
4856
language: system
4957
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|py)$
5058
exclude: (?!.*third_party)^.*$ | (?!.*book)^.*$

.travis.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,15 @@ env:
1818
addons:
1919
ssh_known_hosts: 13.229.163.131
2020
before_install:
21+
# For pylint dockstring checker
22+
- sudo pip install pylint pytest astroid isort
2123
- |
2224
function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; }
2325
script:
2426
- |
2527
# 43min timeout
2628
paddle/scripts/paddle_docker_build.sh ${JOB}
2729
if [ $? -eq 0 ] || [ $? -eq 142 ]; then true; else exit 1; fi;
28-
- |
29-
if [[ "$JOB" != "doc" ]]; then exit 0; fi;
30-
# For document only
31-
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then exit 0; fi;
32-
if [[ "$TRAVIS_BRANCH" != "develop" && ! "$TRAVIS_BRANCH" =~ ^v[[:digit:]]+\.[[:digit:]]+(\.[[:digit:]]+)?(-\S*)?$ ]]; then exit 0; fi;
33-
export DEPLOY_DOCS_SH=https://raw.githubusercontent.com/PaddlePaddle/PaddlePaddle.org/master/scripts/deploy/deploy_docs.sh
34-
export DOCS_DIR=`pwd`
35-
cd ..
36-
curl $DEPLOY_DOCS_SH | bash -s $CONTENT_DEC_PASSWD $TRAVIS_BRANCH $DOCS_DIR $DOCS_DIR/build/doc/
3730
notifications:
3831
email:
3932
on_success: change

AUTHORS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
| backyes | Yan-Fei Wang |
55
| baiyfbupt | Yi-Fan Bai |
66
| beckett1124 | Bin Qi |
7+
| ChengduoZH | Cheng-Duo Zhao|
78
| chengxiaohua1105 | Xiao-Hua Cheng |
89
| cxwangyi, yiwangbaidu, wangkuiyi | Yi Wang |
910
| cxysteven | Xing-Yi Cheng |
@@ -21,6 +22,7 @@
2122
| jczaja | Jacek Czaja |
2223
| JiayiFeng | Jia-Yi Feng |
2324
| kbinias | Krzysztof Binias |
25+
| kexinzhao | Ke-Xin Zhao |
2426
| kuke | Yi-Bing Liu |
2527
| lcy-seso | Ying Cao |
2628
| lipeng-unisound | Peng Li |
@@ -44,6 +46,7 @@
4446
| tianbingsz | Tian-Bing Xu |
4547
| tpatejko | Tomasz Patejko |
4648
| typhoonzero | Yi Wu |
49+
| velconia | Qi-Yang Min |
4750
| wanghaoshuang | Hao-Shuang Wang |
4851
| wangyang59 | Yang Wang |
4952
| wangzhen-nlp | Zhen Wang |

CMakeLists.txt

Lines changed: 89 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ message(STATUS "CXX compiler: ${CMAKE_CXX_COMPILER}, version: "
2424
"${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
2525
message(STATUS "C compiler: ${CMAKE_C_COMPILER}, version: "
2626
"${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
27+
if(WIN32)
28+
set(CMAKE_STATIC_LIBRARY_PREFIX lib)
29+
endif(WIN32)
2730

28-
find_package(Sphinx)
2931
if(NOT CMAKE_CROSSCOMPILING)
3032
find_package(CUDA QUIET)
3133
endif(NOT CMAKE_CROSSCOMPILING)
@@ -42,7 +44,6 @@ option(WITH_MKL "Compile PaddlePaddle with MKL support." ${AVX_FO
4244
option(WITH_DSO "Compile PaddlePaddle with dynamic linked CUDA" ON)
4345
option(WITH_TESTING "Compile PaddlePaddle with unit testing" OFF)
4446
option(WITH_SWIG_PY "Compile PaddlePaddle with inference api" ON)
45-
option(WITH_STYLE_CHECK "Compile PaddlePaddle with style check" ON)
4647
option(WITH_PYTHON "Compile PaddlePaddle with python interpreter" ON)
4748
option(WITH_DOUBLE "Compile PaddlePaddle with double precision" OFF)
4849
option(WITH_RDMA "Compile PaddlePaddle with RDMA support" OFF)
@@ -57,10 +58,25 @@ option(WITH_FLUID_ONLY "Compile PaddlePaddle fluid only" OFF)
5758
option(WITH_GOLANG "Compile PaddlePaddle with GOLANG" OFF)
5859
option(GLIDE_INSTALL "Download and install go dependencies " ON)
5960
option(USE_NNPACK "Compile PaddlePaddle with NNPACK library" OFF)
60-
option(WITH_DISTRIBUTE "Compile with grpc distributed support" OFF)
61+
option(WITH_DISTRIBUTE "Compile with distributed support" OFF)
6162
option(USE_EIGEN_FOR_BLAS "Use matrix multiplication in Eigen" OFF)
63+
option(EIGEN_USE_THREADS "Compile with multi-threaded Eigen" OFF)
6264
option(WITH_ARM_FP16 "Use half precision support on armv8.2-a cpu" OFF)
6365
option(WITH_FAST_BUNDLE_TEST "Bundle tests that can be run in a single process together to reduce launch overhead" OFF)
66+
option(WITH_CONTRIB "Compile the third-party contributation" OFF)
67+
option(REPLACE_ENFORCE_GLOG "Replace PADDLE_ENFORCE with glog/CHECK for better debug." OFF)
68+
option(WITH_ANAKIN "Compile with Anakin library" OFF)
69+
option(WITH_GRPC "Use grpc as the default rpc framework" ${WITH_DISTRIBUTE})
70+
option(WITH_BRPC_RDMA "Use brpc rdma as the rpc protocal" OFF)
71+
option(WITH_INFERENCE "Compile fluid inference library" ON)
72+
option(WITH_SYSTEM_BLAS "Use system blas library" OFF)
73+
option(PY_VERSION "Compile PaddlePaddle with python3 support" ${PY_VERSION})
74+
75+
# PY_VERSION
76+
if(NOT PY_VERSION)
77+
set(PY_VERSION 2.7)
78+
endif()
79+
set(PYBIND11_PYTHON_VERSION ${PY_VERSION})
6480

6581
# CMAKE_BUILD_TYPE
6682
if(NOT CMAKE_BUILD_TYPE)
@@ -98,9 +114,17 @@ if(ANDROID OR IOS)
98114
add_definitions(-DPADDLE_MOBILE_INFERENCE)
99115
endif()
100116

117+
if (APPLE OR WIN32)
118+
set(WITH_MKL OFF CACHE STRING
119+
"Disable MKL for building on mac and windows" FORCE)
120+
endif()
121+
101122
set(THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING
102123
"A path setting third party libraries download & build directories.")
103124

125+
set(FLUID_INSTALL_DIR "${CMAKE_BINARY_DIR}/fluid_install_dir" CACHE STRING
126+
"A path setting fluid shared and static libraries")
127+
104128
if (WITH_C_API AND WITH_PYTHON)
105129
message(WARNING "It is suggest not embedded a python interpreter in Paddle "
106130
"when using C-API. It will give an unpredictable behavior when using a "
@@ -118,16 +142,23 @@ else()
118142
endif()
119143

120144
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)
145+
if (NOT DEFINED WITH_MKLDNN)
146+
if (WITH_MKL AND AVX2_FOUND)
147+
set(WITH_MKLDNN ON)
148+
else()
149+
message(STATUS "Do not have AVX2 intrinsics and disabled MKL-DNN")
150+
set(WITH_MKLDNN OFF)
151+
endif()
126152
endif()
127153

154+
if (REPLACE_ENFORCE_GLOG)
155+
add_definitions("-DREPLACE_ENFORCE_GLOG")
156+
endif()
128157
########################################################################################
129158

130159
include(external/mklml) # download mklml package
160+
include(external/xbyak) # download xbyak package
161+
include(external/libxsmm) # download, build, install libxsmm
131162
include(external/zlib) # download, build, install zlib
132163
include(external/gflags) # download, build, install gflags
133164
include(external/glog) # download, build, install glog
@@ -137,34 +168,68 @@ include(external/python) # download, build, install python
137168
include(external/openblas) # download, build, install openblas
138169
include(external/mkldnn) # download, build, install mkldnn
139170
include(external/swig) # download, build, install swig
140-
include(external/warpctc) # download, build, install warpctc
141171
include(external/boost) # download boost
142172
include(external/any) # download libn::any
143173
include(external/eigen) # download eigen3
144174
include(external/pybind11) # download pybind11
145175
include(external/cares)
146-
include(external/grpc)
176+
include(external/cub)
177+
178+
if (NOT WIN32)
179+
# there is no official support of snappystream, warpctc, nccl, cupti in windows
147180
include(external/snappy) # download snappy
148-
include(external/snappystream)
149-
include(external/threadpool)
181+
include(external/snappystream) # download snappystream
182+
include(external/warpctc) # download, build, install warpctc
183+
include(cupti)
184+
endif (NOT WIN32)
185+
186+
if(WITH_DISTRIBUTE)
187+
if(WITH_GRPC)
188+
include(external/grpc)
189+
message(STATUS "Use grpc framework.")
190+
else()
191+
message(STATUS "Use brpc framework.")
192+
include(external/leveldb)
193+
include(external/brpc)
194+
endif()
195+
endif()
196+
197+
if(WITH_BRPC_RDMA)
198+
message(STATUS "Use brpc with rdma.")
199+
if(WITH_GRPC)
200+
message(FATAL_ERROR "Can't use grpc with brpc rdma.")
201+
endif()
202+
if(NOT WITH_DISTRIBUTE)
203+
message(FATAL_ERROR "Can't use brpc rdma in no distribute env.")
204+
endif()
205+
endif()
206+
150207

208+
include(external/threadpool)
209+
include(flags) # set paddle compile flags
151210
include(cudnn) # set cudnn libraries, must before configure
152-
include(cupti)
153211
include(configure) # add paddle env configuration
212+
213+
if(WITH_GPU)
214+
include(cuda)
215+
include(tensorrt)
216+
include(external/anakin)
217+
elseif()
218+
set(WITH_ANAKIN OFF CACHE STRING "Anakin is used in GPU only now." FORCE)
219+
endif()
220+
154221
include(generic) # simplify cmake module
155222
include(package) # set paddle packages
156-
include(cpplint) # set paddle c++ style
157223
include(ccache) # set ccache for compilation
158224
include(util) # set unittest and link libs
159225
include(rdma) # set rdma libraries
160-
include(flags) # set paddle compile flags
161226
include(version) # set PADDLE_VERSION
162227
include(coveralls) # set code coverage
163228
include(inference_lib) # add paddle fluid inference libraries
164229

165230

166231
include_directories("${PADDLE_SOURCE_DIR}")
167-
include_directories("${PADDLE_SOURCE_DIR}/paddle/cuda/include")
232+
include_directories("${PADDLE_SOURCE_DIR}/paddle/legacy/cuda/include")
168233
include_directories("${CMAKE_CURRENT_BINARY_DIR}/proto")
169234
include_directories("${CMAKE_CURRENT_BINARY_DIR}/go/pserver/client/c")
170235

@@ -177,11 +242,6 @@ set(EXTERNAL_LIBS
177242
${PYTHON_LIBRARIES}
178243
)
179244

180-
if(WITH_GPU)
181-
include(cuda)
182-
include(tensorrt)
183-
endif(WITH_GPU)
184-
185245
if(WITH_AMD_GPU)
186246
find_package(HIP)
187247
include(hip)
@@ -191,6 +251,10 @@ if(WITH_MKLML)
191251
list(APPEND EXTERNAL_LIBS ${MKLML_IOMP_LIB})
192252
endif()
193253

254+
if(WITH_LIBXSMM)
255+
list(APPEND EXTERNAL_LIBS ${LIBXSMM_LIBS})
256+
endif()
257+
194258
if(WITH_MKLDNN)
195259
list(APPEND EXTERNAL_LIBS ${MKLDNN_LIB})
196260
endif()
@@ -202,10 +266,10 @@ endif(USE_NNPACK)
202266

203267
add_subdirectory(proto)
204268

205-
if(NOT MOBILE_INFERENCE)
269+
if(NOT MOBILE_INFERENCE AND NOT WITH_FLUID_ONLY)
206270
# "add_subdirectory(go)" should be placed after the following loine,
207271
# because it depends on paddle/optimizer.
208-
add_subdirectory(paddle/optimizer)
272+
add_subdirectory(paddle/legacy/optimizer)
209273
endif()
210274

211275
# "add_subdirectory(paddle)" and "add_subdirectory(python)" should be
@@ -226,5 +290,7 @@ if(WITH_PYTHON)
226290
endif()
227291

228292
if(WITH_DOC)
293+
find_package(Sphinx REQUIRED)
294+
find_python_module(recommonmark REQUIRED)
229295
add_subdirectory(doc)
230296
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)

Dockerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ ENV HOME /root
2323
COPY ./paddle/scripts/docker/root/ /root/
2424

2525
RUN apt-get update && \
26-
apt-get install -y --allow-downgrades \
27-
git python-pip python-dev openssh-server bison \
26+
apt-get install -y --allow-downgrades patchelf \
27+
git python-pip python-dev python-opencv openssh-server bison \
2828
libnccl2=2.1.2-1+cuda8.0 libnccl-dev=2.1.2-1+cuda8.0 \
2929
wget unzip unrar tar xz-utils bzip2 gzip coreutils ntp \
3030
curl sed grep graphviz libjpeg-dev zlib1g-dev \
3131
python-matplotlib gcc-4.8 g++-4.8 \
32-
automake locales clang-format swig doxygen cmake \
32+
automake locales clang-format swig cmake \
3333
liblapack-dev liblapacke-dev \
3434
clang-3.8 llvm-3.8 libclang-3.8-dev \
3535
net-tools libtool ccache && \
@@ -70,7 +70,7 @@ RUN localedef -i en_US -f UTF-8 en_US.UTF-8
7070
# specify sphinx version as 1.5.6 and remove -U option for [pip install -U
7171
# sphinx-rtd-theme] since -U option will cause sphinx being updated to newest
7272
# version(1.7.1 for now), which causes building documentation failed.
73-
RUN pip install --upgrade pip==9.0.3 && \
73+
RUN easy_install -U pip && \
7474
pip install -U wheel && \
7575
pip install -U docopt PyYAML sphinx==1.5.6 && \
7676
pip install sphinx-rtd-theme==0.1.9 recommonmark
@@ -79,6 +79,9 @@ RUN pip install pre-commit 'ipython==5.3.0' && \
7979
pip install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
8080
pip install opencv-python
8181

82+
#For docstring checker
83+
RUN pip install pylint pytest astroid isort LinkChecker
84+
8285
COPY ./python/requirements.txt /root/
8386
RUN pip install -r /root/requirements.txt
8487

@@ -101,6 +104,3 @@ RUN echo 'root:root' | chpasswd
101104
RUN sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
102105
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
103106
EXPOSE 22
104-
105-
# development image default do build work
106-
CMD ["bash", "/paddle/paddle/scripts/docker/build.sh"]

Dockerfile.android

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,3 @@ RUN mkdir -p ${ANDROID_TOOLCHAINS_DIR} && \
4040
unzip -q android-ndk-r14b-linux-x86_64.zip && \
4141
mv android-ndk-r14b ${ANDROID_NDK_HOME} && \
4242
rm -rf /opt/android-ndk-tmp
43-
44-
CMD ["bash", "/paddle/paddle/scripts/docker/build_android.sh"]

0 commit comments

Comments
 (0)