Skip to content

Commit d521199

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/paddle into log-sftmx-case3
2 parents db9fc91 + 5e7e7c9 commit d521199

File tree

648 files changed

+33794
-21621
lines changed

Some content is hidden

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

648 files changed

+33794
-21621
lines changed

CMakeLists.txt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,20 @@ option(WITH_TENSORRT "Compile PaddlePaddle with NVIDIA TensorRT" OFF)
3333
option(WITH_XPU "Compile PaddlePaddle with BAIDU KUNLUN XPU" OFF)
3434
option(WITH_WIN_DUMP_DBG "Compile with windows core dump debug mode" OFF)
3535
option(WITH_ASCEND "Compile PaddlePaddle with ASCEND" OFF)
36+
option(WITH_ROCM "Compile PaddlePaddle with ROCM platform" OFF)
37+
# NOTE(zhiqiu): WITH_ASCEND_CL can be compile on x86_64, so we can set WITH_ASCEND=OFF and WITH_ASCEND_CL=ON
38+
# to develop some acl related functionality on x86
39+
option(WITH_ASCEND_CL "Compile PaddlePaddle with ASCEND CL" ${WITH_ASCEND})
3640
option(WITH_ASCEND_CXX11 "Compile PaddlePaddle with ASCEND and CXX11 ABI" OFF)
3741
if (WITH_GPU AND WITH_XPU)
3842
message(FATAL_ERROR "Error when compile GPU and XPU at the same time")
3943
endif()
40-
if (WITH_GPU AND WITH_ASCEND)
44+
if (WITH_GPU AND WITH_ASCEND)
4145
message(FATAL_ERROR "Error when compile GPU and ASCEND at the same time")
4246
endif()
47+
if (WITH_GPU AND WITH_ROCM)
48+
message(FATAL_ERROR "Error when compile CUDA and ROCM at the same time")
49+
endif()
4350

4451
if(WITH_GPU AND NOT APPLE)
4552
enable_language(CUDA)
@@ -165,8 +172,6 @@ option(WITH_DISTRIBUTE "Compile with distributed support" OFF)
165172
option(WITH_BRPC_RDMA "Use brpc rdma as the rpc protocal" OFF)
166173
option(ON_INFER "Turn on inference optimization and inference-lib generation" OFF)
167174
################################ Internal Configurations #######################################
168-
option(WITH_ROCM "Compile PaddlePaddle with ROCM platform" OFF)
169-
option(WITH_RCCL "Compile PaddlePaddle with RCCL support" OFF)
170175
option(WITH_NV_JETSON "Compile PaddlePaddle with NV JETSON" OFF)
171176
option(WITH_PROFILER "Compile PaddlePaddle with GPU profiler and gperftools" OFF)
172177
option(WITH_COVERAGE "Compile PaddlePaddle with code coverage" OFF)
@@ -179,12 +184,14 @@ option(WITH_XBYAK "Compile with xbyak support" ON)
179184
option(WITH_CONTRIB "Compile the third-party contributation" OFF)
180185
option(WITH_GRPC "Use grpc as the default rpc framework" ${WITH_DISTRIBUTE})
181186
option(WITH_PSCORE "Compile with parameter server support" ${WITH_DISTRIBUTE})
187+
option(WITH_HETERPS "Compile with heterps" OFF})
182188
option(WITH_INFERENCE_API_TEST "Test fluid inference C++ high-level api interface" OFF)
183189
option(PY_VERSION "Compile PaddlePaddle with python3 support" ${PY_VERSION})
184190
option(WITH_DGC "Use DGC(Deep Gradient Compression) or not" ${WITH_DISTRIBUTE})
185191
option(SANITIZER_TYPE "Choose the type of sanitizer, options are: Address, Leak, Memory, Thread, Undefined" OFF)
186192
option(WITH_LITE "Compile Paddle Fluid with Lite Engine" OFF)
187193
option(WITH_NCCL "Compile PaddlePaddle with NCCL support" ON)
194+
option(WITH_RCCL "Compile PaddlePaddle with RCCL support" ON)
188195
option(WITH_XPU_BKCL "Compile PaddlePaddle with BAIDU KUNLUN XPU BKCL" OFF)
189196
option(WITH_CRYPTO "Compile PaddlePaddle with crypto support" ON)
190197
option(WITH_ARM "Compile PaddlePaddle with arm support" OFF)
@@ -302,9 +309,9 @@ endif(WITH_ROCM)
302309

