Skip to content

Commit

Permalink
remove WITH_ASCEND_CL PADDLE_WITH_ASCEND_CL WITH_ASCEND_CXX11 (#52448)
Browse files Browse the repository at this point in the history
  • Loading branch information
engineer1109 authored Apr 3, 2023
1 parent 04f8c24 commit 0b60f28
Show file tree
Hide file tree
Showing 103 changed files with 140 additions and 4,400 deletions.
28 changes: 0 additions & 28 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ option(WITH_WIN_DUMP_DBG "Compile with windows core dump debug mode" OFF)
option(WITH_ASCEND "Compile PaddlePaddle with ASCEND" OFF)
option(WITH_ROCM "Compile PaddlePaddle with ROCM platform" OFF)
option(WITH_IPU "Compile PaddlePaddle with Graphcore IPU" OFF)
# NOTE(zhiqiu): WITH_ASCEND_CL can be compile on x86_64, so we can set WITH_ASCEND=OFF and WITH_ASCEND_CL=ON
# to develop some acl related functionality on x86
option(WITH_ASCEND_CL "Compile PaddlePaddle with ASCEND CL" ${WITH_ASCEND})
option(WITH_ASCEND_CXX11 "Compile PaddlePaddle with ASCEND and CXX11 ABI" OFF)
option(WITH_ONNXRUNTIME "Compile PaddlePaddle with ONNXRUNTIME" OFF)
option(WITH_CUSPARSELT "Compile PaddlePaddle with CUSPARSELT" OFF)
option(WITH_SETUP_INSTALL "Compile PaddlePaddle with setup.py" OFF)
Expand Down Expand Up @@ -113,14 +109,6 @@ if(APPLE AND WITH_ARM)
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -target arm64-apple-darwin")
endif()

if(WITH_ASCEND_CL AND NOT WITH_ASCEND_CXX11)
if(WITH_ARM_BRPC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=1")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
endif()

if(WIN32)
option(MSVC_STATIC_CRT "use static C Runtime library by default" ON)

Expand Down Expand Up @@ -525,15 +513,6 @@ if(WITH_DISTRIBUTE)
ON
CACHE STRING "Enable GLOO when compiling WITH_DISTRIBUTE=ON." FORCE)
endif()
if(WITH_ASCEND_CL AND NOT WITH_ARM_BRPC)
# disable WITH_PSCORE for NPU before include third_party
message(
WARNING
"Disable WITH_PSCORE when compiling with NPU. Force WITH_PSCORE=OFF.")
set(WITH_PSCORE
OFF
CACHE BOOL "Disable WITH_PSCORE when compiling with NPU" FORCE)
endif()
if(WITH_ROCM AND HIP_VERSION LESS_EQUAL 40020496)
# TODO(qili93): third-party rocksdb throw Illegal instruction with HIP version 40020496
message(
Expand Down Expand Up @@ -567,13 +546,6 @@ if(WITH_RPC)
OFF
CACHE BOOL "Disable WITH_RPC when not compiled with distribute" FORCE)
endif()
if(WITH_ASCEND_CL AND WITH_RPC)
message(
WARNING "Disable WITH_RPC when compiling with NPU. Force WITH_RPC=OFF.")
set(WITH_RPC
OFF
CACHE BOOL "Disable WITH_RPC when compiling with NPU" FORCE)
endif()
if(WITH_ROCM AND WITH_RPC)
message(
WARNING "Disable WITH_RPC when compiling with ROCM. Force WITH_RPC=OFF.")
Expand Down
4 changes: 0 additions & 4 deletions cmake/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ if(WITH_ASCEND)
add_definitions(-DPADDLE_WITH_ASCEND)
endif()

if(WITH_ASCEND_CL)
add_definitions(-DPADDLE_WITH_ASCEND_CL)
endif()

if(WITH_ASCEND_INT64)
add_definitions(-DPADDLE_WITH_ASCEND_INT64)
endif()
Expand Down
108 changes: 0 additions & 108 deletions cmake/external/ascend.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,111 +25,3 @@ if(EXISTS
# It means CANN 20.2 +
add_definitions(-DPADDLE_WITH_ASCEND_STRING)
endif()

if(WITH_ASCEND OR WITH_ASCEND_CL)
set(ASCEND_DRIVER_DIR ${ASCEND_DIR}/driver/lib64)
set(ASCEND_DRIVER_COMMON_DIR ${ASCEND_DIR}/driver/lib64/common)
set(ASCEND_DRIVER_SHARE_DIR ${ASCEND_DIR}/driver/lib64/share)
set(ASCEND_RUNTIME_DIR ${ASCEND_DIR}/fwkacllib/lib64)
set(ASCEND_ATC_DIR ${ASCEND_DIR}/atc/lib64)
set(ASCEND_ACL_DIR ${ASCEND_DIR}/acllib/lib64)
set(STATIC_ACL_LIB ${ASCEND_ACL_DIR})

set(ASCEND_MS_RUNTIME_PATH ${ASCEND_RUNTIME_DIR} ${ASCEND_ACL_DIR}
${ASCEND_ATC_DIR})
set(ASCEND_MS_DRIVER_PATH ${ASCEND_DRIVER_DIR} ${ASCEND_DRIVER_COMMON_DIR})
set(ATLAS_RUNTIME_DIR ${ASCEND_DIR}/ascend-toolkit/latest/fwkacllib/lib64)
set(ATLAS_RUNTIME_INC_DIR
${ASCEND_DIR}/ascend-toolkit/latest/fwkacllib/include)
set(ATLAS_ACL_DIR ${ASCEND_DIR}/ascend-toolkit/latest/acllib/lib64)
set(ATLAS_ATC_DIR ${ASCEND_DIR}/ascend-toolkit/latest/atc/lib64)
set(ATLAS_MS_RUNTIME_PATH ${ATLAS_RUNTIME_DIR} ${ATLAS_ACL_DIR}
${ATLAS_ATC_DIR})

set(atlas_graph_lib ${ATLAS_RUNTIME_DIR}/libgraph.so)
set(atlas_ge_runner_lib ${ATLAS_RUNTIME_DIR}/libge_runner.so)
set(atlas_acl_lib ${ATLAS_RUNTIME_DIR}/libascendcl.so)
include_directories(${ATLAS_RUNTIME_INC_DIR})

add_library(ascend_ge SHARED IMPORTED GLOBAL)
set_property(TARGET ascend_ge PROPERTY IMPORTED_LOCATION
${atlas_ge_runner_lib})

add_library(ascend_graph SHARED IMPORTED GLOBAL)
set_property(TARGET ascend_graph PROPERTY IMPORTED_LOCATION
${atlas_graph_lib})

add_library(atlas_acl SHARED IMPORTED GLOBAL)
set_property(TARGET atlas_acl PROPERTY IMPORTED_LOCATION ${atlas_acl_lib})

add_custom_target(extern_ascend DEPENDS ascend_ge ascend_graph atlas_acl)
endif()

if(WITH_ASCEND_CL)
set(ASCEND_CL_DIR ${ASCEND_DIR}/ascend-toolkit/latest/fwkacllib/lib64)

set(ascend_hccl_lib ${ASCEND_CL_DIR}/libhccl.so)
set(ascendcl_lib ${ASCEND_CL_DIR}/libascendcl.so)
set(acl_op_compiler_lib ${ASCEND_CL_DIR}/libacl_op_compiler.so)
set(FWKACLLIB_INC_DIR ${ASCEND_DIR}/ascend-toolkit/latest/fwkacllib/include)
set(ACLLIB_INC_DIR ${ASCEND_DIR}/ascend-toolkit/latest/acllib/include)

message(STATUS "FWKACLLIB_INC_DIR ${FWKACLLIB_INC_DIR}")
message(STATUS "ASCEND_CL_DIR ${ASCEND_CL_DIR}")
include_directories(${FWKACLLIB_INC_DIR})
include_directories(${ACLLIB_INC_DIR})

add_library(ascendcl SHARED IMPORTED GLOBAL)
set_property(TARGET ascendcl PROPERTY IMPORTED_LOCATION ${ascendcl_lib})

add_library(ascend_hccl SHARED IMPORTED GLOBAL)
set_property(TARGET ascend_hccl PROPERTY IMPORTED_LOCATION ${ascend_hccl_lib})

add_library(acl_op_compiler SHARED IMPORTED GLOBAL)
set_property(TARGET acl_op_compiler PROPERTY IMPORTED_LOCATION
${acl_op_compiler_lib})
add_custom_target(extern_ascend_cl DEPENDS ascendcl acl_op_compiler)
endif()

if(WITH_ASCEND_CL)
macro(find_ascend_toolkit_version ascend_toolkit_version_info)
file(READ ${ascend_toolkit_version_info} ASCEND_TOOLKIT_VERSION_CONTENTS)
string(REGEX MATCH "version=([0-9]+\.[0-9]+\.(RC)?[0-9][.a-z0-9]*)"
ASCEND_TOOLKIT_VERSION "${ASCEND_TOOLKIT_VERSION_CONTENTS}")
string(REGEX REPLACE "version=([0-9]+\.[0-9]+\.(RC)?[0-9][.a-z0-9]*)" "\\1"
ASCEND_TOOLKIT_VERSION "${ASCEND_TOOLKIT_VERSION}")
string(REGEX REPLACE "[A-Z]|[a-z|\.]" "" CANN_VERSION
${ASCEND_TOOLKIT_VERSION})
string(SUBSTRING "${CANN_VERSION}000" 0 6 CANN_VERSION)
add_definitions("-DCANN_VERSION_CODE=${CANN_VERSION}")
if(NOT ASCEND_TOOLKIT_VERSION)
set(ASCEND_TOOLKIT_VERSION "???")
else()
message(
STATUS "Current Ascend Toolkit version is ${ASCEND_TOOLKIT_VERSION}")
endif()
endmacro()

macro(find_ascend_driver_version ascend_driver_version_info)
file(READ ${ascend_driver_version_info} ASCEND_DRIVER_VERSION_CONTENTS)
string(REGEX MATCH "Version=([0-9]+\.[0-9]+\.[0-9]+)" ASCEND_DRIVER_VERSION
"${ASCEND_DRIVER_VERSION_CONTENTS}")
string(REGEX REPLACE "Version=([0-9]+\.[0-9]+\.[0-9]+)" "\\1"
ASCEND_DRIVER_VERSION "${ASCEND_DRIVER_VERSION}")
if(NOT ASCEND_DRIVER_VERSION)
set(ASCEND_DRIVER_VERSION "???")
else()
message(
STATUS "Current Ascend Driver version is ${ASCEND_DRIVER_VERSION}")
endif()
endmacro()

if(WITH_ARM)
set(ASCEND_TOOLKIT_DIR ${ASCEND_DIR}/ascend-toolkit/latest/arm64-linux)
else()
set(ASCEND_TOOLKIT_DIR ${ASCEND_DIR}/ascend-toolkit/latest/x86_64-linux)
endif()

find_ascend_toolkit_version(${ASCEND_TOOLKIT_DIR}/ascend_toolkit_install.info)
find_ascend_driver_version(${ASCEND_DIR}/driver/version.info)
endif()
56 changes: 18 additions & 38 deletions cmake/external/gloo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,44 +61,24 @@ if(CMAKE_COMPILER_IS_GNUCC)
endif()
include_directories(${GLOO_INCLUDE_DIR})

if(WITH_ASCEND OR WITH_ASCEND_CL)
ExternalProject_Add(
${GLOO_PROJECT}
${EXTERNAL_PROJECT_LOG_ARGS} ${SHALLOW_CLONE}
GIT_REPOSITORY ${GLOO_REPOSITORY}
GIT_TAG ${GLOO_TAG}
PREFIX "${GLOO_PREFIX_DIR}"
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND
mkdir -p ${GLOO_SOURCE_DIR}/build && cd ${GLOO_SOURCE_DIR}/build && cmake
.. -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} && ${CMAKE_COMMAND} --build . &&
mkdir -p ${GLOO_LIBRARY_DIR} ${GLOO_INCLUDE_DIR}/gloo
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy
${GLOO_SOURCE_DIR}/build/gloo/libgloo.a ${GLOO_LIBRARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory "${GLOO_SOURCE_DIR}/gloo/"
"${GLOO_INCLUDE_DIR}/gloo"
BUILD_BYPRODUCTS ${GLOO_LIBRARIES})
else()
ExternalProject_Add(
${GLOO_PROJECT}
${EXTERNAL_PROJECT_LOG_ARGS} ${SHALLOW_CLONE}
GIT_REPOSITORY ${GLOO_REPOSITORY}
GIT_TAG ${GLOO_TAG}
PREFIX "${GLOO_PREFIX_DIR}"
UPDATE_COMMAND ""
PATCH_COMMAND ${GLOO_PATCH_COMMAND}
CONFIGURE_COMMAND ""
BUILD_COMMAND
mkdir -p ${GLOO_SOURCE_DIR}/build && cd ${GLOO_SOURCE_DIR}/build && cmake
.. -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} && ${CMAKE_COMMAND} --build . &&
mkdir -p ${GLOO_LIBRARY_DIR} ${GLOO_INCLUDE_DIR}/gloo
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy
${GLOO_SOURCE_DIR}/build/gloo/libgloo.a ${GLOO_LIBRARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory "${GLOO_SOURCE_DIR}/gloo/"
"${GLOO_INCLUDE_DIR}/gloo"
BUILD_BYPRODUCTS ${GLOO_LIBRARIES})
endif()
ExternalProject_Add(
${GLOO_PROJECT}
${EXTERNAL_PROJECT_LOG_ARGS} ${SHALLOW_CLONE}
GIT_REPOSITORY ${GLOO_REPOSITORY}
GIT_TAG ${GLOO_TAG}
PREFIX "${GLOO_PREFIX_DIR}"
UPDATE_COMMAND ""
PATCH_COMMAND ${GLOO_PATCH_COMMAND}
CONFIGURE_COMMAND ""
BUILD_COMMAND
mkdir -p ${GLOO_SOURCE_DIR}/build && cd ${GLOO_SOURCE_DIR}/build && cmake ..
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} && ${CMAKE_COMMAND} --build . && mkdir
-p ${GLOO_LIBRARY_DIR} ${GLOO_INCLUDE_DIR}/glo
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy
${GLOO_SOURCE_DIR}/build/gloo/libgloo.a ${GLOO_LIBRARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory "${GLOO_SOURCE_DIR}/gloo/"
"${GLOO_INCLUDE_DIR}/gloo"
BUILD_BYPRODUCTS ${GLOO_LIBRARIES})

add_library(gloo STATIC IMPORTED GLOBAL)
set_property(TARGET gloo PROPERTY IMPORTED_LOCATION ${GLOO_LIBRARIES})
Expand Down
7 changes: 1 addition & 6 deletions cmake/external/protobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,6 @@ function(build_protobuf TARGET_NAME BUILD_FOR_HOST)
if(WITH_ASCEND AND NOT WITH_ASCEND_CXX11)
set(PROTOBUF_REPOSITORY https://gitee.com/tianjianhe/protobuf.git)
set(PROTOBUF_TAG v21.12)
elseif(WITH_ASCEND_CL AND NOT WITH_ASCEND_CXX11)
set(PROTOBUF_REPOSITORY https://gitee.com/tianjianhe/protobuf.git)
set(PROTOBUF_TAG v21.12)
elseif(WITH_IPU)
set(PROTOBUF_REPOSITORY ${GIT_URL}/protocolbuffers/protobuf.git)
set(PROTOBUF_TAG v21.12)
Expand Down Expand Up @@ -325,9 +322,7 @@ function(build_protobuf TARGET_NAME BUILD_FOR_HOST)
endif()
endfunction()

if(WITH_ASCEND OR WITH_ASCEND_CL)
set(PROTOBUF_VERSION 21.12)
elseif(WITH_IPU)
if(WITH_IPU)
set(PROTOBUF_VERSION 21.12)
elseif(WITH_ARM_BRPC)
set(PROTOBUF_VERSION 21.12-baidu-ee-common)
Expand Down
6 changes: 1 addition & 5 deletions cmake/external/threadpool.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
include(ExternalProject)

set(THREADPOOL_PREFIX_DIR ${THIRD_PARTY_PATH}/threadpool)
if(WITH_ASCEND OR WITH_ASCEND_CL)
set(THREADPOOL_REPOSITORY https://gitee.com/tianjianhe/ThreadPool.git)
else()
set(THREADPOOL_REPOSITORY ${GIT_URL}/progschj/ThreadPool.git)
endif()
set(THREADPOOL_REPOSITORY ${GIT_URL}/progschj/ThreadPool.git)
set(THREADPOOL_TAG 9a42ec1329f259a5f4881a291db1dcb8f2ad9040)

set(THREADPOOL_INCLUDE_DIR ${THIRD_PARTY_PATH}/threadpool/src/extern_threadpool)
Expand Down
Loading

0 comments on commit 0b60f28

Please sign in to comment.