Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
1882f2ce
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
1882f2ce
编写于
1月 15, 2021
作者:
G
gongweibao
提交者:
GitHub
1月 15, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix compilcation on CANN20.1 and older (#30494)
Fix compilcation on CANN20.1 and older
上级
6dd52c5b
变更
18
展开全部
显示空白变更内容
内联
并排
Showing
18 changed file
with
200 addition
and
162 deletion
+200
-162
CMakeLists.txt
CMakeLists.txt
+0
-1
cmake/external/ascend.cmake
cmake/external/ascend.cmake
+31
-43
cmake/external/cryptopp.cmake
cmake/external/cryptopp.cmake
+2
-2
cmake/external/dlpack.cmake
cmake/external/dlpack.cmake
+1
-1
cmake/external/gflags.cmake
cmake/external/gflags.cmake
+3
-3
cmake/external/glog.cmake
cmake/external/glog.cmake
+3
-3
cmake/external/grpc.cmake
cmake/external/grpc.cmake
+1
-1
cmake/external/openblas.cmake
cmake/external/openblas.cmake
+1
-1
cmake/external/protobuf.cmake
cmake/external/protobuf.cmake
+4
-4
cmake/external/pybind11.cmake
cmake/external/pybind11.cmake
+2
-2
cmake/external/warpctc.cmake
cmake/external/warpctc.cmake
+2
-2
cmake/external/xbyak.cmake
cmake/external/xbyak.cmake
+1
-1
cmake/external/xxhash.cmake
cmake/external/xxhash.cmake
+1
-1
cmake/external/zlib.cmake
cmake/external/zlib.cmake
+2
-2
paddle/fluid/framework/fleet/CMakeLists.txt
paddle/fluid/framework/fleet/CMakeLists.txt
+1
-1
paddle/fluid/framework/fleet/ascend_wrapper.h
paddle/fluid/framework/fleet/ascend_wrapper.h
+22
-9
paddle/fluid/pybind/ascend_wrapper_py.cc
paddle/fluid/pybind/ascend_wrapper_py.cc
+110
-85
paddle/fluid/pybind/op_function_generator.cc
paddle/fluid/pybind/op_function_generator.cc
+13
-0
未找到文件。
CMakeLists.txt
浏览文件 @
1882f2ce
...
...
@@ -326,7 +326,6 @@ set(PADDLE_PYTHON_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/python/build")
set
(
CMAKE_CXX_FLAGS_RELWITHDEBINFO
"-O3 -g -DNDEBUG"
)
set
(
CMAKE_C_FLAGS_RELWITHDEBINFO
"-O3 -g -DNDEBUG"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-D_GLIBCXX_USE_CXX11_ABI=0"
)
if
(
ON_INFER
)
# you can trun off the paddle fluid and inference lib by set ON_INFER=OFF
...
...
cmake/external/ascend.cmake
浏览文件 @
1882f2ce
...
...
@@ -12,50 +12,38 @@
# See the License for the specific language governing permissions and
# limitations under the License.
INCLUDE
(
ExternalProject
)
SET
(
ASCEND_PROJECT
"extern_ascend"
)
IF
((
NOT DEFINED ASCEND_VER
)
OR
(
NOT DEFINED ASCEND_URL
))
MESSAGE
(
STATUS
"use pre defined download url"
)
SET
(
ASCEND_VER
"0.1.1"
CACHE STRING
""
FORCE
)
SET
(
ASCEND_NAME
"ascend"
CACHE STRING
""
FORCE
)
SET
(
ASCEND_URL
"http://paddle-ascend.bj.bcebos.com/ascend.tar.gz"
CACHE STRING
""
FORCE
)
ENDIF
()
MESSAGE
(
STATUS
"ASCEND_NAME:
${
ASCEND_NAME
}
, ASCEND_URL:
${
ASCEND_URL
}
"
)
SET
(
ASCEND_SOURCE_DIR
"
${
THIRD_PARTY_PATH
}
/ascend"
)
SET
(
ASCEND_DOWNLOAD_DIR
"
${
ASCEND_SOURCE_DIR
}
/src/
${
ASCEND_PROJECT
}
"
)
SET
(
ASCEND_DST_DIR
"ascend"
)
SET
(
ASCEND_INSTALL_ROOT
"
${
THIRD_PARTY_PATH
}
/install"
)
SET
(
ASCEND_INSTALL_DIR
${
ASCEND_INSTALL_ROOT
}
/
${
ASCEND_DST_DIR
}
)
SET
(
ASCEND_ROOT
${
ASCEND_INSTALL_DIR
}
)
SET
(
ASCEND_INC_DIR
${
ASCEND_ROOT
}
/include
)
SET
(
ASCEND_LIB_DIR
${
ASCEND_ROOT
}
/lib
)
SET
(
ASCEND_LIB
${
ASCEND_LIB_DIR
}
/libge_runner.so
)
SET
(
ASCEND_GRAPH_LIB
${
ASCEND_LIB_DIR
}
/libgraph.so
)
SET
(
CMAKE_INSTALL_RPATH
"
${
CMAKE_INSTALL_RPATH
}
"
"
${
ASCEND_ROOT
}
/lib"
)
#NOTE: Logic is from
# https://github.com/mindspore-ai/graphengine/blob/master/CMakeLists.txt
if
(
DEFINED ENV{ASCEND_CUSTOM_PATH}
)
set
(
ASCEND_DIR $ENV{ASCEND_CUSTOM_PATH}
)
else
()
set
(
ASCEND_DIR /usr/local/Ascend
)
endif
()
INCLUDE_DIRECTORIES
(
${
ASCEND_INC_DIR
}
)
FILE
(
WRITE
${
ASCEND_DOWNLOAD_DIR
}
/CMakeLists.txt
"PROJECT(ASCEND)
\n
"
"cmake_minimum_required(VERSION 3.0)
\n
"
"install(DIRECTORY
${
ASCEND_NAME
}
/include
${
ASCEND_NAME
}
/lib
\n
"
" DESTINATION
${
ASCEND_DST_DIR
}
)
\n
"
)
ExternalProject_Add
(
${
ASCEND_PROJECT
}
${
EXTERNAL_PROJECT_LOG_ARGS
}
PREFIX
${
ASCEND_SOURCE_DIR
}
DOWNLOAD_DIR
${
ASCEND_DOWNLOAD_DIR
}
DOWNLOAD_COMMAND wget --no-check-certificate
${
ASCEND_URL
}
-c -q -O
${
ASCEND_NAME
}
.tar.gz
&& tar zxvf
${
ASCEND_NAME
}
.tar.gz
DOWNLOAD_NO_PROGRESS 1
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=
${
ASCEND_INSTALL_ROOT
}
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
${
ASCEND_INSTALL_ROOT
}
)
ADD_LIBRARY
(
ascend SHARED IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET ascend PROPERTY IMPORTED_LOCATION
${
ASCEND_LIB
}
)
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
}
)
ADD_LIBRARY
(
ascend_graph SHARED IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET ascend_graph PROPERTY IMPORTED_LOCATION
${
ASCEND_GRAPH_LIB
}
)
ADD_DEPENDENCIES
(
ascend ascend_graph
${
ASCEND_PROJECT
}
)
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
${
ATLAS_RUNTIME_DIR
}
/libgraph.so
)
set
(
atlas_ge_runner
${
ATLAS_RUNTIME_DIR
}
/libge_runner.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
}
)
ADD_LIBRARY
(
ascend_graph SHARED IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET ascend_graph PROPERTY IMPORTED_LOCATION
${
atlas_graph
}
)
add_custom_target
(
extern_ascend DEPENDS ascend_ge ascend_graph
)
cmake/external/cryptopp.cmake
浏览文件 @
1882f2ce
...
...
@@ -17,7 +17,7 @@ INCLUDE(ExternalProject)
SET
(
CRYPTOPP_PREFIX_DIR
${
THIRD_PARTY_PATH
}
/cryptopp
)
SET
(
CRYPTOPP_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/cryptopp
)
SET
(
CRYPTOPP_INCLUDE_DIR
"
${
CRYPTOPP_INSTALL_DIR
}
/include"
CACHE PATH
"cryptopp include directory."
FORCE
)
SET
(
CRYPTOPP_REPOSITORY
https://gitee.com/tianjianhe
/cryptopp.git
)
SET
(
CRYPTOPP_REPOSITORY
${
GIT_URL
}
/weidai11
/cryptopp.git
)
SET
(
CRYPTOPP_TAG CRYPTOPP_8_2_0
)
IF
(
WIN32
)
...
...
@@ -33,7 +33,7 @@ set(CRYPTOPP_CMAKE_ARGS ${COMMON_CMAKE_ARGS}
-DCMAKE_INSTALL_LIBDIR=
${
CRYPTOPP_INSTALL_DIR
}
/lib
-DCMAKE_INSTALL_PREFIX=
${
CRYPTOPP_INSTALL_DIR
}
-DCMAKE_BUILD_TYPE=
${
THIRD_PARTY_BUILD_TYPE
}
"-DCMAKE_CXX_FLAGS=
${
CMAKE_CXX_FLAGS
}
-D_GLIBCXX_USE_CXX11_ABI=0"
-DCMAKE_CXX_FLAGS=
${
CMAKE_CXX_FLAGS
}
-DCMAKE_CXX_FLAGS_RELEASE=
${
CMAKE_CXX_FLAGS_RELEASE
}
-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
-DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
...
...
cmake/external/dlpack.cmake
浏览文件 @
1882f2ce
...
...
@@ -17,7 +17,7 @@ include(ExternalProject)
set
(
DLPACK_PREFIX_DIR
${
THIRD_PARTY_PATH
}
/dlpack
)
set
(
DLPACK_SOURCE_DIR
${
THIRD_PARTY_PATH
}
/dlpack/src/extern_dlpack
)
set
(
DLPACK_REPOSITORY
https://gitee.com/tianjianhe
/dlpack.git
)
set
(
DLPACK_REPOSITORY
${
GIT_URL
}
/dmlc
/dlpack.git
)
set
(
DLPACK_TAG v0.2
)
cache_third_party
(
extern_dlpack
...
...
cmake/external/gflags.cmake
浏览文件 @
1882f2ce
...
...
@@ -18,8 +18,8 @@ SET(GFLAGS_PREFIX_DIR ${THIRD_PARTY_PATH}/gflags)
SET
(
GFLAGS_SOURCE_DIR
${
THIRD_PARTY_PATH
}
/gflags/src/extern_gflags
)
SET
(
GFLAGS_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/gflags
)
SET
(
GFLAGS_INCLUDE_DIR
"
${
GFLAGS_INSTALL_DIR
}
/include"
CACHE PATH
"gflags include directory."
FORCE
)
set
(
GFLAGS_REPOSITORY
https://gitee.com/tianjianhe
/gflags.git
)
set
(
GFLAGS_TAG
77592648e3f3be87d6c7123eb81cbad75f9aef5a
)
set
(
GFLAGS_REPOSITORY
${
GIT_URL
}
/gflags
/gflags.git
)
set
(
GFLAGS_TAG
"v2.2.2"
)
IF
(
WIN32
)
set
(
GFLAGS_LIBRARIES
"
${
GFLAGS_INSTALL_DIR
}
/lib/gflags_static.lib"
CACHE FILEPATH
"GFLAGS_LIBRARIES"
FORCE
)
ELSE
(
WIN32
)
...
...
@@ -48,7 +48,7 @@ ExternalProject_Add(
INSTALL_COMMAND
${
INSTALL_COMMAND
}
CMAKE_ARGS -DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
"-DCMAKE_CXX_FLAGS=
${
CMAKE_CXX_FLAGS
}
-D_GLIBCXX_USE_CXX11_ABI=0"
-DCMAKE_CXX_FLAGS=
${
CMAKE_CXX_FLAGS
}
-DCMAKE_CXX_FLAGS_RELEASE=
${
CMAKE_CXX_FLAGS_RELEASE
}
-DCMAKE_CXX_FLAGS_DEBUG=
${
CMAKE_CXX_FLAGS_DEBUG
}
-DCMAKE_C_FLAGS=
${
CMAKE_C_FLAGS
}
...
...
cmake/external/glog.cmake
浏览文件 @
1882f2ce
...
...
@@ -18,8 +18,8 @@ SET(GLOG_PREFIX_DIR ${THIRD_PARTY_PATH}/glog)
SET
(
GLOG_SOURCE_DIR
${
THIRD_PARTY_PATH
}
/glog/src/extern_glog
)
SET
(
GLOG_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/glog
)
SET
(
GLOG_INCLUDE_DIR
"
${
GLOG_INSTALL_DIR
}
/include"
CACHE PATH
"glog include directory."
FORCE
)
SET
(
GLOG_REPOSITORY
https://gitee.com/tianjianh
e/glog.git
)
SET
(
GLOG_TAG v0.
3.5
)
SET
(
GLOG_REPOSITORY
${
GIT_URL
}
/googl
e/glog.git
)
SET
(
GLOG_TAG v0.
4.0
)
IF
(
WIN32
)
SET
(
GLOG_LIBRARIES
"
${
GLOG_INSTALL_DIR
}
/lib/glog.lib"
CACHE FILEPATH
"glog library."
FORCE
)
...
...
@@ -47,7 +47,7 @@ ExternalProject_Add(
SOURCE_DIR
${
GLOG_SOURCE_DIR
}
CMAKE_ARGS -DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
"-DCMAKE_CXX_FLAGS=
${
GLOG_CMAKE_CXX_FLAGS
}
-D_GLIBCXX_USE_CXX11_ABI=0"
-DCMAKE_CXX_FLAGS=
${
GLOG_CMAKE_CXX_FLAGS
}
-DCMAKE_CXX_FLAGS_RELEASE=
${
CMAKE_CXX_FLAGS_RELEASE
}
-DCMAKE_CXX_FLAGS_DEBUG=
${
CMAKE_CXX_FLAGS_DEBUG
}
-DCMAKE_C_FLAGS=
${
CMAKE_C_FLAGS
}
...
...
cmake/external/grpc.cmake
浏览文件 @
1882f2ce
...
...
@@ -28,7 +28,7 @@ IF(APPLE)
SET
(
GRPC_INSTALL_CMD make prefix=
${
GRPC_INSTALL_DIR
}
install
)
ELSE
()
SET
(
GRPC_CFLAGS
"-Wno-error -std=c11
${
CLFAGS
}
"
)
SET
(
GRPC_CXXFLAGS
"-Wno-error -std=c++11
${
CXXFLAGS
}
-D_GLIBCXX_USE_CXX11_ABI=0
"
)
SET
(
GRPC_CXXFLAGS
"-Wno-error -std=c++11
${
CXXFLAGS
}
"
)
SET
(
BUILD_CMD make CFLAGS=
${
GRPC_CFLAGS
}
CXXFLAGS=
${
GRPC_CXXFLAGS
}
HAS_SYSTEM_PROTOBUF=false -s -j
${
NUM_OF_PROCESSOR
}
static grpc_cpp_plugin
)
SET
(
GRPC_INSTALL_CMD make prefix=
${
GRPC_INSTALL_DIR
}
install CFLAGS=
${
GRPC_CFLAGS
}
CXXFLAGS=
${
GRPC_CXXFLAGS
}
)
ENDIF
()
...
...
cmake/external/openblas.cmake
浏览文件 @
1882f2ce
...
...
@@ -17,7 +17,7 @@ INCLUDE(ExternalProject)
SET
(
CBLAS_PREFIX_DIR
${
THIRD_PARTY_PATH
}
/openblas
)
SET
(
CBLAS_SOURCE_DIR
${
THIRD_PARTY_PATH
}
/openblas/src/extern_openblas
)
SET
(
CBLAS_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/openblas
)
SET
(
CBLAS_REPOSITORY
https://gitee.com/tianjianhe
/OpenBLAS.git
)
SET
(
CBLAS_REPOSITORY
${
GIT_URL
}
/xianyi
/OpenBLAS.git
)
SET
(
CBLAS_TAG v0.3.7
)
if
(
WITH_MIPS
)
SET
(
CBLAS_TAG v0.3.13
)
...
...
cmake/external/protobuf.cmake
浏览文件 @
1882f2ce
...
...
@@ -183,7 +183,7 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST)
"-DCMAKE_C_FLAGS=
${
CMAKE_C_FLAGS
}
"
"-DCMAKE_C_FLAGS_DEBUG=
${
CMAKE_C_FLAGS_DEBUG
}
"
"-DCMAKE_C_FLAGS_RELEASE=
${
CMAKE_C_FLAGS_RELEASE
}
"
"-DCMAKE_CXX_FLAGS=
${
CMAKE_CXX_FLAGS
}
-D_GLIBCXX_USE_CXX11_ABI=0
"
"-DCMAKE_CXX_FLAGS=
${
CMAKE_CXX_FLAGS
}
"
"-DCMAKE_CXX_FLAGS_RELEASE=
${
CMAKE_CXX_FLAGS_RELEASE
}
"
"-DCMAKE_CXX_FLAGS_DEBUG=
${
CMAKE_CXX_FLAGS_DEBUG
}
"
"-Dprotobuf_WITH_ZLIB=ON"
...
...
@@ -198,8 +198,8 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST)
"-Dprotobuf_MSVC_STATIC_RUNTIME=
${
MSVC_STATIC_CRT
}
"
)
ENDIF
()
SET
(
PROTOBUF_REPOSITORY
https://gitee.com/tianjianhe
/protobuf.git
)
SET
(
PROTOBUF_TAG
v3.8.0
)
SET
(
PROTOBUF_REPOSITORY
${
GIT_URL
}
/protocolbuffers
/protobuf.git
)
SET
(
PROTOBUF_TAG
9f75c5aa851cd877fb0d93ccc31b8567a6706546
)
cache_third_party
(
${
TARGET_NAME
}
REPOSITORY
${
PROTOBUF_REPOSITORY
}
...
...
@@ -234,7 +234,7 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST)
)
ENDFUNCTION
()
#
SET(PROTOBUF_VERSION 3.1.0)
SET
(
PROTOBUF_VERSION 3.1.0
)
IF
(
NOT PROTOBUF_FOUND
)
build_protobuf
(
extern_protobuf FALSE
)
...
...
cmake/external/pybind11.cmake
浏览文件 @
1882f2ce
...
...
@@ -16,8 +16,8 @@ include(ExternalProject)
set
(
PYBIND_PREFIX_DIR
${
THIRD_PARTY_PATH
}
/pybind
)
set
(
PYBIND_SOURCE_DIR
${
THIRD_PARTY_PATH
}
/pybind/src/extern_pybind
)
SET
(
PYBIND_REPOSITORY
https://gitee.com/tianjianhe
/pybind11.git
)
SET
(
PYBIND_TAG v2.
6.0
)
SET
(
PYBIND_REPOSITORY
${
GIT_URL
}
/pybind
/pybind11.git
)
SET
(
PYBIND_TAG v2.
4.3
)
cache_third_party
(
extern_pybind
REPOSITORY
${
PYBIND_REPOSITORY
}
...
...
cmake/external/warpctc.cmake
浏览文件 @
1882f2ce
...
...
@@ -19,7 +19,7 @@ SET(WARPCTC_SOURCE_DIR ${THIRD_PARTY_PATH}/warpctc/src/extern_warpctc)
SET
(
WARPCTC_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/warpctc
)
set
(
WARPCTC_REPOSITORY https://gitee.com/tianjianhe/warp-ctc.git
)
set
(
WARPCTC_TAG 95a461eddeabd51099ef059dcfada1117eb1bfb8
)
# set(WARPCTC_TAG bc29dcfff07ced1c7a19a4ecee48e5ad583cef8e
)
set
(
WARPCTC_REPOSITORY
${
GIT_URL
}
/baidu-research/warp-ctc.git
)
SET
(
WARPCTC_INCLUDE_DIR
"
${
WARPCTC_INSTALL_DIR
}
/include"
CACHE PATH
"Warp-ctc Directory"
FORCE
)
...
...
@@ -53,7 +53,7 @@ ExternalProject_Add(
-DCMAKE_C_FLAGS=
${
CMAKE_C_FLAGS
}
-DCMAKE_C_FLAGS_DEBUG=
${
CMAKE_C_FLAGS_DEBUG
}
-DCMAKE_C_FLAGS_RELEASE=
${
CMAKE_C_FLAGS_RELEASE
}
"-DCMAKE_CXX_FLAGS=
${
CMAKE_CXX_FLAGS
}
-D_GLIBCXX_USE_CXX11_ABI=0
"
"-DCMAKE_CXX_FLAGS=
${
CMAKE_CXX_FLAGS
}
"
-DCMAKE_CXX_FLAGS_RELEASE=
${
CMAKE_CXX_FLAGS_RELEASE
}
-DCMAKE_CXX_FLAGS_DEBUG=
${
CMAKE_CXX_FLAGS_DEBUG
}
-DCMAKE_INSTALL_PREFIX=
${
WARPCTC_INSTALL_DIR
}
...
...
cmake/external/xbyak.cmake
浏览文件 @
1882f2ce
...
...
@@ -19,7 +19,7 @@ set(XBYAK_PREFIX_DIR ${THIRD_PARTY_PATH}/xbyak)
SET
(
XBYAK_SOURCE_DIR
${
THIRD_PARTY_PATH
}
/xbyak/src/extern_xbyak
)
set
(
XBYAK_INSTALL_ROOT
${
THIRD_PARTY_PATH
}
/install/xbyak
)
set
(
XBYAK_INC_DIR
${
XBYAK_INSTALL_ROOT
}
/include
)
set
(
XBYAK_REPOSITORY
https://gitee.com/tianjianhe
/xbyak.git
)
set
(
XBYAK_REPOSITORY
${
GIT_URL
}
/herumi
/xbyak.git
)
set
(
XBYAK_TAG v5.661
)
# Jul 26th
include_directories
(
${
XBYAK_INC_DIR
}
)
...
...
cmake/external/xxhash.cmake
浏览文件 @
1882f2ce
...
...
@@ -18,7 +18,7 @@ set(XXHASH_PREFIX_DIR ${THIRD_PARTY_PATH}/xxhash)
set
(
XXHASH_SOURCE_DIR
${
THIRD_PARTY_PATH
}
/xxhash/src/extern_xxhash
)
set
(
XXHASH_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/xxhash
)
set
(
XXHASH_INCLUDE_DIR
"
${
XXHASH_INSTALL_DIR
}
/include"
)
set
(
XXHASH_REPOSITORY
https://gitee.com/tianjianhe
/xxHash.git
)
set
(
XXHASH_REPOSITORY
${
GIT_URL
}
/Cyan4973
/xxHash.git
)
set
(
XXHASH_TAG v0.6.5
)
cache_third_party
(
extern_xxhash
...
...
cmake/external/zlib.cmake
浏览文件 @
1882f2ce
...
...
@@ -19,7 +19,7 @@ SET(ZLIB_SOURCE_DIR ${THIRD_PARTY_PATH}/zlib/src/extern_zlib)
SET
(
ZLIB_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/zlib
)
SET
(
ZLIB_ROOT
${
ZLIB_INSTALL_DIR
}
CACHE FILEPATH
"zlib root directory."
FORCE
)
SET
(
ZLIB_INCLUDE_DIR
"
${
ZLIB_INSTALL_DIR
}
/include"
CACHE PATH
"zlib include directory."
FORCE
)
set
(
ZLIB_REPOSITORY
https://gitee.com/tianjianhe
/zlib.git
)
set
(
ZLIB_REPOSITORY
${
GIT_URL
}
/madler
/zlib.git
)
set
(
ZLIB_TAG v1.2.8
)
INCLUDE_DIRECTORIES
(
${
ZLIB_INCLUDE_DIR
}
)
# For zlib code to include its own headers.
...
...
@@ -41,7 +41,7 @@ ExternalProject_Add(
CMAKE_ARGS -DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
-DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
-DCMAKE_C_FLAGS=
${
CMAKE_C_FLAGS
}
"-DCMAKE_CXX_FLAGS=
${
CMAKE_CXX_FLAGS
}
-D_GLIBCXX_USE_CXX11_ABI=0"
-DCMAKE_CXX_FLAGS=
${
CMAKE_CXX_FLAGS
}
-DCMAKE_INSTALL_PREFIX=
${
ZLIB_INSTALL_DIR
}
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
...
...
paddle/fluid/framework/fleet/CMakeLists.txt
浏览文件 @
1882f2ce
...
...
@@ -33,5 +33,5 @@ cc_library(heter_wrapper SRCS heter_wrapper.cc DEPS framework_proto device_conte
cc_test
(
test_fleet_cc SRCS test_fleet.cc DEPS fleet_wrapper gloo_wrapper fs shell
)
if
(
WITH_ASCEND
)
cc_library
(
ascend_wrapper SRCS ascend_wrapper.cc DEPS framework_proto lod_tensor ascend ascend_graph
)
cc_library
(
ascend_wrapper SRCS ascend_wrapper.cc DEPS framework_proto lod_tensor ascend
_ge
ascend_graph
)
endif
(
WITH_ASCEND
)
paddle/fluid/framework/fleet/ascend_wrapper.h
浏览文件 @
1882f2ce
...
...
@@ -37,7 +37,6 @@ limitations under the License. */
namespace
paddle
{
namespace
framework
{
// typedef std::vector<std::string> AscendGraphDesc;
typedef
ge
::
Graph
AscendGraphDesc
;
class
AscendInstance
{
...
...
@@ -45,17 +44,31 @@ class AscendInstance {
virtual
~
AscendInstance
()
{}
AscendInstance
()
{}
std
::
map
<
std
::
string
,
std
::
string
>
GetDefaultInitSessionOptions
()
{
std
::
map
<
std
::
string
,
std
::
string
>
init_options
;
std
::
map
<
ge
::
AscendString
,
ge
::
AscendString
>
GetDefaultInitOptions
()
{
std
::
map
<
ge
::
AscendString
,
ge
::
AscendString
>
init_options
;
init_options
[
"ge.exec.deviceId"
]
=
"0"
;
init_options
[
"ge.graphRunMode"
]
=
"1"
;
return
init_options
;
}
std
::
map
<
ge
::
AscendString
,
ge
::
AscendString
>
GetDefaultInitSessionOptions
()
{
std
::
map
<
ge
::
AscendString
,
ge
::
AscendString
>
init_options
;
init_options
[
"a"
]
=
"b"
;
init_options
[
"ge.trainFlag"
]
=
"1"
;
return
init_options
;
}
// add other parameters here to init
ge
::
Status
InitGEForUT
(){
return
ge
::
GEInitialize
(
GetDefaultInitOptions
());
}
void
InitGlobalResouces
()
{
LOG
(
INFO
)
<<
"Begin InitGlobalResouces"
;
session_
.
reset
(
new
ge
::
Session
(
GetDefaultInitSessionOptions
()));
VLOG
(
1
)
<<
"InitGlobalResouces Done"
;
if
(
session_
==
nullptr
){
LOG
(
FATAL
)
<<
"new session error:"
<<
session_
;
}
LOG
(
INFO
)
<<
"End InitGlobalResouces"
;
}
static
std
::
shared_ptr
<
AscendInstance
>
GetInstance
()
{
...
...
paddle/fluid/pybind/ascend_wrapper_py.cc
浏览文件 @
1882f2ce
此差异已折叠。
点击以展开。
paddle/fluid/pybind/op_function_generator.cc
浏览文件 @
1882f2ce
...
...
@@ -16,6 +16,7 @@
#include <fstream>
#include <iostream>
#include <string>
#include <unistd.h>
#include "paddle/fluid/framework/op_info.h"
#include "paddle/fluid/framework/op_registry.h"
...
...
@@ -23,6 +24,9 @@
#include "paddle/fluid/framework/variable.h"
#include "paddle/fluid/pybind/pybind.h"
#include "paddle/fluid/string/string_helper.h"
#ifdef PADDLE_WITH_ASCEND
#include "paddle/fluid/framework/fleet/ascend_wrapper.h"
#endif
// NOTE(zhiqiu): Commonly, the inputs in auto-generated OP function are
// determined by the OP`s proto automatically, i.e., all the inputs registered
...
...
@@ -444,6 +448,11 @@ int main(int argc, char* argv[]) {
return
-
1
;
}
#ifdef PADDLE_WITH_ASCEND
auto
ascend_ptr
=
paddle
::
framework
::
AscendInstance
::
GetInstance
();
ascend_ptr
->
InitGEForUT
();
#endif
std
::
vector
<
std
::
string
>
headers
{
"
\"
paddle/fluid/imperative/tracer.h
\"
"
};
std
::
ofstream
out
(
argv
[
1
],
std
::
ios
::
out
);
...
...
@@ -473,5 +482,9 @@ int main(int argc, char* argv[]) {
<<
"} // namespace paddle
\n
"
;
out
.
close
();
#ifdef PADDLE_WITH_ASCEND
ge
::
GEFinalize
();
#endif
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录