Skip to content

Commit 7cb2c97

Browse files
authored
Merge pull request #8 from PaddlePaddle/develop
update local paddlepaddle
2 parents 855d00b + 495e7f9 commit 7cb2c97

File tree

2,365 files changed

+144407
-35134
lines changed

Some content is hidden

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

2,365 files changed

+144407
-35134
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
name: 文档(Document Issue)
3+
about: 您可以提问文档相关的问题。 You could use this template for reporting an document issue.
4+
5+
---
6+
7+
非常感谢您提交关于飞桨文档的Issue,我们会认真听取您的意见,并进行改进。
8+
9+
建立issue时,为快速解决问题,请您根据情况给出如下信息:
10+
- 标题:请包含关键词“XXX文档问题”,例如“add 文档问题” 或 ”paddle.add 文档问题“
11+
- 文档版本信息:请提供有问题的文档的版本号,例如 develop,1.8,2.0RC;
12+
13+
### 文档问题描述:
14+
15+
#### API文档描述是否清晰?
16+
如:文档描述看不懂,不知道这个API该怎么用;文档公式错误;
17+
18+
#### 参数说明是否清晰
19+
如:参数未解释清楚,包括用法、使用场景、默认值等
20+
21+
#### 返回/形状说明是否清晰
22+
如:API返回值、数据的形状描述错误、不清楚
23+
24+
#### 示例代码是否有效?
25+
如:没有示例代码;示例代码没有可指导性;示例代码跑不通;示例代码格式有问题;示例代码没有注释;
26+
27+
#### 中英文内容是否一致?
28+
如:中英文API描述不一致;中英文API参数不一致;
29+
30+
#### 其他
31+
如:文档页面打不开;文档缺失;文档中有死链;
32+
33+
34+
Thanks for opening a document issue. We will listen to your opinions carefully and make improvements.
35+
36+
In order to quickly solve your problem, when creating an issue, please provide the following information:
37+
**Document Information**
38+
- Title:Please include the keyword "XXX document issue", such as "add document issue" or "paddle.add document issue"
39+
- Doc Version:Please provide the version of the document, such as develop, 1.8, 2.0RC;
40+
41+
### Describe the problem:
42+
43+
#### Document description is clear?
44+
For example: I don’t understand this document, I don’t know how to use this API; The formula in this doc is unclear;
45+
46+
#### Parameter description is clear?
47+
For example: The parameters are confusing, including usage, scenarios, default values, etc.
48+
49+
#### Return/Shape description is clear
50+
For example: Data returned this doc is error, shape returned is not clear.
51+
52+
#### The sample code is clear?
53+
For example: no sample code; The sample code is not helpful; The sample code not run well; Format of the sample is not reasonable; The sample code has no comments.
54+
55+
#### Chinese content and English content is consistent?
56+
For example:Chinese API in this doc is inconsistent with English API, including params, description, sample code, formula, etc.
57+
58+
#### Other
59+
For example: The doc link is broken; The doc page is missing; Dead link in docs.

CMakeLists.txt

Lines changed: 98 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License
1414