303310
if (NOT WITH_ROCM AND WITH_RCCL)
304311
MESSAGE(WARNING
305-
"Disable RCCL when compiling without GPU. Force WITH_RCCL=OFF.")
306-
set(WITH_NCCL OFF CACHE STRING
307-
"Disable RCCL when compiling without GPU" FORCE)
312+
"Disable RCCL when compiling without ROCM. Force WITH_RCCL=OFF.")
313+
set(WITH_RCCL OFF CACHE STRING
314+
"Disable RCCL when compiling without ROCM" FORCE)
308315
endif()
309316

310317
if(WITH_RCCL)

cmake/configure.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ if(WITH_ASCEND)
8282
add_definitions(-DPADDLE_WITH_ASCEND)
8383
endif()
8484

85+
if(WITH_ASCEND_CL)
86+
add_definitions(-DPADDLE_WITH_ASCEND_CL)
87+
endif()
88+
8589
if(WITH_XPU)
8690
message(STATUS "Compile with XPU!")
8791
add_definitions(-DPADDLE_WITH_XPU)
@@ -169,6 +173,9 @@ if(WITH_PSCORE)
169173
add_definitions(-DPADDLE_WITH_PSCORE)
170174
endif()
171175

176+
if(WITH_HETERPS)
177+
add_definitions(-DPADDLE_WITH_HETERPS)
178+
endif()
172179

173180
if(WITH_GRPC)
174181
add_definitions(-DPADDLE_WITH_GRPC)

cmake/external/ascend.cmake

Lines changed: 56 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,38 +21,65 @@ else()
2121
set(ASCEND_DIR /usr/local/Ascend)
2222
endif()
2323

24-
set(ASCEND_DRIVER_DIR ${ASCEND_DIR}/driver/lib64)
25-
set(ASCEND_DRIVER_COMMON_DIR ${ASCEND_DIR}/driver/lib64/common)
26-
set(ASCEND_DRIVER_SHARE_DIR ${ASCEND_DIR}/driver/lib64/share)
27-
set(ASCEND_RUNTIME_DIR ${ASCEND_DIR}/fwkacllib/lib64)
28-
set(ASCEND_ATC_DIR ${ASCEND_DIR}/atc/lib64)
29-
set(ASCEND_ACL_DIR ${ASCEND_DIR}/acllib/lib64)
30-
set(STATIC_ACL_LIB ${ASCEND_ACL_DIR})
31-
32-
set(ASCEND_MS_RUNTIME_PATH ${ASCEND_RUNTIME_DIR} ${ASCEND_ACL_DIR} ${ASCEND_ATC_DIR})
33-
set(ASCEND_MS_DRIVER_PATH ${ASCEND_DRIVER_DIR} ${ASCEND_DRIVER_COMMON_DIR})
34-
set(ATLAS_RUNTIME_DIR ${ASCEND_DIR}/ascend-toolkit/latest/fwkacllib/lib64)
35-
set(ATLAS_RUNTIME_INC_DIR ${ASCEND_DIR}/ascend-toolkit/latest/fwkacllib/include)
36-
set(ATLAS_ACL_DIR ${ASCEND_DIR}/ascend-toolkit/latest/acllib/lib64)
37-
set(ATLAS_ATC_DIR ${ASCEND_DIR}/ascend-toolkit/latest/atc/lib64)
38-
set(ATLAS_MS_RUNTIME_PATH ${ATLAS_RUNTIME_DIR} ${ATLAS_ACL_DIR} ${ATLAS_ATC_DIR})
39-
40-
set(atlas_graph_lib ${ATLAS_RUNTIME_DIR}/libgraph.so)
41-
set(atlas_ge_runner_lib ${ATLAS_RUNTIME_DIR}/libge_runner.so)
42-
set(atlas_acl_lib ${ATLAS_RUNTIME_DIR}/libascendcl.so)
43-
INCLUDE_DIRECTORIES(${ATLAS_RUNTIME_INC_DIR})
44-
45-
if(EXISTS ${ATLAS_RUNTIME_INC_DIR}/graph/ascend_string.h)
24+
if(EXISTS ${ASCEND_DIR}/ascend-toolkit/latest/fwkacllib/include/graph/ascend_string.h)
25+
# It means CANN 20.2 +
4626
add_definitions(-DPADDLE_WITH_ASCEND_STRING)
4727
endif()
4828

49-
ADD_LIBRARY(ascend_ge SHARED IMPORTED GLOBAL)
50-
SET_PROPERTY(TARGET ascend_ge PROPERTY IMPORTED_LOCATION ${atlas_ge_runner_lib})
29+
if(WITH_ASCEND)
30+
set(ASCEND_DRIVER_DIR ${ASCEND_DIR}/driver/lib64)
31+
set(ASCEND_DRIVER_COMMON_DIR ${ASCEND_DIR}/driver/lib64/common)
32+
set(ASCEND_DRIVER_SHARE_DIR ${ASCEND_DIR}/driver/lib64/share)
33+
set(ASCEND_RUNTIME_DIR ${ASCEND_DIR}/fwkacllib/lib64)
34+
set(ASCEND_ATC_DIR ${ASCEND_DIR}/atc/lib64)
35+
set(ASCEND_ACL_DIR ${ASCEND_DIR}/acllib/lib64)
36+
set(STATIC_ACL_LIB ${ASCEND_ACL_DIR})
5137

