Skip to content

Commit ba84a6b

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into change_manylinux1_Docker
2 parents e38eca2 + d068493 commit ba84a6b

File tree

1,988 files changed

+66462
-15448
lines changed

Some content is hidden

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

1,988 files changed

+66462
-15448
lines changed

.pre-commit-config.yaml

Lines changed: 2 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
@@ -52,7 +52,7 @@ repos:
5252
hooks:
5353
- id: copyright_checker
5454
name: copyright_checker
55-
entry: python ./.copyright.hook
55+
entry: python ./tools/codestyle/copyright.hook
5656
language: system
5757
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|py)$
5858
exclude: (?!.*third_party)^.*$ | (?!.*book)^.*$

.travis.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,6 @@ script:
2727
# 43min timeout
2828
paddle/scripts/paddle_docker_build.sh ${JOB}
2929
if [ $? -eq 0 ] || [ $? -eq 142 ]; then true; else exit 1; fi;
30-
- |
31-
if [[ "$JOB" != "doc" ]]; then exit 0; fi;
32-
# For document only
33-
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then exit 0; fi;
34-
if [[ "$TRAVIS_BRANCH" != "develop" && ! "$TRAVIS_BRANCH" =~ ^v[[:digit:]]+\.[[:digit:]]+(\.[[:digit:]]+)?(-\S*)?$ ]]; then exit 0; fi;
35-
export DEPLOY_DOCS_SH=https://raw.githubusercontent.com/PaddlePaddle/PaddlePaddle.org/master/scripts/deploy/deploy_docs.sh
36-
export DOCS_DIR=`pwd`
37-
cd ..
38-
curl $DEPLOY_DOCS_SH | bash -s $CONTENT_DEC_PASSWD $TRAVIS_BRANCH $DOCS_DIR $DOCS_DIR/build/doc/
3930
notifications:
4031
email:
4132
on_success: change

AUTHORS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
| jczaja | Jacek Czaja |
2323
| JiayiFeng | Jia-Yi Feng |
2424
| kbinias | Krzysztof Binias |
25+
| kexinzhao | Ke-Xin Zhao |
2526
| kuke | Yi-Bing Liu |
2627
| lcy-seso | Ying Cao |
2728
| lipeng-unisound | Peng Li |
@@ -45,6 +46,7 @@
4546
| tianbingsz | Tian-Bing Xu |
4647
| tpatejko | Tomasz Patejko |
4748
| typhoonzero | Yi Wu |
49+
| velconia | Qi-Yang Min |
4850
| wanghaoshuang | Hao-Shuang Wang |
4951
| wangyang59 | Yang Wang |
5052
| wangzhen-nlp | Zhen Wang |

CMakeLists.txt

Lines changed: 67 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,25 @@ option(WITH_FLUID_ONLY "Compile PaddlePaddle fluid only" OFF)
5555
option(WITH_GOLANG "Compile PaddlePaddle with GOLANG" OFF)
5656
option(GLIDE_INSTALL "Download and install go dependencies " ON)
5757
option(USE_NNPACK "Compile PaddlePaddle with NNPACK library" OFF)
58-
option(WITH_DISTRIBUTE "Compile with grpc distributed support" OFF)
58+
option(WITH_DISTRIBUTE "Compile with distributed support" OFF)
5959
option(USE_EIGEN_FOR_BLAS "Use matrix multiplication in Eigen" OFF)
6060
option(EIGEN_USE_THREADS "Compile with multi-threaded Eigen" OFF)
6161
option(WITH_ARM_FP16 "Use half precision support on armv8.2-a cpu" OFF)
6262
option(WITH_FAST_BUNDLE_TEST "Bundle tests that can be run in a single process together to reduce launch overhead" OFF)
6363
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_INFERENCE "Compile fluid inference library" ON)
69+
option(WITH_SYSTEM_BLAS "Use system blas library" OFF)
70+
option(PY_VERSION "Compile PaddlePaddle with python3 support" ${PY_VERSION})
71+
72+
# PY_VERSION
73+
if(NOT PY_VERSION)
74+
set(PY_VERSION 2.7)
75+
endif()
76+
set(PYBIND11_PYTHON_VERSION ${PY_VERSION})
6477

6578
# CMAKE_BUILD_TYPE
6679
if(NOT CMAKE_BUILD_TYPE)
@@ -98,6 +111,11 @@ if(ANDROID OR IOS)
98111
add_definitions(-DPADDLE_MOBILE_INFERENCE)
99112
endif()
100113

114+
if (APPLE OR WIN32)
115+
set(WITH_MKL OFF CACHE STRING
116+
"Disable MKL for building on mac and windows" FORCE)
117+
endif()
118+
101119
set(THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING
102120
"A path setting third party libraries download & build directories.")
103121

