Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
b032b579
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b032b579
编写于
6月 03, 2021
作者:
Q
Qi Li
提交者:
GitHub
6月 03, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[ROCM] update paddle inference cmake, test=develop (#33260) (#33290)
上级
ef6120f3
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
110 addition
and
27 deletion
+110
-27
CMakeLists.txt
CMakeLists.txt
+21
-20
cmake/configure.cmake
cmake/configure.cmake
+8
-0
cmake/inference_lib.cmake
cmake/inference_lib.cmake
+7
-1
cmake/miopen.cmake
cmake/miopen.cmake
+67
-0
paddle/fluid/platform/device_context.h
paddle/fluid/platform/device_context.h
+5
-4
paddle/fluid/platform/dynload/miopen.h
paddle/fluid/platform/dynload/miopen.h
+2
-2
未找到文件。
CMakeLists.txt
浏览文件 @
b032b579
...
...
@@ -283,6 +283,27 @@ if(WITH_GPU)
endif
()
endif
()
if
(
WITH_ROCM
)
include
(
hip
)
include
(
miopen
)
# set miopen libraries, must before configure
endif
(
WITH_ROCM
)
if
(
NOT WITH_ROCM AND WITH_RCCL
)
MESSAGE
(
WARNING
"Disable RCCL when compiling without ROCM. Force WITH_RCCL=OFF."
)
set
(
WITH_RCCL OFF CACHE STRING
"Disable RCCL when compiling without ROCM"
FORCE
)
endif
()
if
(
WITH_RCCL
)
add_definitions
(
"-DPADDLE_WITH_RCCL"
)
include
(
rccl
)
else
()
if
(
WITH_ROCM
)
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."
)
endif
()
endif
()
include
(
third_party
)
# download, build, install third_party, Contains about 20+ dependencies
include
(
flags
)
# set paddle compile flags
...
...
@@ -307,26 +328,6 @@ include(configure) # add paddle env configuration
include_directories
(
"
${
PADDLE_SOURCE_DIR
}
"
)
if
(
WITH_ROCM
)
include
(
hip
)
endif
(
WITH_ROCM
)
if
(
NOT WITH_ROCM AND WITH_RCCL
)
MESSAGE
(
WARNING
"Disable RCCL when compiling without ROCM. Force WITH_RCCL=OFF."
)
set
(
WITH_RCCL OFF CACHE STRING
"Disable RCCL when compiling without ROCM"
FORCE
)
endif
()
if
(
WITH_RCCL
)
add_definitions
(
"-DPADDLE_WITH_RCCL"
)
include
(
rccl
)
else
()
if
(
WITH_ROCM
)
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."
)
endif
()
endif
()
if
(
WITH_NV_JETSON
)
set
(
WITH_ARM ON CACHE STRING
"Set WITH_ARM=ON when compiling WITH_NV_JETSON=ON."
FORCE
)
endif
()
...
...
cmake/configure.cmake
浏览文件 @
b032b579
...
...
@@ -143,6 +143,14 @@ elseif(WITH_ROCM)
add_definitions
(
-DPADDLE_WITH_HIP
)
add_definitions
(
-DEIGEN_USE_GPU
)
add_definitions
(
-DEIGEN_USE_HIP
)
if
(
NOT MIOPEN_FOUND
)
message
(
FATAL_ERROR
"Paddle needs MIOpen to compile"
)
endif
()
if
(
${
MIOPEN_VERSION
}
VERSION_LESS 2090
)
message
(
FATAL_ERROR
"Paddle needs MIOPEN >= 2.9 to compile"
)
endif
()
else
()
add_definitions
(
-DHPPL_STUB_FUNC
)
list
(
APPEND CMAKE_CXX_SOURCE_FILE_EXTENSIONS cu
)
...
...
cmake/inference_lib.cmake
浏览文件 @
b032b579
...
...
@@ -323,12 +323,18 @@ function(version version_file)
"GIT COMMIT ID:
${
PADDLE_GIT_COMMIT
}
\n
"
"WITH_MKL:
${
WITH_MKL
}
\n
"
"WITH_MKLDNN:
${
WITH_MKLDNN
}
\n
"
"WITH_GPU:
${
WITH_GPU
}
\n
"
)
"WITH_GPU:
${
WITH_GPU
}
\n
"
"WITH_ROCM:
${
WITH_ROCM
}
\n
"
)
if
(
WITH_GPU
)
file
(
APPEND
${
version_file
}
"CUDA version:
${
CUDA_VERSION
}
\n
"
"CUDNN version: v
${
CUDNN_MAJOR_VERSION
}
.
${
CUDNN_MINOR_VERSION
}
\n
"
)
endif
()
if
(
WITH_ROCM
)
file
(
APPEND
${
version_file
}
"HIP version:
${
HIP_VERSION
}
\n
"
"MIOpen version: v
${
MIOPEN_MAJOR_VERSION
}
.
${
MIOPEN_MINOR_VERSION
}
\n
"
)
endif
()
file
(
APPEND
${
version_file
}
"CXX compiler version:
${
CMAKE_CXX_COMPILER_VERSION
}
\n
"
)
if
(
TENSORRT_FOUND
)
file
(
APPEND
${
version_file
}
...
...
cmake/miopen.cmake
0 → 100644
浏览文件 @
b032b579
if
(
NOT WITH_ROCM
)
return
()
endif
()
# Now we don't support ROCm on windows
if
(
WIN32
)
return
()
endif
()
set
(
MIOPEN_ROOT
${
ROCM_PATH
}
/miopen CACHE PATH
"MIOPEN ROOT"
)
find_path
(
MIOPEN_INCLUDE_DIR
"miopen/miopen.h"
PATHS
${
MIOPEN_ROOT
}
${
MIOPEN_ROOT
}
/include
${
MIOPEN_ROOT
}
/local/include
$ENV{MIOPEN_ROOT} $ENV{MIOPEN_ROOT}/include $ENV{MIOPEN_ROOT}/local/include
NO_DEFAULT_PATH
)
get_filename_component
(
__libpath_hist
${
CUDA_CUDART_LIBRARY
}
PATH
)
find_library
(
MIOPEN_LIBRARY NAMES
"libMIOpen.so"
PATHS
${
MIOPEN_ROOT
}
${
MIOPEN_ROOT
}
/lib
${
MIOPEN_ROOT
}
/lib64
${
__libpath_hist
}
$ENV{MIOPEN_ROOT} $ENV{MIOPEN_ROOT}/lib $ENV{MIOPEN_ROOT}/lib64
NO_DEFAULT_PATH
DOC
"Path to MIOpen library."
)
if
(
MIOPEN_INCLUDE_DIR AND MIOPEN_LIBRARY
)
set
(
MIOPEN_FOUND ON
)
else
()
set
(
MIOPEN_FOUND OFF
)
endif
()
macro
(
find_miopen_version miopen_header_file
)
file
(
READ
${
miopen_header_file
}
MIOPEN_VERSION_FILE_CONTENTS
)
get_filename_component
(
MIOPEN_LIB_PATH
${
MIOPEN_LIBRARY
}
DIRECTORY
)
string
(
REGEX MATCH
"define MIOPEN_VERSION_MAJOR +([0-9]+)"
MIOPEN_MAJOR_VERSION
"
${
MIOPEN_VERSION_FILE_CONTENTS
}
"
)
string
(
REGEX REPLACE
"define MIOPEN_VERSION_MAJOR +([0-9]+)"
"
\\
1"
MIOPEN_MAJOR_VERSION
"
${
MIOPEN_MAJOR_VERSION
}
"
)
string
(
REGEX MATCH
"define MIOPEN_VERSION_MINOR +([0-9]+)"
MIOPEN_MINOR_VERSION
"
${
MIOPEN_VERSION_FILE_CONTENTS
}
"
)
string
(
REGEX REPLACE
"define MIOPEN_VERSION_MINOR +([0-9]+)"
"
\\
1"
MIOPEN_MINOR_VERSION
"
${
MIOPEN_MINOR_VERSION
}
"
)
string
(
REGEX MATCH
"define MIOPEN_VERSION_PATCH +([0-9]+)"
MIOPEN_PATCH_VERSION
"
${
MIOPEN_VERSION_FILE_CONTENTS
}
"
)
string
(
REGEX REPLACE
"define MIOPEN_VERSION_PATCH +([0-9]+)"
"
\\
1"
MIOPEN_PATCH_VERSION
"
${
MIOPEN_PATCH_VERSION
}
"
)
string
(
REGEX MATCH
"define MIOPEN_VERSION_TWEAK +([0-9]+)"
MIOPEN_TWEAK_VERSION
"
${
MIOPEN_VERSION_FILE_CONTENTS
}
"
)
string
(
REGEX REPLACE
"define MIOPEN_VERSION_TWEAK +([0-9]+)"
"
\\
1"
MIOPEN_TWEAK_VERSION
"
${
MIOPEN_TWEAK_VERSION
}
"
)
if
(
NOT MIOPEN_MAJOR_VERSION
)
set
(
MIOPEN_VERSION
"???"
)
else
()
add_definitions
(
"-DMIOPEN_MAJOR_VERSION=
\"
${
MIOPEN_MAJOR_VERSION
}
\"
"
)
math
(
EXPR MIOPEN_VERSION
"
${
MIOPEN_MAJOR_VERSION
}
* 1000 +
${
MIOPEN_MINOR_VERSION
}
* 10 +
${
MIOPEN_PATCH_VERSION
}
"
)
message
(
STATUS
"Current MIOpen header is
${
MIOPEN_INCLUDE_DIR
}
/miopen/miopen.h "
"Current MIOpen version is v
${
MIOPEN_MAJOR_VERSION
}
.
${
MIOPEN_MINOR_VERSION
}
.
${
MIOPEN_PATCH_VERSION
}
. "
)
endif
()
endmacro
()
if
(
MIOPEN_FOUND
)
find_miopen_version
(
${
MIOPEN_INCLUDE_DIR
}
/miopen/version.h
)
endif
()
paddle/fluid/platform/device_context.h
浏览文件 @
b032b579
...
...
@@ -337,15 +337,16 @@ class CUDAContext {
PADDLE_ENFORCE_CUDA_SUCCESS
(
dynload
::
miopenGetVersion
(
&
miopen_major
,
&
miopen_minor
,
&
miopen_patch
));
auto
local_miopen_version
=
(
miopen_major
*
1000
+
miopen_minor
*
10
0
+
miopen_patch
)
/
10
0
;
auto
compile_miopen_version
=
MIOPEN_VERSION
/
10
0
;
(
miopen_major
*
1000
+
miopen_minor
*
10
+
miopen_patch
)
/
1
0
;
auto
compile_miopen_version
=
MIOPEN_VERSION
/
10
;
if
(
local_miopen_version
<
static_cast
<
size_t
>
(
compile_miopen_version
))
{
LOG_FIRST_N
(
WARNING
,
1
)
<<
"WARNING: device: "
<<
place_
.
device
<<
". The installed Paddle is compiled with MIOPEN "
<<
compile_miopen_version
/
10
<<
"."
<<
compile_miopen_version
%
10
<<
compile_miopen_version
/
100
<<
"."
<<
compile_miopen_version
%
100
<<
", but MIOPEN version in your machine is "
<<
local_miopen_version
/
10
<<
"."
<<
local_miopen_version
%
1
0
<<
local_miopen_version
/
10
0
<<
"."
<<
local_miopen_version
%
10
0
<<
", which may cause serious incompatible bug. "
<<
"Please recompile or reinstall Paddle with compatible MIOPEN "
"version."
;
...
...
paddle/fluid/platform/dynload/miopen.h
浏览文件 @
b032b579
...
...
@@ -21,8 +21,8 @@ limitations under the License. */
#include "paddle/fluid/platform/dynload/dynamic_loader.h"
#include "paddle/fluid/platform/port.h"
#define MIOPEN_VERSION
\
(MIOPEN_VERSION_MAJOR * 1000 + MIOPEN_VERSION_MINOR * 10
0
+ \
#define MIOPEN_VERSION \
(MIOPEN_VERSION_MAJOR * 1000 + MIOPEN_VERSION_MINOR * 10 + \
MIOPEN_VERSION_PATCH) // NOLINT
namespace
paddle
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录