Skip to content

Commit d0ac274

Browse files
committed
Merge branch 'develop' into update_android_doc
2 parents cd099c7 + 43c05e4 commit d0ac274

File tree

613 files changed

+27415
-8731
lines changed

Some content is hidden

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

613 files changed

+27415
-8731
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,3 @@
3131
- id: go-fmt
3232
types:
3333
- go
34-
- id: gometalinter
35-
types:
36-
- go

CMakeLists.txt

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ if(ANDROID OR IOS)
8686
"Disable MKLDNN when cross-compiling for Android and iOS" FORCE)
8787
set(WITH_MKLML OFF CACHE STRING
8888
"Disable MKLML package when cross-compiling for Android and iOS" FORCE)
89+
90+
# Compile PaddlePaddle mobile inference library
91+
if (NOT WITH_C_API)
92+
set(WITH_C_API ON CACHE STRING
93+
"Always compile the C_API when cross-compiling for Android and iOS" FORCE)
94+
endif()
95+
set(MOBILE_INFERENCE ON)
96+
add_definitions(-DPADDLE_MOBILE_INFERENCE)
8997
endif()
9098

9199
set(THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING
@@ -97,6 +105,12 @@ if (WITH_C_API AND WITH_PYTHON)
97105
"different Python interpreter from compiling.")
98106
endif()
99107

108+
if(MOBILE_INFERENCE)
109+
set(THIRD_PARTY_BUILD_TYPE MinSizeRel)
110+
else()
111+
set(THIRD_PARTY_BUILD_TYPE Release)
112+
endif()
113+
100114
########################################################################################
101115

102116
include(external/mklml) # download mklml package
@@ -160,9 +174,11 @@ endif(USE_NNPACK)
160174

161175
add_subdirectory(proto)
162176

163-
# "add_subdirectory(go)" should be placed after the following loine,
164-
# because it depends on paddle/optimizer.
165-
add_subdirectory(paddle/optimizer)
177+
if(NOT MOBILE_INFERENCE)
178+
# "add_subdirectory(go)" should be placed after the following loine,
179+
# because it depends on paddle/optimizer.
180+
add_subdirectory(paddle/optimizer)
181+
endif()
166182