@@ -120,6 +138,12 @@ else()
120138
set(THIRD_PARTY_BUILD_TYPE Release)
121139
endif()
122140

141+
if(WITH_MKL)
142+
option(MKL_SPLIT_GEMM "PaddlePaddle MKL gemm would split to small ones" OFF)
143+
if (MKL_SPLIT_GEMM)
144+
add_definitions(-DPADDLE_MKL_SPLIT_GEMM)
145+
endif()
146+
endif()
123147
set(WITH_MKLML ${WITH_MKL})
124148
if (NOT DEFINED WITH_MKLDNN)
125149
if (WITH_MKL AND AVX2_FOUND)
@@ -129,9 +153,15 @@ if (NOT DEFINED WITH_MKLDNN)
129153
set(WITH_MKLDNN OFF)
130154
endif()
131155
endif()
156+
157+
if (REPLACE_ENFORCE_GLOG)
158+
add_definitions("-DREPLACE_ENFORCE_GLOG")
159+
endif()
132160
########################################################################################
133161

134162
include(external/mklml) # download mklml package
163+
include(external/xbyak) # download xbyak package
164+
include(external/libxsmm) # download, build, install libxsmm
135165
include(external/zlib) # download, build, install zlib
136166
include(external/gflags) # download, build, install gflags
137167
include(external/glog) # download, build, install glog
@@ -147,11 +177,40 @@ include(external/any) # download libn::any
147177
include(external/eigen) # download eigen3
148178
include(external/pybind11) # download pybind11
149179
include(external/cares)
150-
include(external/grpc)
180+
include(external/cub)
181+
182+
if(WITH_DISTRIBUTE)
183+
if(WITH_GRPC)
184+
include(external/grpc)
185+
message(STATUS "Use grpc framework.")
186+
else()
187+
message(STATUS "Use brpc framework.")
188+
include(external/leveldb)
189+
include(external/brpc)
190+
endif()
191+
endif()
192+
193+
if(WITH_BRPC_RDMA)
194+
message(STATUS "Use brpc with rdma.")
195+
if(WITH_GRPC)
196+
message(FATAL_ERROR "Can't use grpc with brpc rdma.")
197+
endif()
198+
if(NOT WITH_DISTRIBUTE)
199+
message(FATAL_ERROR "Can't use brpc rdma in no distribute env.")
200+
endif()
201+
endif()
202+
151203
include(external/snappy) # download snappy
152204
include(external/snappystream)
153205
include(external/threadpool)
154206

207+
set(WITH_ANAKIN OFF CACHE STRING "Disable Anakin first, will add it later." FORCE)
208+
if(WITH_GPU)
209+
include(cuda)
210+
include(tensorrt)
211+
include(external/anakin)
212+
endif()
213+
155214
include(cudnn) # set cudnn libraries, must before configure
156215
include(cupti)
157216
include(configure) # add paddle env configuration
@@ -167,7 +226,7 @@ include(inference_lib) # add paddle fluid inference libraries
167226

168227

169228
include_directories("${PADDLE_SOURCE_DIR}")
170-
include_directories("${PADDLE_SOURCE_DIR}/paddle/cuda/include")
229+
include_directories("${PADDLE_SOURCE_DIR}/paddle/legacy/cuda/include")
171230
include_directories("${CMAKE_CURRENT_BINARY_DIR}/proto")
172231
include_directories("${CMAKE_CURRENT_BINARY_DIR}/go/pserver/client/c")
173232

@@ -180,11 +239,6 @@ set(EXTERNAL_LIBS
180239
${PYTHON_LIBRARIES}
181240
)
182241

183-
if(WITH_GPU)
184-
include(cuda)
185-
include(tensorrt)
186-
endif(WITH_GPU)
187-
188242
if(WITH_AMD_GPU)
189243
find_package(HIP)
190244
include(hip)
@@ -194,6 +248,10 @@ if(WITH_MKLML)
194248
list(APPEND EXTERNAL_LIBS ${MKLML_IOMP_LIB})
195249
endif()
196250

251+
if(WITH_LIBXSMM)
252+
list(APPEND EXTERNAL_LIBS ${LIBXSMM_LIBS})
253+
endif()
254+
197255
if(WITH_MKLDNN)
198256
list(APPEND EXTERNAL_LIBS ${MKLDNN_LIB})
199257
endif()
@@ -208,7 +266,7 @@ add_subdirectory(proto)
208266
if(NOT MOBILE_INFERENCE AND NOT WITH_FLUID_ONLY)
209267
# "add_subdirectory(go)" should be placed after the following loine,
210268
# because it depends on paddle/optimizer.
211-
add_subdirectory(paddle/optimizer)
269+
add_subdirectory(paddle/legacy/optimizer)
212270
endif()
213271

