Skip to content

Commit 7b7a4af

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into fix-default-value
Change the default value of the parameter 'drop_last' in 'paddle.batch' to False.
2 parents 1869190 + 1640334 commit 7b7a4af

File tree

178 files changed

+6361
-2005
lines changed

Some content is hidden

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

178 files changed

+6361
-2005
lines changed

CMakeLists.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ option(WITH_ANAKIN "Compile with Anakin library" OFF)
6666
option(WITH_GRPC "Use grpc as the default rpc framework" ${WITH_DISTRIBUTE})
6767
option(WITH_BRPC_RDMA "Use brpc rdma as the rpc protocal" OFF)
6868
option(WITH_SYSTEM_BLAS "Use system blas library" OFF)
69+
option(PY_VERSION "Compile PaddlePaddle with python3 support" ${PY_VERSION})
70+
71+
# PY_VERSION
72+
if(NOT PY_VERSION)
73+
set(PY_VERSION 2.7)
74+
endif()
6975

7076
# CMAKE_BUILD_TYPE
7177
if(NOT CMAKE_BUILD_TYPE)
@@ -146,6 +152,7 @@ endif()
146152
########################################################################################
147153

148154
include(external/mklml) # download mklml package
155+
include(external/libxsmm) # download, build, install libxsmm
149156
include(external/zlib) # download, build, install zlib
150157
include(external/gflags) # download, build, install gflags
151158
include(external/glog) # download, build, install glog
@@ -232,6 +239,10 @@ if(WITH_MKLML)
232239
list(APPEND EXTERNAL_LIBS ${MKLML_IOMP_LIB})
233240
endif()
234241

242+
if(WITH_LIBXSMM)
243+
list(APPEND EXTERNAL_LIBS ${LIBXSMM_LIBS})
244+
endif()
245+
235246
if(WITH_MKLDNN)
236247
list(APPEND EXTERNAL_LIBS ${MKLDNN_LIB})
237248
endif()
@@ -271,7 +282,3 @@ if(WITH_DOC)
271282
find_python_module(recommonmark REQUIRED)
272283
add_subdirectory(doc)
273284
endif()
274-
275-
if (WITH_CONTRIB)
276-
add_subdirectory(paddle/contrib)
277-
endif()

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

