Skip to content

Commit 1de901a

Browse files
committed
Merge branch 'develop' into dir
2 parents f1e3ade + 8591e70 commit 1de901a

File tree

102 files changed

+678
-1460
lines changed

Some content is hidden

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

102 files changed

+678
-1460
lines changed

CMakeLists.txt

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ find_package(ZLIB REQUIRED)
2525
find_package(NumPy REQUIRED)
2626
find_package(Threads REQUIRED)
2727
find_package(AVX QUIET)
28-
find_package(Glog)
29-
find_package(Gflags QUIET)
28+
find_package(Glog REQUIRED)
29+
find_package(Gflags REQUIRED)
3030
find_package(GTest)
3131
find_package(Sphinx)
3232
find_package(Doxygen)
@@ -40,8 +40,6 @@ option(WITH_AVX "Compile PaddlePaddle with avx intrinsics" ${AVX_FOUND})
4040
option(WITH_PYTHON "Compile PaddlePaddle with python interpreter" ON)
4141
option(WITH_STYLE_CHECK "Style Check for PaddlePaddle" ${PYTHONINTERP_FOUND})
4242
option(WITH_RDMA "Compile PaddlePaddle with rdma support" OFF)
43-
option(WITH_GLOG "Compile PaddlePaddle use glog, otherwise use a log implement internally" ${LIBGLOG_FOUND})
44-
option(WITH_GFLAGS "Compile PaddlePaddle use gflags, otherwise use a flag implement internally" ${GFLAGS_FOUND})
4543
option(WITH_TIMER "Compile PaddlePaddle use timer" OFF)
4644
option(WITH_PROFILER "Compile PaddlePaddle use gpu profiler" OFF)
4745
option(WITH_TESTING "Compile and run unittest for PaddlePaddle" ${GTEST_FOUND})
@@ -136,16 +134,12 @@ else(WITH_RDMA)
136134
add_definitions(-DPADDLE_DISABLE_RDMA)
137135
endif(WITH_RDMA)
138136

139-
if(WITH_GLOG)
140-
add_definitions(-DPADDLE_USE_GLOG)
141-
include_directories(${LIBGLOG_INCLUDE_DIR})
142-
endif()
137+
# glog
138+
include_directories(${LIBGLOG_INCLUDE_DIR})
143139

144-
if(WITH_GFLAGS)
145-
add_definitions(-DPADDLE_USE_GFLAGS)
146-
add_definitions(-DGFLAGS_NS=${GFLAGS_NAMESPACE})
147-
include_directories(${GFLAGS_INCLUDE_DIRS})
148-
endif()
140+
#gflags
141+
add_definitions(-DGFLAGS_NS=${GFLAGS_NAMESPACE})
142+
include_directories(${GFLAGS_INCLUDE_DIRS})
149143

150144
if(WITH_TESTING)
151145
enable_testing()

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./doc/howto/contribute_to_paddle_en.md

WORKSPACE

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ http_archive(
33
name="protobuf",
44
url="http://github.com/google/protobuf/archive/v3.1.0.tar.gz",
55
sha256="0a0ae63cbffc274efb573bdde9a253e3f32e458c41261df51c5dbc5ad541e8f7",
6-
strip_prefix="protobuf-3.1.0", )
6+
strip_prefix="protobuf-3.1.0")
77

88
# External dependency to gtest 1.7.0. This method comes from
99
# https://www.bazel.io/versions/master/docs/tutorial/cpp.html.
@@ -12,4 +12,20 @@ new_http_archive(
1212
url="https://github.com/google/googletest/archive/release-1.7.0.zip",
1313
sha256="b58cb7547a28b2c718d1e38aee18a3659c9e3ff52440297e965f5edffe34b6d0",
1414
build_file="third_party/gtest.BUILD",
15-
strip_prefix="googletest-release-1.7.0", )
15+
strip_prefix="googletest-release-1.7.0")
16+
17+
# External dependency to gflags. This method comes from
18+
# https://github.com/gflags/example/blob/master/WORKSPACE.
19+
new_git_repository(
20+
name="gflags",
21+
tag="v2.2.0",
22+
remote="https://github.com/gflags/gflags.git",
23+
build_file="third_party/gflags.BUILD")
24+
25+
# External dependency to glog. This method comes from
26+
# https://github.com/reyoung/bazel_playground/blob/master/WORKSPACE
27+
new_git_repository(
28+
name="glog",
29+
remote="https://github.com/google/glog.git",
30+
commit="b6a5e0524c28178985f0d228e9eaa43808dbec3c",
31+
build_file="third_party/glog.BUILD")