214272
# "add_subdirectory(paddle)" and "add_subdirectory(python)" should be
@@ -233,7 +291,3 @@ if(WITH_DOC)
233291
find_python_module(recommonmark REQUIRED)
234292
add_subdirectory(doc)
235293
endif()
236-
237-
if (WITH_CONTRIB)
238-
add_subdirectory(paddle/contrib)
239-
endif()

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,4 @@ This will enable VLOG messages generated by `buddy_allocator.{h,cc}` and in the
159159
- verbose level 1: [framework](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/framework)
160160
- verbose level 3: [operators](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/operators)
161161
- verbose level 5: [memory](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/memory), [platform](https://github.com/PaddlePaddle/Paddle/tree/develop/paddle/platform)
162-
- 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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ 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 \
@@ -80,7 +80,7 @@ RUN pip install pre-commit 'ipython==5.3.0' && \
8080
pip install opencv-python
8181

8282
#For docstring checker
83-
RUN pip install pylint pytest astroid isort
83+
RUN pip install pylint pytest astroid isort LinkChecker
8484

8585
COPY ./python/requirements.txt /root/
8686
RUN pip install -r /root/requirements.txt

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
[![Build Status](https://travis-ci.org/PaddlePaddle/Paddle.svg?branch=develop)](https://travis-ci.org/PaddlePaddle/Paddle)
55
[![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)
66
[![Documentation Status](https://img.shields.io/badge/中文文档-最新-brightgreen.svg)](http://www.paddlepaddle.org/docs/develop/documentation/zh/getstarted/index_cn.html)
7-
[![Coverage Status](https://coveralls.io/repos/github/PaddlePaddle/Paddle/badge.svg?branch=develop)](https://coveralls.io/github/PaddlePaddle/Paddle?branch=develop)
87
[![Release](https://img.shields.io/github/release/PaddlePaddle/Paddle.svg)](https://github.com/PaddlePaddle/Paddle/releases)
98
[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](LICENSE)
109

@@ -19,6 +18,22 @@ learning to many products at Baidu.
1918
Our vision is to enable deep learning for everyone via PaddlePaddle.
2019
Please refer to our [release announcement](https://github.com/PaddlePaddle/Paddle/releases) to track the latest feature of PaddlePaddle.
2120

21+
22+
### Latest PaddlePaddle Release: [Fluid 0.14.0](https://github.com/PaddlePaddle/Paddle/tree/v0.14.0)
23+
### Install Latest Stable Release:
24+
```
25+
# Linux CPU
26+
pip install paddlepaddle
27+
# Linux GPU cuda9cudnn7
28+
pip install paddlepaddle-gpu
29+
# Linux GPU cuda8cudnn7
30+
pip install paddlepaddle-gpu==0.14.0.post87
31+
# Linux GPU cuda8cudnn5
32+
pip install paddlepaddle-gpu==0.14.0.post85
33+
34+
# For installation on other platform, refer to http://paddlepaddle.org/
35+
```
36+
2237
## Features
2338

2439
- **Flexibility**

benchmark/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ paddle/rnn/imdb.pkl
77
caffe/image/logs
88
tensorflow/image/logs
99
tensorflow/rnn/logs
10+
fluid/models/*.pyc
11+
fluid/logs
12+
fluid/nohup.out

benchmark/fluid/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
2+
3+
# Use UBUNTU_MIRROR can speed up apt-get speed.
4+
# ARG UBUNTU_MIRROR
5+
# RUN /bin/bash -c 'if [[ -n ${UBUNTU_MIRROR} ]]; then sed -i 's#http://archive.ubuntu.com/ubuntu#${UBUNTU_MIRROR}#g' /etc/apt/sources.list; fi'
6+
7+
RUN apt-get update && apt-get install -y python python-pip iputils-ping libgtk2.0-dev wget vim net-tools iftop python-opencv
8+
RUN ln -s /usr/lib/x86_64-linux-gnu/libcudnn.so.7 /usr/lib/libcudnn.so && ln -s /usr/lib/x86_64-linux-gnu/libnccl.so.2 /usr/lib/libnccl.so
9+
10+
# IMPORTANT:
11+
# Add "ENV http_proxy=http://ip:port" if your download is slow, and don't forget to unset it at runtime.
12+
# exmaple: unset http_proxy && unset https_proxy && python fluid_benchmark.py ...
13+
14+
RUN pip install -U pip
15+
RUN pip install -U kubernetes paddlepaddle
16+
17+
RUN sh -c 'echo "import paddle.v2 as paddle\npaddle.dataset.cifar.train10()\npaddle.dataset.flowers.fetch()" | python'
18+
RUN sh -c 'echo "import paddle.v2 as paddle\npaddle.dataset.mnist.train()\npaddle.dataset.mnist.test()\npaddle.dataset.imdb.fetch()" | python'
19+
RUN sh -c 'echo "import paddle.v2 as paddle\npaddle.dataset.imikolov.fetch()" | python'
20+
RUN pip uninstall -y paddlepaddle && mkdir /workspace
21+
22+
ADD https://raw.githubusercontent.com/PaddlePaddle/cloud/develop/docker/paddle_k8s /usr/bin
23+
ADD https://raw.githubusercontent.com/PaddlePaddle/cloud/develop/docker/k8s_tools.py /root
24+
RUN chmod +x /usr/bin/paddle_k8s
25+
26+
ADD *.whl /
27+
RUN pip install /*.whl && rm -f /*.whl
28+
29+
ENV LD_LIBRARY_PATH=/usr/local/lib
30+
ADD fluid_benchmark.py recordio_converter.py args.py recordio_converter.py run.sh run_fluid_benchmark.sh /workspace/
31+
ADD models/ /workspace/models/

benchmark/fluid/README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@ Currently supported `--model` argument include:
2424

2525
* Run the following command to start a benchmark job locally:
2626
```bash
27-
python fluid_benchmark.py --model mnist --device GPU
27+
python fluid_benchmark.py --model mnist --device GPU
2828
```
2929
You can choose to use GPU/CPU training. With GPU training, you can specify
3030
`--gpus <gpu_num>` to run multi GPU training.
31+
You can set async mode parameter server. With async mode, you can specify
32+
`--async_mode` to train model asynchronous.
3133
* Run distributed training with parameter servers:
34+
* see [run_fluid_benchmark.sh](https://github.com/PaddlePaddle/Paddle/blob/develop/benchmark/fluid/run_fluid_benchmark.sh) as an example.
3235
* start parameter servers:
3336
```bash
3437
PADDLE_TRAINING_ROLE=PSERVER PADDLE_PSERVER_PORT=7164 PADDLE_PSERVER_IPS=127.0.0.1 PADDLE_TRAINERS=1 PADDLE_CURRENT_IP=127.0.0.1 PADDLE_TRAINER_ID=0 python fluid_benchmark.py --model mnist --device GPU --update_method pserver
38+
sleep 15
3539
```
3640
* start trainers:
3741
```bash
@@ -42,13 +46,37 @@ Currently supported `--model` argument include:
4246
PADDLE_PSERVER_PORT=7164 PADDLE_TRAINER_IPS=192.168.0.2,192.168.0.3 PADDLE_CURRENT_IP=127.0.0.1 PADDLE_TRAINER_ID=0 python fluid_benchmark.py --model mnist --device GPU --update_method nccl2
4347
```
4448

49+
## Prepare the RecordIO file to Achieve Better Performance
50+
51+
Run the following command will generate RecordIO files like "mnist.recordio" under the path
52+
and batch_size you choose, you can use batch_size=1 so that later reader can change the batch_size
53+
at any time using `fluid.batch`.
54+
55+
```bash
56+
python -c 'from recordio_converter import *; prepare_mnist("data", 1)'
57+
```
58+
4559
## Run Distributed Benchmark on Kubernetes Cluster
4660

61+
You may need to build a Docker image before submitting a cluster job onto Kubernetes, or you will
62+
have to start all those processes mannually on each node, which is not recommended.
63+
64+
To build the Docker image, you need to choose a paddle "whl" package to run with, you may either
65+
download it from
66+
http://www.paddlepaddle.org/docs/develop/documentation/zh/build_and_install/pip_install_en.html or
67+
build it by your own. Once you've got the "whl" package, put it under the current directory and run:
68+
69+
```bash
70+
docker build -t [your docker image name]:[your docker image tag] .
71+
```
72+
73+
Then push the image to a Docker registry that your Kubernetes cluster can reach.
74+
4775
We provide a script `kube_gen_job.py` to generate Kubernetes yaml files to submit
4876
distributed benchmark jobs to your cluster. To generate a job yaml, just run:
4977
5078
```bash
51-
python kube_gen_job.py --jobname myjob --pscpu 4 --cpu 8 --gpu 8 --psmemory 20 --memory 40 --pservers 4 --trainers 4 --entry "python fluid_benchmark.py --model mnist --parallel 1 --device GPU --update_method pserver " --disttype pserver
79+
python kube_gen_job.py --jobname myjob --pscpu 4 --cpu 8 --gpu 8 --psmemory 20 --memory 40 --pservers 4 --trainers 4 --entry "python fluid_benchmark.py --model mnist --gpus 8 --device GPU --update_method pserver " --disttype pserver
5280
```
5381
5482
Then the yaml files are generated under directory `myjob`, you can run:

0 commit comments

Comments
 (0)