benchmark/fluid/fluid_benchmark.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def train_parallel(avg_loss, infer_prog, optimizer, train_reader, test_reader,
210210
# generate fake:
211211
if args.use_fake_data:
212212
for var in feed_var_list:
213-
v = startup_prog.global_block().clone_variable(var)
213+
v = startup_prog.global_block()._clone_variable(var)
214214
var.persistable = True
215215
v.persistable = True
216216

cmake/external/libxsmm.cmake

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
16+
OPTION(WITH_LIBXSMM "Compile with libxsmm" OFF)
17+
18+
IF(NOT WITH_LIBXSMM)
19+
return()
20+
ENDIF()
21+
22+
IF(WIN32 OR APPLE OR ANDROID OR IOS)
23+
MESSAGE(WARNING "Windows, Mac or Mobile are not supported with libxsmm in Paddle yet.")
24+
SET(WITH_LIBXSMM OFF CACHE STRING "Disable LIBXSMM" FORCE)
25+
return()
26+
ENDIF()
27+
28+
INCLUDE (ExternalProject)
29+
30+
SET(LIBXSMM_SOURCES_DIR ${THIRD_PARTY_PATH}/libxsmm)
31+
SET(LIBXSMM_INSTALL_DIR ${THIRD_PARTY_PATH}/install/libxsmm)
32+
SET(LIBXSMM_INCLUDE_DIR "${LIBXSMM_INSTALL_DIR}/include" CACHE PATH "LIBXSMM include directory." FORCE)
33+
SET(LIBXSMM_LIBRARY_DIR "${LIBXSMM_INSTALL_DIR}/lib" CACHE PATH "LIBXSMM library directory." FORCE)
34+
SET(LIBXSMM_LIBS "${LIBXSMM_LIBRARY_DIR}/libxsmm.a"
35+
"${LIBXSMM_LIBRARY_DIR}/libxsmmnoblas.a")
36+
37+
ExternalProject_Add(
38+
extern_libxsmm
39+
GIT_REPOSITORY "https://github.com/hfp/libxsmm.git"
40+
GIT_TAG "7cc03b5b342fdbc6b6d990b190671c5dbb8489a2"
41+
PREFIX ${LIBXSMM_SOURCES_DIR}
42+
UPDATE_COMMAND ""
43+
CONFIGURE_COMMAND ""
44+
BUILD_IN_SOURCE 1
45+
BUILD_COMMAND $(MAKE) --silent PREFIX=${LIBXSMM_INSTALL_DIR} CXX=g++ CC=gcc WARP=0 install
46+
INSTALL_COMMAND ""
47+
)
48+
ADD_LIBRARY(libxsmm STATIC IMPORTED GLOBAL)
49+
SET_PROPERTY(TARGET libxsmm PROPERTY IMPORTED_LOCATION "${LIBXSMM_LIBRARY_DIR}/libxsmm.a")
50+
SET_PROPERTY(TARGET libxsmm PROPERTY IMPORTED_LOCATION "${LIBXSMM_LIBRARY_DIR}/libxsmmnoblas.a")
51+
52+
MESSAGE(STATUS "Libxsmm library: ${LIBXSMM_LIBS}")
53+
include_directories(${LIBXSMM_INCLUDE_DIR})
54+
ADD_DEFINITIONS(-DPADDLE_WITH_LIBXSMM)
55+
ADD_DEPENDENCIES(libxsmm extern_libxsmm)
56+
LIST(APPEND external_project_dependencies libxsmm)
57+

cmake/external/openblas.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ ELSE()
121121
TARGET_LINK_LIBRARIES(cblas ${CBLAS_LIBRARIES})
122122
ENDIF("${CBLAS_PROVIDER}" STREQUAL "MKLML")
123123

124+
IF(WITH_LIBXSMM)
125+
TARGET_LINK_LIBRARIES(cblas ${LIBXSMM_LIBS})
126+
ADD_DEPENDENCIES(cblas extern_libxsmm)
127+
ENDIF()
128+
124129
IF(NOT ${CBLAS_FOUND})
125130
ADD_DEPENDENCIES(cblas extern_openblas)
126131
LIST(APPEND external_project_dependencies cblas)

cmake/external/python.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ ENDIF()
1818

1919
INCLUDE(python_module)
2020

21-
FIND_PACKAGE(PythonInterp 2.7)
22-
FIND_PACKAGE(PythonLibs 2.7)
21+
FIND_PACKAGE(PythonInterp ${PY_VERSION})
22+
FIND_PACKAGE(PythonLibs ${PY_VERSION})
23+
2324
# Fixme: Maybe find a static library. Get SHARED/STATIC by FIND_PACKAGE.
2425
ADD_LIBRARY(python SHARED IMPORTED GLOBAL)
2526
SET_PROPERTY(TARGET python PROPERTY IMPORTED_LOCATION ${PYTHON_LIBRARIES})

cmake/inference_lib.cmake

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -138,25 +138,24 @@ copy(memory_lib
138138

139139
set(inference_deps paddle_fluid_shared paddle_fluid)
140140

141-
if(WITH_CONTRIB)
142-
message(STATUS "installing contrib")
143-
set(contrib_dst_dir "${FLUID_INSTALL_DIR}/contrib/inference")
144-
if (WITH_ANAKIN AND WITH_GPU)
145-
copy(contrib_anakin_inference_lib DEPS paddle_inference_api inference_anakin_api
146-
SRCS
147-
${PADDLE_BINARY_DIR}/paddle/contrib/inference/libinference_anakin_api* # compiled anakin api
148-
${PADDLE_BINARY_DIR}/third_party/install/anakin/*.tar.gz # anakin release
149-
DSTS ${contrib_dst_dir}/anakin ${contrib_dst_dir}/anakin)
150-
list(APPEND inference_deps contrib_anakin_inference_lib)
151-
endif()
152-
153-
copy(contrib_inference_lib DEPS paddle_inference_api paddle_inference_api_shared
154-
SRCS ${PADDLE_SOURCE_DIR}/paddle/contrib/inference/paddle_inference_api.h
155-
${PADDLE_BINARY_DIR}/paddle/contrib/inference/libpaddle_inference_api*
156-
DSTS ${contrib_dst_dir} ${contrib_dst_dir})
157-
list(APPEND inference_deps contrib_inference_lib)
141+
set(module "inference/api")
142+
if (WITH_ANAKIN AND WITH_GPU)
143+
copy(anakin_inference_lib DEPS paddle_inference_api inference_anakin_api
144+
SRCS
145+
${PADDLE_BINARY_DIR}/paddle/fluid/inference/api/libinference_anakin_api* # compiled anakin api
146+
${PADDLE_BINARY_DIR}/third_party/install/anakin/*.tar.gz # anakin release
147+
DSTS ${dst_dir}/inference/anakin ${dst_dir}/inference/anakin)
148+
list(APPEND inference_deps anakin_inference_lib)
158149
endif()
159150

151+
copy(inference_api_lib DEPS paddle_inference_api paddle_inference_api_shared
152+
SRCS ${src_dir}/${module}/paddle_inference_api.h
153+
${src_dir}/${module}/demo_ci
154+
${PADDLE_BINARY_DIR}/paddle/fluid/inference/api/libpaddle_inference_api*
155+
DSTS ${dst_dir}/inference ${dst_dir}/inference ${dst_dir}/inference
156+
)
157+
list(APPEND inference_deps inference_api_lib)
158+
160159
set(module "inference")
161160
copy(inference_lib DEPS ${inference_deps}
162161
SRCS ${src_dir}/${module}/*.h ${PADDLE_BINARY_DIR}/paddle/fluid/inference/libpaddle_fluid.*

doc/fluid/design/modules/python_api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ class Block(objects):
9898
def append_operator(self, ...):
9999
self.ops.append(Operator(self, ...))
100100

101-
def prepend_operator(self, ...): # Parameter's ctor prepands initialize operators.
101+
def _prepend_operator(self, ...): # Parameter's ctor prepands initialize operators.
102102
self.ops.prepend(Operator(self, ...))
103103
```
104104

105105
`create_parameter` is necessary because parameters are global variables, defined in the global block, but can be created in some sub-blocks. For example, an FC layer in the step block of an RNN operator.
106106

107-
`prepend_operator` is necessary because the constructor of `Parameter` needs to create the initialize (or load) operator of the parameter, and would like to put it in the *preamble* of the global block.
107+
`_prepend_operator` is necessary because the constructor of `Parameter` needs to create the initialize (or load) operator of the parameter, and would like to put it in the *preamble* of the global block.
108108

109109
### Operator
110110

doc/fluid/howto/performance/error_clip.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def error_clip_callback(block, context):
7878
op_desc = block.desc.op(block.desc.op_size() - 1)
7979
for grad_n in filter(lambda n: grad_to_var.has_key(n),
8080
op_desc.output_arg_names()):
81-
fwd_var = block.var_recursive(grad_to_var[grad_n])
81+
fwd_var = block.__var_recursive(grad_to_var[grad_n])
8282
error_clip = getattr(fwd_var, "error_clip", None)
8383
if not (error_clip is None or isinstance(error_clip,
8484
BaseErrorClipAttr)):

doc/v2/api/index_en.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ API
44
.. toctree::
55
:maxdepth: 1
66

7-
overview.rst
87
model_configs.rst
98
data.rst
109
run_logic.rst

0 commit comments

Comments
 (0)