cmake/check_packages.cmake

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,9 @@ if(WITH_STYLE_CHECK)
1414
find_package(PythonInterp REQUIRED)
1515
endif()
1616

17-
if(WITH_GLOG)
18-
find_package(Glog REQUIRED)
19-
endif()
17+
find_package(Glog REQUIRED)
2018

21-
if(WITH_GFLAGS)
22-
find_package(Gflags REQUIRED)
23-
endif()
19+
find_package(Gflags REQUIRED)
2420

2521
if(WITH_TESTING)
2622
find_package(GTest REQUIRED)

cmake/util.cmake

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ endmacro()
6565
# link_paddle_exe
6666
# add paddle library for a paddle executable, such as trainer, pserver.
6767
#
68-
# It will handle WITH_PYTHON/WITH_GLOG etc.
68+
# It will handle WITH_PYTHON etc.
6969
function(link_paddle_exe TARGET_NAME)
7070
if(WITH_RDMA)
7171
generate_rdma_links()
@@ -108,6 +108,8 @@ function(link_paddle_exe TARGET_NAME)
108108
paddle_cuda
109109
${METRIC_LIBS}
110110
${PROTOBUF_LIBRARY}
111+
${LIBGLOG_LIBRARY}
112+
${GFLAGS_LIBRARIES}
111113
${CMAKE_THREAD_LIBS_INIT}
112114
${CBLAS_LIBS}
113115
${ZLIB_LIBRARIES}
@@ -125,16 +127,6 @@ function(link_paddle_exe TARGET_NAME)
125127
${PYTHON_LIBRARIES})
126128
endif()
127129