15-
cmake_minimum_required(VERSION 3.10)
15+
cmake_minimum_required(VERSION 3.15)
16+
cmake_policy(VERSION 3.10)
1617
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
1718
set(PADDLE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
1819
set(PADDLE_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
@@ -28,14 +29,15 @@ include(generic) # simplify cmake module
2829
# TODO(Shibo Tao): remove find_package(CUDA) completely.
2930
find_package(CUDA QUIET)
3031
option(WITH_GPU "Compile PaddlePaddle with NVIDIA GPU" ${CUDA_FOUND})
31-
option(WITH_XPU "Compile PaddlePaddle with BAIDU KUNLUN" OFF)
32+
option(WITH_TENSORRT "Compile PaddlePaddle with NVIDIA TensorRT" OFF)
33+
option(WITH_XPU "Compile PaddlePaddle with BAIDU KUNLUN XPU" OFF)
34+
option(WITH_WIN_DUMP_DBG "Compile with windows core dump debug mode" OFF)
35+
option(WITH_ASCEND "Compile PaddlePaddle with ASCEND" OFF)
3236
if (WITH_GPU AND WITH_XPU)
3337
message(FATAL_ERROR "Error when compile GPU and XPU at the same time")
3438
endif()
35-
# cmake 3.12, 3.13, 3.14 will append gcc link options to nvcc, and nvcc doesn't recognize them.
36-
if(WITH_GPU AND (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.12) AND (${CMAKE_VERSION} VERSION_LESS 3.15))
37-
message(FATAL_ERROR "cmake ${CMAKE_VERSION} is not supported when WITH_GPU=ON because of bug https://cmake.org/pipermail/cmake/2018-September/068195.html. "
38-
"You can use cmake 3.16 (recommended), 3.10, 3.11, 3.15 or 3.17. Please refer to the install document: https://cmake.org/install/")
39+
if (WITH_GPU AND WITH_ASCEND)
40+
message(FATAL_ERROR "Error when compile GPU and ASCEND at the same time")
3941
endif()
4042

4143
if(WITH_GPU AND NOT APPLE)
@@ -50,19 +52,36 @@ message(STATUS "C compiler: ${CMAKE_C_COMPILER}, version: "
5052
"${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
5153
message(STATUS "AR tools: ${CMAKE_AR}")
5254

55+
# MUSL build turn off warnings
56+
if(WITH_MUSL)
57+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=deprecated-declarations -Wno-deprecated-declarations -Wno-error=pessimizing-move -Wno-error=deprecated-copy")
58+
endif()
59+
60+
5361
if(WIN32)
5462
option(MSVC_STATIC_CRT "use static C Runtime library by default" ON)
5563

5664
set(CMAKE_SUPPRESS_REGENERATION ON)
5765
set(CMAKE_STATIC_LIBRARY_PREFIX lib)
58-
add_definitions("/DGOOGLE_GLOG_DLL_DECL=")
66+
67+
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /bigobj")
68+
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /bigobj")
69+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj")
70+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /bigobj")
71+
72+
if("${CMAKE_GENERATOR}" STREQUAL "Ninja")
73+
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Zc:inline")
74+
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Zc:inline")
75+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Zc:inline")
76+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zc:inline")
77+
endif()
5978

6079
if (MSVC_STATIC_CRT)
6180
message(STATUS "Use static C runtime time, refer to https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features?view=vs-2019")
62-
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /bigobj /MTd")
63-
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /bigobj /MT")
64-
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj /MTd")
65-
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /bigobj /MT")
81+
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
82+
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
83+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
84+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
6685
foreach(flag_var
6786
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
6887
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
@@ -73,15 +92,17 @@ if(WIN32)
7392
endif()
7493
endforeach(flag_var)
7594
endif()
76-
95+
96+
# NOTE(Avin0323): Less parallel count result in faster compilation.
97+
math(EXPR PROCESS_MAX "${CPU_CORES} * 2 / 3")
7798
# windows build turn off warnings, use parallel compiling.
7899
foreach(flag_var
79100
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
80101
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
81102
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
82103
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
83104
string(REGEX REPLACE "/W[1-4]" " /W0 " ${flag_var} "${${flag_var}}")
84-
set(${flag_var} "${${flag_var}} /MP")
105+
set(${flag_var} "${${flag_var}} /MP${PROCESS_MAX}")
85106
endforeach(flag_var)
86107
foreach(flag_var CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
87108
set(${flag_var} "${${flag_var}} /w")
@@ -98,6 +119,22 @@ if(WIN32)
98119

99120
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4068 /wd4129 /wd4244 /wd4267 /wd4297 /wd4530 /wd4577 /wd4819 /wd4838")
100121
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4068 /wd4129 /wd4244 /wd4267 /wd4297 /wd4530 /wd4577 /wd4819 /wd4838")
122+
123+
foreach(flag_var CMAKE_SHARED_LINKER_FLAGS CMAKE_STATIC_LINKER_FLAGS CMAKE_EXE_LINKER_FLAGS CMAKE_LINKER_FLAGS)
124+
set(${flag_var} "${${flag_var}} /ignore:4049 /ignore:4217 /ignore:4006 /ignore:4221")
125+
endforeach(flag_var)
126+
127+
if (WITH_WIN_DUMP_DBG)
128+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Zi")
129+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
130+
131+
foreach(flag_var CMAKE_SHARED_LINKER_FLAGS CMAKE_STATIC_LINKER_FLAGS CMAKE_EXE_LINKER_FLAGS CMAKE_LINKER_FLAGS)
132+
set(${flag_var} "${${flag_var}} /DEBUG /OPT:REF /OPT:ICF")
133+
endforeach(flag_var)
134+
135+
add_definitions("-DWITH_WIN_DUMP_DBG")
136+
endif()
137+
101138
else(WIN32)
102139
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=deprecated-declarations -Wno-deprecated-declarations")
103140
endif(WIN32)
@@ -124,27 +161,33 @@ option(WITH_DISTRIBUTE "Compile with distributed support" OFF)
124161
option(WITH_BRPC_RDMA "Use brpc rdma as the rpc protocal" OFF)
125162
option(ON_INFER "Turn on inference optimization and inference-lib generation" OFF)
126163
################################ Internal Configurations #######################################
127-
option(WITH_AMD_GPU "Compile PaddlePaddle with AMD GPU" OFF)
128-
option(WITH_NV_JETSON "Compile PaddlePaddle with NV JETSON" OFF)
164+
option(WITH_ROCM "Compile PaddlePaddle with ROCM platform" OFF)
165+
option(WITH_RCCL "Compile PaddlePaddle with RCCL support" OFF)
166+
option(WITH_NV_JETSON "Compile PaddlePaddle with NV JETSON" OFF)
129167
option(WITH_PROFILER "Compile PaddlePaddle with GPU profiler and gperftools" OFF)
130168
option(WITH_COVERAGE "Compile PaddlePaddle with code coverage" OFF)
169+
option(WITH_INCREMENTAL_COVERAGE "Generate coverage reports only for incremental code" OFF)
131170
OPTION(WITH_LIBXSMM "Compile with libxsmm" OFF)
132171
option(COVERALLS_UPLOAD "Package code coverage data to coveralls" OFF)
133172
option(WITH_PSLIB "Compile with pslib support" OFF)
134173
option(WITH_BOX_PS "Compile with box_ps support" OFF)
135174
option(WITH_XBYAK "Compile with xbyak support" ON)
136175
option(WITH_CONTRIB "Compile the third-party contributation" OFF)
137176
option(WITH_GRPC "Use grpc as the default rpc framework" ${WITH_DISTRIBUTE})
177+
option(WITH_PSCORE "Compile with parameter server support" ${WITH_DISTRIBUTE})
138178
option(WITH_INFERENCE_API_TEST "Test fluid inference C++ high-level api interface" OFF)
139179
option(PY_VERSION "Compile PaddlePaddle with python3 support" ${PY_VERSION})
140180
option(WITH_DGC "Use DGC(Deep Gradient Compression) or not" ${WITH_DISTRIBUTE})
141181
option(SANITIZER_TYPE "Choose the type of sanitizer, options are: Address, Leak, Memory, Thread, Undefined" OFF)
142182
option(WITH_LITE "Compile Paddle Fluid with Lite Engine" OFF)
143183
option(WITH_NCCL "Compile PaddlePaddle with NCCL support" ON)
184+
option(WITH_XPU_BKCL "Compile PaddlePaddle with BAIDU KUNLUN XPU BKCL" OFF)
144185
option(WITH_CRYPTO "Compile PaddlePaddle with crypto support" ON)
145186
option(WITH_ARM "Compile PaddlePaddle with arm support" OFF)
146187
option(WITH_SW "Compile PaddlePaddle with sw support" OFF)
188+
option(WITH_MIPS "Compile PaddlePaddle with mips support" OFF)
147189
option(WITH_MUSL "Compile with musl libc instead of gblic" OFF)
190+
option(WITH_UNITY_BUILD "Compile with UnityBuild mode" OFF)
148191

149192
# PY_VERSION
150193
if(NOT PY_VERSION)
@@ -187,6 +230,13 @@ if (NOT WITH_GPU AND WITH_NCCL)
187230
"Disable NCCL when compiling without GPU" FORCE)
188231
endif()
189232

233+
if (NOT WITH_XPU AND WITH_XPU_BKCL)
234+
MESSAGE(WARNING
235+
"Disable BKCL when compiling without XPU. Force WITH_XPU_BKCL=OFF.")
236+
set(WITH_XPU_BKCL OFF CACHE STRING
237+
"Disable BKCL when compiling without XPU" FORCE)
238+
endif()
239+
190240
if(WITH_NCCL)
191241
add_definitions("-DPADDLE_WITH_NCCL")
192242
include(nccl)
@@ -220,17 +270,6 @@ endif()
220270

221271
include(third_party) # download, build, install third_party, Contains about 20+ dependencies
222272

223-
if(WITH_DISTRIBUTE)
224-
if(WITH_GRPC)
225-
message(STATUS "Use grpc framework.")
226-
include(external/grpc)
227-
else()
228-
message(STATUS "Use brpc framework.")
229-
include(external/leveldb)
230-
include(external/brpc)
231-
endif()
232-
endif()
233-
234273
include(flags) # set paddle compile flags
235274

236275
if(WITH_PROFILER)
@@ -239,6 +278,12 @@ if(WITH_PROFILER)
239278
add_definitions(-DWITH_GPERFTOOLS)
240279
endif()
241280

281+
if(WITH_DISTRIBUTE)
282+
if(LINUX)
283+
set(WITH_GLOO ON CACHE STRING "Enable GLOO when compiling WITH_DISTRIBUTE=ON." FORCE)
284+
endif()
285+
endif()
286+
242287
include(ccache) # set ccache for compilation
243288
include(util) # set unittest and link libs
244289
include(version) # set PADDLE_VERSION
@@ -247,15 +292,28 @@ include(configure) # add paddle env configuration
247292

248293
include_directories("${PADDLE_SOURCE_DIR}")
249294

250-
if(WITH_AMD_GPU)
251-
find_package(HIP)
295+
if(WITH_ROCM)
252296
include(hip)
253-
endif(WITH_AMD_GPU)
297+
endif(WITH_ROCM)
254298

255-
if(WITH_DISTRIBUTE)
256-
if(LINUX)
257-
set(WITH_GLOO ON CACHE STRING "Enable GLOO when compiling WITH_DISTRIBUTE=ON." FORCE)
258-
endif()
299+
if (NOT WITH_ROCM AND WITH_RCCL)
300+
MESSAGE(WARNING
301+
"Disable RCCL when compiling without GPU. Force WITH_RCCL=OFF.")
302+
set(WITH_NCCL OFF CACHE STRING
303+
"Disable RCCL when compiling without GPU" FORCE)
304+
endif()
305+
306+
if(WITH_RCCL)
307+
add_definitions("-DPADDLE_WITH_RCCL")
308+
include(rccl)
309+
else()
310+
if(WITH_ROCM)
311+
MESSAGE(WARNING "If the environment is multi-card, the WITH_RCCL option needs to be turned on, otherwise only a single card can be used.")
312+
endif()
313+
endif()
314+
315+
if(WITH_NV_JETSON)
316+
set(WITH_ARM ON CACHE STRING "Set WITH_ARM=ON when compiling WITH_NV_JETSON=ON." FORCE)
259317
endif()
260318

261319
if(WITH_ARM)
@@ -275,11 +333,18 @@ if (WITH_SW)
275333
add_definitions(-DPADDLE_WITH_SW)
276334
endif()
277335

336+
if (WITH_MIPS)
337+
set(WITH_XBYAK OFF CACHE STRING "Disable XBYAK when compiling WITH_MIPS=ON" FORCE)
338+
add_definitions(-DPADDLE_WITH_MIPS)
339+
endif()
340+
278341
set(PADDLE_PYTHON_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/python/build")
279342

280343
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
281344
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")
282345

346+
add_definitions(-DPADDLE_DLL_EXPORT)
347+
283348
if(ON_INFER)
284349
# you can trun off the paddle fluid and inference lib by set ON_INFER=OFF
285350
message(STATUS "On inference mode, will take place some specific optimization.")

0 commit comments

Comments
 (0)