167183
# "add_subdirectory(paddle)" and "add_subdirectory(python)" should be
168184
# placed after this block, because they depends on it.

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@ Please refer to our [release announcement](https://github.com/PaddlePaddle/Paddl
5151
- **Connected to Products**
5252

5353
In addition, PaddlePaddle is also designed to be easily deployable. At Baidu,
54-
PaddlePaddle has been deployed into products or service with a vast number
54+
PaddlePaddle has been deployed into products and services with a vast number
5555
of users, including ad click-through rate (CTR) prediction, large-scale image
5656
classification, optical character recognition(OCR), search ranking, computer
5757
virus detection, recommendation, etc. It is widely utilized in products at
58-
Baidu and it has achieved a significant impact. We hope you can also exploit
59-
the capability of PaddlePaddle to make a huge impact for your product.
58+
Baidu and it has achieved a significant impact. We hope you can also explore
59+
the capability of PaddlePaddle to make an impact on your product.
6060

6161
## Installation
6262

6363
It is recommended to check out the
6464
[Docker installation guide](http://doc.paddlepaddle.org/develop/doc/getstarted/build_and_install/docker_install_en.html)
6565
before looking into the
66-
[build from source guide](http://doc.paddlepaddle.org/develop/doc/getstarted/build_and_install/build_from_source_en.html)
66+
[build from source guide](http://doc.paddlepaddle.org/develop/doc/getstarted/build_and_install/build_from_source_en.html).
6767

6868
## Documentation
6969

@@ -72,7 +72,7 @@ We provide [English](http://doc.paddlepaddle.org/develop/doc/) and
7272

7373
- [Deep Learning 101](http://book.paddlepaddle.org/index.html)
7474

75-
You might want to start from this online interactive book that can run in Jupyter Notebook.
75+
You might want to start from this online interactive book that can run in a Jupyter Notebook.
7676

7777
- [Distributed Training](http://doc.paddlepaddle.org/develop/doc/howto/usage/cluster/cluster_train_en.html)
7878

benchmark/paddle/image/run_mkldnn.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
set -e
22

3-
unset OMP_NUM_THREADS MKL_NUM_THREADS
4-
export OMP_DYNAMIC="FALSE"
5-
export KMP_AFFINITY="granularity=fine,compact,0,0"
6-
73
function train() {
4+
unset OMP_NUM_THREADS MKL_NUM_THREADS
5+
export OMP_DYNAMIC="FALSE"
6+
export KMP_AFFINITY="granularity=fine,compact,0,0"
87
topology=$1
98
bs=$2
109
use_mkldnn=$3
1110
if [ $3 == "True" ]; then
12-
use_mkldnn=$3
1311
thread=1
1412
log="logs/${topology}-mkldnn-${bs}.log"
1513
elif [ $3 == "False" ]; then
16-
use_mkldnn=$3
1714
thread=`nproc`
15+
# each trainer_count use only 1 core to avoid conflict
16+
export OMP_NUM_THREADS=1
17+
export MKL_NUM_THREADS=1
1818
log="logs/${topology}-${thread}mklml-${bs}.log"
1919
else
2020
echo "Wrong input $3, use True or False."
21+
exit 0
2122
fi
2223
args="batch_size=${bs}"
2324
config="${topology}.py"
@@ -39,8 +40,7 @@ if [ ! -d "logs" ]; then
3940
mkdir logs
4041
fi
4142

42-
#========= mkldnn =========#
43-
# vgg
43+
#========== mkldnn ==========#
4444
train vgg 64 True
4545
train vgg 128 True
4646
train vgg 256 True

cmake/configure.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ if(WITH_DOUBLE)
2424
add_definitions(-DPADDLE_TYPE_DOUBLE)
2525
endif(WITH_DOUBLE)
2626

27+
if(WITH_TESTING)
28+
add_definitions(-DPADDLE_WITH_TESTING)
29+
endif(WITH_TESTING)
30+
2731
if(NOT WITH_TIMER)
2832
add_definitions(-DPADDLE_DISABLE_TIMER)
2933
endif(NOT WITH_TIMER)
@@ -49,11 +53,12 @@ if(NOT WITH_GOLANG)
4953
endif(NOT WITH_GOLANG)
5054

5155
if(NOT WITH_GPU)
52-
add_definitions(-DPADDLE_ONLY_CPU)
5356
add_definitions(-DHPPL_STUB_FUNC)
5457

5558
list(APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS cu)
5659
else()
60+
add_definitions(-DPADDLE_WITH_CUDA)
61+
5762
FIND_PACKAGE(CUDA REQUIRED)
5863

5964
if(${CUDA_VERSION_MAJOR} VERSION_LESS 7)

cmake/external/eigen.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ExternalProject_Add(
88
extern_eigen3
99
${EXTERNAL_PROJECT_LOG_ARGS}
1010
GIT_REPOSITORY "https://github.com/RLovelett/eigen.git"
11-
GIT_TAG "master"
11+
GIT_TAG 4e79cb69b9425f5f8c3a84be4350d4ab75b5fd9d
1212
PREFIX ${EIGEN_SOURCE_DIR}
1313
UPDATE_COMMAND ""
1414
CONFIGURE_COMMAND ""

cmake/external/gflags.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ ExternalProject_Add(
3636
# change this back to the official Github repo once my PR is
3737
# merged.
3838
GIT_REPOSITORY "https://github.com/wangkuiyi/gflags.git"
39+
GIT_TAG 986964c07427ecb9cdb5bd73f73ebbd40e54dadb
3940
PREFIX ${GFLAGS_SOURCES_DIR}
4041
UPDATE_COMMAND ""
4142
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
@@ -45,11 +46,11 @@ ExternalProject_Add(
4546
-DCMAKE_INSTALL_PREFIX=${GFLAGS_INSTALL_DIR}
4647
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
4748
-DBUILD_TESTING=OFF
48-
-DCMAKE_BUILD_TYPE=Release
49+
-DCMAKE_BUILD_TYPE=${THIRD_PARTY_BUILD_TYPE}
4950
${EXTERNAL_OPTIONAL_ARGS}
5051
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${GFLAGS_INSTALL_DIR}
5152
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
52-
-DCMAKE_BUILD_TYPE:STRING=Release
53+
-DCMAKE_BUILD_TYPE:STRING=${THIRD_PARTY_BUILD_TYPE}
5354
)
5455

5556
ADD_LIBRARY(gflags STATIC IMPORTED GLOBAL)

cmake/external/glog.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ ExternalProject_Add(
3131
${EXTERNAL_PROJECT_LOG_ARGS}
3232
DEPENDS gflags
3333
GIT_REPOSITORY "https://github.com/google/glog.git"
34+
GIT_TAG v0.3.5
3435
PREFIX ${GLOG_SOURCES_DIR}
3536
UPDATE_COMMAND ""
3637
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
@@ -43,12 +44,12 @@ ExternalProject_Add(
4344
-DWITH_GFLAGS=ON
4445
-Dgflags_DIR=${GFLAGS_INSTALL_DIR}/lib/cmake/gflags
4546
-DBUILD_TESTING=OFF
46-
-DCMAKE_BUILD_TYPE=Release
47+
-DCMAKE_BUILD_TYPE=${THIRD_PARTY_BUILD_TYPE}
4748
${EXTERNAL_OPTIONAL_ARGS}
4849
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${GLOG_INSTALL_DIR}
4950
-DCMAKE_INSTALL_LIBDIR:PATH=${GLOG_INSTALL_DIR}/lib
5051
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
51-
-DCMAKE_BUILD_TYPE:STRING=Release
52+
-DCMAKE_BUILD_TYPE:STRING=${THIRD_PARTY_BUILD_TYPE}
5253
)
5354

5455
ADD_LIBRARY(glog STATIC IMPORTED GLOBAL)

cmake/external/gtest.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ IF(WITH_TESTING)
5656
-DBUILD_GMOCK=ON
5757
-Dgtest_disable_pthreads=ON
5858
-Dgtest_force_shared_crt=ON
59-
-DCMAKE_BUILD_TYPE=Release
59+
-DCMAKE_BUILD_TYPE=${THIRD_PARTY_BUILD_TYPE}
6060
${EXTERNAL_OPTIONAL_ARGS}
6161
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${GTEST_INSTALL_DIR}
6262
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
63-
-DCMAKE_BUILD_TYPE:STRING=Release
63+
-DCMAKE_BUILD_TYPE:STRING=${THIRD_PARTY_BUILD_TYPE}
6464
)
6565

6666
ADD_LIBRARY(gtest STATIC IMPORTED GLOBAL)

cmake/external/protobuf.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,12 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST)
191191
${OPTIONAL_ARGS}
192192
-Dprotobuf_BUILD_TESTS=OFF
193193
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
194-
-DCMAKE_BUILD_TYPE=Release
194+
-DCMAKE_BUILD_TYPE=${THIRD_PARTY_BUILD_TYPE}
195195
-DCMAKE_INSTALL_PREFIX=${PROTOBUF_INSTALL_DIR}
196196
-DCMAKE_INSTALL_LIBDIR=lib
197197
CMAKE_CACHE_ARGS
198198
-DCMAKE_INSTALL_PREFIX:PATH=${PROTOBUF_INSTALL_DIR}
199-
-DCMAKE_BUILD_TYPE:STRING=Release
199+
-DCMAKE_BUILD_TYPE:STRING=${THIRD_PARTY_BUILD_TYPE}
200200
-DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF
201201
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
202202
${OPTIONAL_CACHE_ARGS}

0 commit comments

Comments
 (0)