Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
6da3f883
S
Serving
项目概览
PaddlePaddle
/
Serving
大约 1 年 前同步成功
通知
186
Star
833
Fork
253
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
105
列表
看板
标记
里程碑
合并请求
10
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Serving
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
105
Issue
105
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6da3f883
编写于
11月 10, 2021
作者:
S
ShiningZhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support dcu
上级
84b9a36f
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
105 addition
and
0 deletion
+105
-0
CMakeLists.txt
CMakeLists.txt
+4
-0
cmake/hip.cmake
cmake/hip.cmake
+89
-0
cmake/paddlepaddle.cmake
cmake/paddlepaddle.cmake
+2
-0
core/general-server/CMakeLists.txt
core/general-server/CMakeLists.txt
+4
-0
python/CMakeLists.txt
python/CMakeLists.txt
+2
-0
python/gen_version.py
python/gen_version.py
+2
-0
python/paddle_serving_server/server.py
python/paddle_serving_server/server.py
+2
-0
未找到文件。
CMakeLists.txt
浏览文件 @
6da3f883
...
...
@@ -59,6 +59,7 @@ option(PACK "Compile for whl"
option
(
WITH_TRT
"Compile Paddle Serving with TRT"
OFF
)
option
(
PADDLE_ON_INFERENCE
"Compile for encryption"
ON
)
option
(
WITH_OPENCV
"Compile Paddle Serving with OPENCV"
OFF
)
option
(
WITH_ROCM
"Compile Paddle Serving with ROCM"
OFF
)
if
(
NOT DEFINED VERSION_TAG
)
set
(
VERSION_TAG
"0.0.0"
)
...
...
@@ -163,6 +164,9 @@ if(SERVER)
endif
()
list
(
APPEND EXTERNAL_LIBS paddlepaddle
)
if
(
WITH_ROCM
)
include
(
hip
)
endif
()
endif
()
...
...
cmake/hip.cmake
0 → 100644
浏览文件 @
6da3f883
if
(
NOT WITH_ROCM
)
return
()
endif
()
if
(
NOT DEFINED ENV{ROCM_PATH}
)
set
(
ROCM_PATH
"/opt/rocm"
CACHE PATH
"Path to which ROCm has been installed"
)
set
(
HIP_PATH
${
ROCM_PATH
}
/hip CACHE PATH
"Path to which HIP has been installed"
)
set
(
HIP_CLANG_PATH
${
ROCM_PATH
}
/llvm/bin CACHE PATH
"Path to which clang has been installed"
)
else
()
set
(
ROCM_PATH $ENV{ROCM_PATH} CACHE PATH
"Path to which ROCm has been installed"
)
set
(
HIP_PATH
${
ROCM_PATH
}
/hip CACHE PATH
"Path to which HIP has been installed"
)
set
(
HIP_CLANG_PATH
${
ROCM_PATH
}
/llvm/bin CACHE PATH
"Path to which clang has been installed"
)
endif
()
set
(
CMAKE_MODULE_PATH
"
${
HIP_PATH
}
/cmake"
${
CMAKE_MODULE_PATH
}
)
find_package
(
HIP REQUIRED
)
include_directories
(
${
ROCM_PATH
}
/include
)
message
(
STATUS
"HIP version:
${
HIP_VERSION
}
"
)
message
(
STATUS
"HIP_CLANG_PATH:
${
HIP_CLANG_PATH
}
"
)
macro
(
find_package_and_include PACKAGE_NAME
)
find_package
(
"
${
PACKAGE_NAME
}
"
REQUIRED
)
include_directories
(
"
${
ROCM_PATH
}
/
${
PACKAGE_NAME
}
/include"
)
message
(
STATUS
"
${
PACKAGE_NAME
}
version:
${${
PACKAGE_NAME
}
_VERSION
}
"
)
endmacro
()
find_package_and_include
(
miopen
)
find_package_and_include
(
rocblas
)
find_package_and_include
(
hiprand
)
find_package_and_include
(
rocrand
)
find_package_and_include
(
rccl
)
find_package_and_include
(
rocthrust
)
find_package_and_include
(
hipcub
)
find_package_and_include
(
rocprim
)
find_package_and_include
(
hipsparse
)
find_package_and_include
(
rocsparse
)
find_package_and_include
(
rocfft
)
# set CXX flags for HIP
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-D__HIP_PLATFORM_HCC__"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-D__HIP_PLATFORM_HCC__"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_HIP"
)
set
(
THRUST_DEVICE_SYSTEM THRUST_DEVICE_SYSTEM_HIP
)
# define HIP_CXX_FLAGS
list
(
APPEND HIP_CXX_FLAGS -fPIC
)
list
(
APPEND HIP_CXX_FLAGS -D__HIP_PLATFORM_HCC__=1
)
# Note(qili93): HIP has compile conflicts of float16.h as platform::float16 overload std::is_floating_point and std::is_integer
list
(
APPEND HIP_CXX_FLAGS -D__HIP_NO_HALF_CONVERSIONS__=1
)
list
(
APPEND HIP_CXX_FLAGS -Wno-macro-redefined
)
list
(
APPEND HIP_CXX_FLAGS -Wno-inconsistent-missing-override
)
list
(
APPEND HIP_CXX_FLAGS -Wno-exceptions
)
list
(
APPEND HIP_CXX_FLAGS -Wno-shift-count-negative
)
list
(
APPEND HIP_CXX_FLAGS -Wno-shift-count-overflow
)
list
(
APPEND HIP_CXX_FLAGS -Wno-unused-command-line-argument
)
list
(
APPEND HIP_CXX_FLAGS -Wno-duplicate-decl-specifier
)
list
(
APPEND HIP_CXX_FLAGS -Wno-implicit-int-float-conversion
)
list
(
APPEND HIP_CXX_FLAGS -Wno-pass-failed
)
list
(
APPEND HIP_CXX_FLAGS -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_HIP
)
list
(
APPEND HIP_CXX_FLAGS -std=c++14
)
if
(
CMAKE_BUILD_TYPE MATCHES Debug
)
list
(
APPEND HIP_CXX_FLAGS -g2
)
list
(
APPEND HIP_CXX_FLAGS -O0
)
list
(
APPEND HIP_HIPCC_FLAGS -fdebug-info-for-profiling
)
endif
(
CMAKE_BUILD_TYPE MATCHES Debug
)
set
(
HIP_HCC_FLAGS
${
HIP_CXX_FLAGS
}
)
set
(
HIP_CLANG_FLAGS
${
HIP_CXX_FLAGS
}
)
# Ask hcc to generate device code during compilation so we can use
# host linker to link.
list
(
APPEND HIP_HCC_FLAGS -fno-gpu-rdc
)
list
(
APPEND HIP_HCC_FLAGS --amdgpu-target=gfx906
)
list
(
APPEND HIP_CLANG_FLAGS -fno-gpu-rdc
)
list
(
APPEND HIP_CLANG_FLAGS --amdgpu-target=gfx906
)
if
(
HIP_COMPILER STREQUAL clang
)
set
(
hip_library_name amdhip64
)
else
()
set
(
hip_library_name hip_hcc
)
endif
()
message
(
STATUS
"HIP library name:
${
hip_library_name
}
"
)
# set HIP link libs
find_library
(
ROCM_HIPRTC_LIB
${
hip_library_name
}
HINTS
${
HIP_PATH
}
/lib
)
message
(
STATUS
"ROCM_HIPRTC_LIB:
${
ROCM_HIPRTC_LIB
}
"
)
#include(thrust)
cmake/paddlepaddle.cmake
浏览文件 @
6da3f883
...
...
@@ -66,6 +66,8 @@ elseif (WITH_LITE)
MESSAGE
(
"paddle lite lib is unknown."
)
SET
(
PADDLE_LIB_VERSION
"paddle-lite-unknown"
)
endif
()
elseif
(
WITH_ROCM
)
SET
(
PADDLE_LIB_VERSION
"
${
PADDLE_VERSION
}
/rocm"
)
else
()
if
(
WITH_AVX
)
if
(
WITH_MKLML
)
...
...
core/general-server/CMakeLists.txt
浏览文件 @
6da3f883
...
...
@@ -63,3 +63,7 @@ install(FILES
DESTINATION
${
PADDLE_SERVING_INSTALL_DIR
}
/demo/serving/bin
)
endif
()
if
(
WITH_ROCM
)
target_link_libraries
(
serving
${
ROCM_HIPRTC_LIB
}
)
endif
()
python/CMakeLists.txt
浏览文件 @
6da3f883
...
...
@@ -12,6 +12,8 @@ if (SERVER)
set
(
SERVER_PACKAGE_NAME
"paddle-serving-server-gpu"
)
elseif
(
WITH_XPU
)
set
(
SERVER_PACKAGE_NAME
"paddle-serving-server-xpu"
)
elseif
(
WITH_ROCM
)
set
(
SERVER_PACKAGE_NAME
"paddle-serving-server-rocm"
)
endif
()
file
(
INSTALL pipeline DESTINATION paddle_serving_server
)
file
(
GLOB_RECURSE SERVING_SERVER_PY_FILES paddle_serving_server/*.py
)
...
...
python/gen_version.py
浏览文件 @
6da3f883
...
...
@@ -43,6 +43,8 @@ if package_name.endswith('gpu'):
update_info
(
"paddle_serving_server/version.py"
,
"device_type"
,
"1"
)
elif
package_name
.
endswith
(
'xpu'
):
update_info
(
"paddle_serving_server/version.py"
,
"device_type"
,
"2"
)
elif
package_name
.
endswith
(
'rocm'
):
update_info
(
"paddle_serving_server/version.py"
,
"device_type"
,
"3"
)
path
=
"paddle_serving_"
+
sys
.
argv
[
1
]
commit_id
=
subprocess
.
check_output
([
'git'
,
'rev-parse'
,
'HEAD'
])
...
...
python/paddle_serving_server/server.py
浏览文件 @
6da3f883
...
...
@@ -435,6 +435,8 @@ class Server(object):
device_version
=
"gpu-cuda"
+
version_suffix
elif
device_type
==
"2"
:
device_version
=
"xpu-"
+
platform
.
machine
()
elif
device_type
==
"3"
:
device_version
=
"rocm-"
+
platform
.
machine
()
return
device_version
def
download_bin
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录