52-
ADD_LIBRARY(ascend_graph SHARED IMPORTED GLOBAL)
53-
SET_PROPERTY(TARGET ascend_graph PROPERTY IMPORTED_LOCATION ${atlas_graph_lib})
38+
set(ASCEND_MS_RUNTIME_PATH ${ASCEND_RUNTIME_DIR} ${ASCEND_ACL_DIR} ${ASCEND_ATC_DIR})
39+
set(ASCEND_MS_DRIVER_PATH ${ASCEND_DRIVER_DIR} ${ASCEND_DRIVER_COMMON_DIR})
40+
set(ATLAS_RUNTIME_DIR ${ASCEND_DIR}/ascend-toolkit/latest/fwkacllib/lib64)
41+
set(ATLAS_RUNTIME_INC_DIR ${ASCEND_DIR}/ascend-toolkit/latest/fwkacllib/include)
42+
set(ATLAS_ACL_DIR ${ASCEND_DIR}/ascend-toolkit/latest/acllib/lib64)
43+
set(ATLAS_ATC_DIR ${ASCEND_DIR}/ascend-toolkit/latest/atc/lib64)
44+
set(ATLAS_MS_RUNTIME_PATH ${ATLAS_RUNTIME_DIR} ${ATLAS_ACL_DIR} ${ATLAS_ATC_DIR})
5445

55-
ADD_LIBRARY(atlas_acl SHARED IMPORTED GLOBAL)
56-
SET_PROPERTY(TARGET atlas_acl PROPERTY IMPORTED_LOCATION ${atlas_acl_lib})
46+
set(atlas_graph_lib ${ATLAS_RUNTIME_DIR}/libgraph.so)
47+
set(atlas_ge_runner_lib ${ATLAS_RUNTIME_DIR}/libge_runner.so)
48+
set(atlas_acl_lib ${ATLAS_RUNTIME_DIR}/libascendcl.so)
49+
INCLUDE_DIRECTORIES(${ATLAS_RUNTIME_INC_DIR})
5750

58-
add_custom_target(extern_ascend DEPENDS ascend_ge ascend_graph atlas_acl)
51+
52+
53+
ADD_LIBRARY(ascend_ge SHARED IMPORTED GLOBAL)
54+
SET_PROPERTY(TARGET ascend_ge PROPERTY IMPORTED_LOCATION ${atlas_ge_runner_lib})
55+
56+
ADD_LIBRARY(ascend_graph SHARED IMPORTED GLOBAL)
57+
SET_PROPERTY(TARGET ascend_graph PROPERTY IMPORTED_LOCATION ${atlas_graph_lib})
58+
59+
ADD_LIBRARY(atlas_acl SHARED IMPORTED GLOBAL)
60+
SET_PROPERTY(TARGET atlas_acl PROPERTY IMPORTED_LOCATION ${atlas_acl_lib})
61+
62+
add_custom_target(extern_ascend DEPENDS ascend_ge ascend_graph atlas_acl)
63+
endif()
64+
65+
if(WITH_ASCEND_CL)
66+
set(ASCEND_CL_DIR ${ASCEND_DIR}/ascend-toolkit/latest/fwkacllib/lib64)
67+
68+
set(ascendcl_lib ${ASCEND_CL_DIR}/libascendcl.so)
69+
set(acl_op_compiler_lib ${ASCEND_CL_DIR}/libacl_op_compiler.so)
70+
set(FWKACLLIB_INC_DIR ${ASCEND_DIR}/ascend-toolkit/latest/fwkacllib/include)
71+
set(ACLLIB_INC_DIR ${ASCEND_DIR}/ascend-toolkit/latest/acllib/include)
72+
73+
message(STATUS "FWKACLLIB_INC_DIR ${FWKACLLIB_INC_DIR}")
74+
message(STATUS "ASCEND_CL_DIR ${ASCEND_CL_DIR}")
75+
INCLUDE_DIRECTORIES(${FWKACLLIB_INC_DIR})
76+
INCLUDE_DIRECTORIES(${ACLLIB_INC_DIR})
77+
78+
ADD_LIBRARY(ascendcl SHARED IMPORTED GLOBAL)
79+
SET_PROPERTY(TARGET ascendcl PROPERTY IMPORTED_LOCATION ${ascendcl_lib})
80+
81+
ADD_LIBRARY(acl_op_compiler SHARED IMPORTED GLOBAL)
82+
SET_PROPERTY(TARGET acl_op_compiler PROPERTY IMPORTED_LOCATION ${acl_op_compiler_lib})
83+
add_custom_target(extern_ascend_cl DEPENDS ascendcl acl_op_compiler)
84+
85+
endif()