128-
if(WITH_GLOG)
129-
target_link_libraries(${TARGET_NAME}
130-
${LIBGLOG_LIBRARY})
131-
endif()
132-
133-
if(WITH_GFLAGS)
134-
target_link_libraries(${TARGET_NAME}
135-
${GFLAGS_LIBRARIES})
136-
endif()
137-
138130
if(WITH_GPU)
139131
if(NOT WITH_DSO OR WITH_METRIC)
140132
target_link_libraries(${TARGET_NAME}

demo/semantic_role_labeling/data/extract_dict_feature.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ def extract_dict_features(pair_file, feature_file):
4343
mark[verb_index] = 1
4444
ctx_0 = sentence_list[verb_index]
4545

46-
if verb_index < len(labels_list) - 2:
46+
if verb_index < len(labels_list) - 1:
4747
mark[verb_index + 1] = 1
4848
ctx_p1 = sentence_list[verb_index + 1]
4949
else:
5050
ctx_p1 = 'eos'
5151

52-
if verb_index < len(labels_list) - 3:
52+
if verb_index < len(labels_list) - 2:
5353
mark[verb_index + 2] = 1
5454
ctx_p2 = sentence_list[verb_index + 2]
5555
else:

doc/getstarted/build_and_install/build_from_source_en.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@ PaddlePaddle supports some build options. To enable it, first you need to instal
4949
<tbody>
5050
<tr><td class="left">WITH_GPU</td><td class="left">Compile with GPU mode.</td></tr>
5151
<tr><td class="left">WITH_DOUBLE</td><td class="left">Compile with double precision floating-point, default: single precision.</td></tr>
52-
<tr><td class="left">WITH_GLOG</td><td class="left">Compile with glog. If not found, default: an internal log implementation.</td></tr>
53-
<tr><td class="left">WITH_GFLAGS</td><td class="left">Compile with gflags. If not found, default: an internal flag implementation.</td></tr>
5452
<tr><td class="left">WITH_TESTING</td><td class="left">Compile with gtest for PaddlePaddle's unit testing.</td></tr>
55-
<tr><td class="left">WITH_DOC</td><td class="left"> Compile to generate PaddlePaddle's docs, default: disabled (OFF).</td></tr>
53+
<tr><td class="left">WITH_DOC</td><td class="left"> Compile to generate PaddlePaddle's docs, default: disabled (OFF).</td></tr>
5654
<tr><td class="left">WITH_SWIG_PY</td><td class="left">Compile with python predict API, default: disabled (OFF).</td></tr>
5755
<tr><td class="left">WITH_STYLE_CHECK</td><td class="left">Compile with code style check, default: enabled (ON).</td></tr>
5856
</tbody>

doc/getstarted/build_and_install/cmake/compile_options.csv

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ WITH_AVX,是否编译含有AVX指令集的PaddlePaddle二进制文件,是
66
WITH_PYTHON,是否内嵌PYTHON解释器。方便今后的嵌入式移植工作。,是
77
WITH_STYLE_CHECK,是否编译时进行代码风格检查,是
88
WITH_RDMA,是否开启RDMA,否
9-
WITH_GLOG,是否开启GLOG。如果不开启,则会使用一个简化版的日志,同时方便今后的嵌入式移植工作。,取决于是否寻找到GLOG
10-
WITH_GFLAGS,是否使用GFLAGS。如果不开启,则会使用一个简化版的命令行参数解析器,同时方便今后的嵌入式移植工作。,取决于是否寻找到GFLAGS
119
WITH_TIMER,是否开启计时功能。如果开启会导致运行略慢,打印的日志变多,但是方便调试和测Benchmark,否
1210
WITH_TESTING,是否开启单元测试,取决于是否寻找到GTEST
1311
WITH_DOC,是否编译中英文文档,否

doc/getstarted/build_and_install/ubuntu_install_cn.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ PaddlePaddle提供了ubuntu 14.04 deb安装包。
4646
with_double: OFF
4747
with_python: ON
4848
with_rdma: OFF
49-
with_glog: ON
50-
with_gflags: ON
5149
with_metric_learning:
5250
with_timer: OFF
5351
with_predict_sdk:

doc/howto/dev/contribute_to_paddle_en.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Contribute Code
22

33
We sincerely appreciate your contributions. You can use fork and pull request
4-
workflow to merge your code.
5-
4+
workflow to merge your code.
5+
66
## Code Requirements
77
- Your code must be fully documented by
88
[doxygen](http://www.stack.nl/~dimitri/doxygen/) style.
@@ -12,11 +12,11 @@ workflow to merge your code.
1212
- Pass all unit tests.
1313

1414
The following tutorial guides you into submitting your contibution.
15-
15+
1616
## [Creating a Fork](https://help.github.com/articles/fork-a-repo/)
17-
17+
1818
Just head over to the GitHub page and click the "Fork" button.
19-
It's just that simple.
19+
It's just that simple.
2020

2121
## Clone
2222

@@ -25,7 +25,7 @@ The **develop** is the main branch, and other user's branches are feature branch
2525

2626
Once you've created a fork, you can use your favorite git client to clone your
2727
repo or just head straight to the command line:
28-
28+
2929
```shell
3030
# Clone your fork to your local machine
3131
git clone --branch develop https://github.com/USERNAME/Paddle.git
@@ -47,6 +47,22 @@ Then you can start to develop by making a local developement branch
4747
git checkout -b MY_COOL_STUFF_BRANCH
4848
```
4949

50+
## Using `pre-commit` hook
51+
52+
Paddle developers use [pre-commit](http://pre-commit.com/) tool to manage git
53+
pre-commit hooks. It can help us format source codes (cpp, python), check some
54+
basic thing before commit (only one EOL for each file, do not add a huge file
55+
in git). `pre-commit` tests is a part of unit tests in Travis-CI now, every
56+
PR doesn't fit hook can not be merged into Paddle.
57+
58+
To use [pre-commit](http://pre-commit.com/), you should install it by
59+
`pip install pre-commit`, and currently, Paddle uses `clang-format` to format
60+
c/cpp sources. Please make sure clang-format 3.8+ installed.
61+
62+
Then just run `pre-commit install` in your Paddle clone directory. When you
63+
commit your code, the pre-commit hook will check the local code if there is
64+
anything not suitable to commit, and so on.
65+
5066
## Commit
5167

5268
Commit your changes by following command lines:
@@ -83,7 +99,7 @@ git pull --rebase upstream develop
8399

84100
If there are no unique commits locally, git will simply perform a fast-forward.
85101
However, if you have been making changes (in the vast majority of cases you
86-
probably shouldn't be), you may have to deal with conflicts.
102+
probably shouldn't be), you may have to deal with conflicts.
87103

88104
Now, your local master branch is up-to-date with everything modified upstream.
89105

0 commit comments

Comments
 (0)