Skip to content

Commit 0ed461d

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into update_simple_distranspiler
2 parents eacac49 + 663f4e6 commit 0ed461d

File tree

84 files changed

+1818
-874
lines changed

Some content is hidden

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

84 files changed

+1818
-874
lines changed

AUTHORS.md

Lines changed: 1 addition & 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 |

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RUN apt-get update && \
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 && \

benchmark/fluid/Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
2+
RUN apt-get update && apt-get install -y python python-pip iputils-ping libgtk2.0-dev wget vim net-tools iftop
3+
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
4+
RUN pip install -U pip
5+
RUN pip install -U kubernetes opencv-python paddlepaddle
6+
7+
# IMPORTANT:
8+
# Add "ENV http_proxy=http://ip:port" if your download is slow, and don't forget to unset it at runtime.
9+
10+
RUN sh -c 'echo "import paddle.v2 as paddle\npaddle.dataset.cifar.train10()\npaddle.dataset.flowers.fetch()" | python'
11+
RUN sh -c 'echo "import paddle.v2 as paddle\npaddle.dataset.mnist.train()\npaddle.dataset.mnist.test()\npaddle.dataset.imdb.fetch()" | python'
12+
RUN sh -c 'echo "import paddle.v2 as paddle\npaddle.dataset.imikolov.fetch()" | python'
13+
RUN pip uninstall -y paddlepaddle && mkdir /workspace
14+
15+
ADD https://raw.githubusercontent.com/PaddlePaddle/cloud/develop/docker/paddle_k8s /usr/bin
16+
ADD https://raw.githubusercontent.com/PaddlePaddle/cloud/develop/docker/k8s_tools.py /root
17+
18+
ADD *.whl /
19+
RUN pip install /*.whl && rm -f /*.whl && chmod +x /usr/bin/paddle_k8s
20+
21+
ENV LD_LIBRARY_PATH=/usr/local/lib
22+
ADD fluid_benchmark.py dataset.py models/ /workspace/

benchmark/fluid/README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,25 @@ Currently supported `--model` argument include:
4444

4545
## Run Distributed Benchmark on Kubernetes Cluster
4646

47+
You may need to build a Docker image before submitting a cluster job onto Kubernetes, or you will
48+
have to start all those processes mannually on each node, which is not recommended.
49+
50+
To build the Docker image, you need to choose a paddle "whl" package to run with, you may either
51+
download it from
52+
http://www.paddlepaddle.org/docs/develop/documentation/zh/build_and_install/pip_install_en.html or
53+
build it by your own. Once you've got the "whl" package, put it under the current directory and run:
54+
55+
```bash
56+
docker build -t [your docker image name]:[your docker image tag] .
57+
```
58+
59+
Then push the image to a Docker registry that your Kubernetes cluster can reach.
60+
4761
We provide a script `kube_gen_job.py` to generate Kubernetes yaml files to submit
4862
distributed benchmark jobs to your cluster. To generate a job yaml, just run:
4963
5064
```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
65+
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
5266
```
5367
5468
Then the yaml files are generated under directory `myjob`, you can run:

benchmark/fluid/kube_gen_job.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def parse_args():
4949
parser.add_argument(
5050
'--fluid', default=1, type=int, help='whether is fluid job')
5151
parser.add_argument(
52-
'--rdma', action='store_ture', help='whether mount rdma libs')
52+
'--rdma', action='store_true', help='whether mount rdma libs')
5353
parser.add_argument(
5454
'--disttype',
5555
default="pserver",

benchmark/fluid/run.sh

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ nohup stdbuf -oL nvidia-smi \
3737
-l 1 &
3838
# mnist
3939
# mnist gpu mnist 128
40-
FLAGS_benchmark=true stdbuf -oL python fluid/mnist.py \
40+
FLAGS_benchmark=true stdbuf -oL python fluid_benchmark.py \
41+
--model=mnist \
4142
--device=GPU \
4243
--batch_size=128 \
4344
--skip_batch_num=5 \
@@ -46,15 +47,17 @@ FLAGS_benchmark=true stdbuf -oL python fluid/mnist.py \
4647

4748
# vgg16
4849
# gpu cifar10 128
49-
FLAGS_benchmark=true stdbuf -oL python fluid/vgg16.py \
50+
FLAGS_benchmark=true stdbuf -oL python fluid_benchmark.py \
51+
--model=vgg16 \
5052
--device=GPU \
5153
--batch_size=128 \
5254
--skip_batch_num=5 \
5355
--iterations=30 \
5456
2>&1 | tee -a vgg16_gpu_128.log
5557

5658
# flowers gpu 128
57-
FLAGS_benchmark=true stdbuf -oL python fluid/vgg16.py \
59+
FLAGS_benchmark=true stdbuf -oL python fluid_benchmark.py \
60+
--model=vgg16 \
5861
--device=GPU \
5962
--batch_size=32 \
6063
--data_set=flowers \
@@ -64,40 +67,39 @@ FLAGS_benchmark=true stdbuf -oL python fluid/vgg16.py \
6467

6568
# resnet50
6669
# resnet50 gpu cifar10 128
67-
FLAGS_benchmark=true stdbuf -oL python fluid/resnet50.py \
70+
FLAGS_benchmark=true stdbuf -oL python fluid_benchmark.py \
71+
--model=resnet50 \
6872
--device=GPU \
6973
--batch_size=128 \
7074
--data_set=cifar10 \
71-
--model=resnet_cifar10 \
7275
--skip_batch_num=5 \
7376
--iterations=30 \
7477
2>&1 | tee -a resnet50_gpu_128.log
7578

7679
# resnet50 gpu flowers 64
77-
FLAGS_benchmark=true stdbuf -oL python fluid/resnet50.py \
80+
FLAGS_benchmark=true stdbuf -oL python fluid_benchmark.py \
81+
--model=resnet50 \
7882
--device=GPU \
7983
--batch_size=64 \
8084
--data_set=flowers \
81-
--model=resnet_imagenet \
8285
--skip_batch_num=5 \
8386
--iterations=30 \
8487
2>&1 | tee -a resnet50_gpu_flowers_64.log
8588

8689
# lstm
8790
# lstm gpu imdb 32 # tensorflow only support batch=32
88-
FLAGS_benchmark=true stdbuf -oL python fluid/stacked_dynamic_lstm.py \
91+
FLAGS_benchmark=true stdbuf -oL python fluid_benchmark.py \
92+
--model=stacked_dynamic_lstm \
8993
--device=GPU \
9094
--batch_size=32 \
9195
--skip_batch_num=5 \
9296
--iterations=30 \
93-
--hidden_dim=512 \
94-
--emb_dim=512 \
95-
--crop_size=1500 \
9697
2>&1 | tee -a lstm_gpu_32.log
9798

9899
# seq2seq
99100
# seq2seq gpu wmb 128
100-
FLAGS_benchmark=true stdbuf -oL python fluid/machine_translation.py \
101+
FLAGS_benchmark=true stdbuf -oL python fluid_benchmark.py \
102+
--model=machine_translation \
101103
--device=GPU \
102104
--batch_size=128 \
103105
--skip_batch_num=5 \

doc/fluid/api/layers.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,9 +1003,15 @@ dice_loss
10031003
.. autofunction:: paddle.fluid.layers.dice_loss
10041004
:noindex:
10051005

1006-
upsampling_bilinear2d
1006+
resize_bilinear
10071007
____
10081008

1009-
.. autofunction:: paddle.fluid.layers.upsampling_bilinear2d
1009+
.. autofunction:: paddle.fluid.layers.resize_bilinear
1010+
:noindex:
1011+
1012+
gather
1013+
____
1014+
1015+
.. autofunction:: paddle.fluid.layers.gather
10101016
:noindex:
10111017

doc/fluid/howto/index_cn.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
.. toctree::
55
:maxdepth: 1
66

7+
inference/index_cn.rst
78
optimization/index_cn.rst
8-
inference/inference_support_in_fluid.md

doc/fluid/howto/index_en.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ HOW TO
55
:maxdepth: 1
66

77
optimization/index_en.rst
8-
inference/inference_support_in_fluid.md
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
安装与编译C++预测库
2+
===========================
3+
4+
直接下载安装
5+
-------------
6+
7+
====================== ========================================
8+
版本说明 C++预测库
9+
====================== ========================================
10+
cpu_avx_mkl `fluid.tgz <https://guest:@paddleci.ngrok.io/repository/download/Manylinux1_CpuAvxCp27cp27mu/.lastSuccessful/fluid.tgz>`_
11+
cpu_avx_openblas `fluid.tgz <https://guest:@paddleci.ngrok.io/repository/download/Manylinux1_CpuAvxOpenblas/.lastSuccessful/fluid.tgz>`_
12+
cpu_noavx_openblas `fluid.tgz <https://guest:@paddleci.ngrok.io/repository/download/Manylinux1_CpuNoavxOpenblas/.lastSuccessful/fluid.tgz>`_
13+
cuda7.5_cudnn5_avx_mkl `fluid.tgz <https://guest:@paddleci.ngrok.io/repository/download/Manylinux1_Cuda75cudnn5cp27cp27mu/.lastSuccessful/fluid.tgz>`_
14+
cuda8.0_cudnn5_avx_mkl `fluid.tgz <https://guest:@paddleci.ngrok.io/repository/download/Manylinux1_Cuda80cudnn5cp27cp27mu/.lastSuccessful/fluid.tgz>`_
15+
cuda8.0_cudnn7_avx_mkl `fluid.tgz <https://guest:@paddleci.ngrok.io/repository/download/Manylinux1_Cuda8cudnn7cp27cp27mu/.lastSuccessful/fluid.tgz>`_
16+
====================== ========================================
17+
18+
从源码编译
19+
----------
20+
用户也可以从 PaddlePaddle 核心代码编译C++预测库,只需在编译时配制下面这些编译选项:
21+
22+
================= =========
23+
选项 值
24+
================= =========
25+
CMAKE_BUILD_TYPE Release
26+
FLUID_INSTALL_DIR 安装路径
27+
WITH_FLUID_ONLY ON(推荐)
28+
WITH_SWIG_PY OFF(推荐
29+
WITH_PYTHON OFF(推荐)
30+
WITH_GPU ON/OFF
31+
WITH_MKL ON/OFF
32+
================= =========
33+
34+
建议按照推荐值设置,以避免链接不必要的库。其它可选编译选项按需进行设定。
35+
36+
下面的代码片段从github拉取最新代码,配制编译选项(需要将PADDLE_ROOT替换为PaddlePaddle预测库的安装路径):
37+
38+
.. code-block:: bash
39+
40+
pip install paddlepaddle-gpu
41+
PADDLE_ROOT=/path/of/capi
42+
git clone https://github.com/PaddlePaddle/Paddle.git
43+
cd Paddle
44+
mkdir build
45+
cd build
46+
cmake -DFLUID_INSTALL_DIR=$PADDLE_ROOT \
47+
-DCMAKE_BUILD_TYPE=Release \
48+
-DWITH_FLUID_ONLY=ON \
49+
-DWITH_SWIG_PY=OFF \
50+
-DWITH_PYTHON=OFF \
51+
-DWITH_MKL=OFF \
52+
-DWITH_GPU=OFF \
53+
..
54+
make
55+
make inference_lib_dist
56+
57+
成功编译后,使用C++预测库所需的依赖(包括:(1)编译出的PaddlePaddle预测库和头文件;(2)第三方链接库和头文件;(3)版本信息与编译选项信息)
58+
均会存放于PADDLE_ROOT目录中。目录结构如下:
59+
60+
.. code-block:: text
61+
62+
PaddleRoot/
63+
├── CMakeCache.txt
64+
├── paddle
65+
│   └── fluid
66+
│   ├── framework
67+
│   ├── inference
68+
│   ├── memory
69+
│   ├── platform
70+
│   ├── pybind
71+
│   └── string
72+
├── third_party
73+
│   ├── boost
74+
│   │   └── boost
75+
│   ├── eigen3
76+
│   │   ├── Eigen
77+
│   │   └── unsupported
78+
│   └── install
79+
│   ├── gflags
80+
│   ├── glog
81+
│   ├── mklml
82+
│   ├── protobuf
83+
│   ├── snappy
84+
│   ├── snappystream
85+
│   └── zlib
86+
└── version.txt
87+
88+
version.txt 中记录了该预测库的版本信息,包括Git Commit ID、使用OpenBlas或MKL数学库、CUDA/CUDNN版本号,如:
89+
90+
.. code-block:: text
91+
92+
GIT COMMIT ID: c95cd4742f02bb009e651a00b07b21c979637dc8
93+
WITH_MKL: ON
94+
WITH_GPU: ON
95+
CUDA version: 8.0
96+
CUDNN version: v5

0 commit comments

Comments
 (0)