cmake/external/brpc.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ set(prefix_path "${THIRD_PARTY_PATH}/install/gflags|${THIRD_PARTY_PATH}/install/
3939
ExternalProject_Add(
4040
extern_brpc
4141
${EXTERNAL_PROJECT_LOG_ARGS}
42-
# TODO(gongwb): change to de newst repo when they changed.
42+
# TODO(gongwb): change to de newst repo when they changed
4343
GIT_REPOSITORY "https://github.com/wangjiawei04/brpc"
4444
GIT_TAG "e203afb794caf027da0f1e0776443e7d20c0c28e"
4545
PREFIX ${BRPC_SOURCES_DIR}

cmake/external/gloo.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ cache_third_party(extern_gloo
3232
TAG ${GLOO_TAG}
3333
DIR GLOO_SOURCE_DIR)
3434

35-
if(WITH_ASCEND)
35+
if(WITH_ASCEND OR WITH_ASCEND_CL)
3636
ExternalProject_Add(
3737
extern_gloo
3838
${EXTERNAL_PROJECT_LOG_ARGS}

cmake/external/grpc.cmake

Lines changed: 0 additions & 77 deletions
This file was deleted.

cmake/external/mkldnn.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ SET(MKLDNN_SOURCE_DIR ${THIRD_PARTY_PATH}/mkldnn/src/extern_mkldnn)
2020
SET(MKLDNN_INSTALL_DIR ${THIRD_PARTY_PATH}/install/mkldnn)
2121
SET(MKLDNN_INC_DIR "${MKLDNN_INSTALL_DIR}/include" CACHE PATH "mkldnn include directory." FORCE)
2222
SET(MKLDNN_REPOSITORY ${GIT_URL}/oneapi-src/oneDNN.git)
23-
SET(MKLDNN_TAG 72efa005effb49595933e033cc732f215ef0445a)
23+
SET(MKLDNN_TAG f58682cd8bd0615f41d879f8afc8f1511ab42d24)
2424

2525
# Introduce variables:
2626
# * CMAKE_INSTALL_LIBDIR

cmake/external/protobuf.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST)
201201
if(WITH_ASCEND AND NOT WITH_ASCEND_CXX11)
202202
SET(PROTOBUF_REPOSITORY https://gitee.com/tianjianhe/protobuf.git)
203203
SET(PROTOBUF_TAG v3.8.0)
204+
elseif(WITH_ASCEND_CL AND NOT WITH_ASCEND_CXX11)
205+
SET(PROTOBUF_REPOSITORY https://gitee.com/tianjianhe/protobuf.git)
206+
SET(PROTOBUF_TAG v3.8.0)
204207
else()
205208
SET(PROTOBUF_REPOSITORY ${GIT_URL}/protocolbuffers/protobuf.git)
206209
SET(PROTOBUF_TAG 9f75c5aa851cd877fb0d93ccc31b8567a6706546)
@@ -239,7 +242,7 @@ endif()
239242
)
240243
ENDFUNCTION()
241244

242-
if(WITH_ASCEND)
245+
if(WITH_ASCEND OR WITH_ASCEND_CL)
243246
SET(PROTOBUF_VERSION 3.8.0)
244247
else()
245248
SET(PROTOBUF_VERSION 3.1.0)

cmake/external/threadpool.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ INCLUDE(ExternalProject)
1616

1717
SET(THREADPOOL_PREFIX_DIR ${THIRD_PARTY_PATH}/threadpool)
1818
SET(THREADPOOL_SOURCE_DIR ${THIRD_PARTY_PATH}/threadpool/src/extern_threadpool)
19-
if(WITH_ASCEND)
19+
if(WITH_ASCEND OR WITH_ASCEND_CL)
2020
SET(THREADPOOL_REPOSITORY https://gitee.com/tianjianhe/ThreadPool.git)
2121
else()
2222
SET(THREADPOOL_REPOSITORY ${GIT_URL}/progschj/ThreadPool.git)

cmake/external/warpctc.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ cache_third_party(extern_warpctc
4343
TAG ${WARPCTC_TAG}
4444
DIR WARPCTC_SOURCE_DIR)
4545

46-
if(WITH_ASCEND)
46+
if(WITH_ASCEND OR WITH_ASCEND_CL)
4747
ExternalProject_Add(
4848
extern_warpctc
4949
${EXTERNAL_PROJECT_LOG_ARGS}

0 commit comments

Comments
 (0)