Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加rocm平台支持代码 #29342

Merged
merged 21 commits into from
Dec 16, 2020
Merged

添加rocm平台支持代码 #29342

merged 21 commits into from
Dec 16, 2020

Conversation

XuanBaby
Copy link
Contributor

@XuanBaby XuanBaby commented Dec 3, 2020

PR types

New features

PR changes

APIs

Describe

1、修改编译选项WITH_AMD_GPU为 WITH_ROCM_PLATFORM
2、为rocm平台添加相关编译选项
3、添加ROCM 平台底层代码调用:dynload,完善miopen/hiprand/rocblas/rocrand等相关库的调用接口

扩展paddle框架的硬件适用范围,
编译参数:

cmake .. -DPYTHON_EXECUTABLE=$PATH_PYTHON/bin/python3 -DPYTHON_INCLUDE_DIR=$PATH_PYTHON/include
-DPYTHON_LIBRARY=$PATH_PYTHON/lib/libpython3.so -DCMAKE_BUILD_TYPE=Release -DWITH_GPU=OFF -DWITH_GLOO=OFF -DWITH_TP_CACHE=ON -DWITH_TESTING=ON -DWITH_MKL=OFF -DWITH_NCCL=OFF -DWITH_ROCM_PLATFORM=ON
os:CentOS Linux release 7.7.1908
GCC:7.3.1
cmake:3.18
rocm:3.5

@paddle-bot-old
Copy link

paddle-bot-old bot commented Dec 3, 2020

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@@ -39,7 +39,7 @@ ExternalProject_Add(
# to be modified without triggering incremental compilation, and the
# third-party library version changes cannot be incorporated.
# reference: https://cmake.org/cmake/help/latest/module/ExternalProject.html
UPDATE_COMMAND ""
# UPDATE_COMMAND ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这行代码可以删掉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的

cmake/hip.cmake Outdated

set(HIP_HCC_FLAGS "${HIP_HCC_FLAGS} -fPIC -DPADDLE_WITH_HIP -std=c++11" )
#include_directories("${ROCM_PATH}/thrust")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不需要include的话,删掉?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

DEFINE_string(miopen_dir, "",
"Specify path for loading libcudnn.so. For instance, "
"/usr/local/cudnn/lib. If empty [default], dlopen "
"will search cudnn from LD_LIBRARY_PATH");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string的内容需要修改下?应该不是libcudnn.so,也不是search cudnn。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

咦? 好的 我改一下

"Specify path for loading cuda library, such as libcublas, "
"libcurand, libcusolver. For instance, /usr/local/cuda/lib64. "
"If default, dlopen will search cuda from LD_LIBRARY_PATH");

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同样不是cuda library, 也不是search cuda

DEFINE_string(rccl_dir, "",
"Specify path for loading nccl library, such as libnccl.so. "
"For instance, /usr/local/cuda/lib64. If default, "
"dlopen will search cuda from LD_LIBRARY_PATH");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不是nccl, 也不是/usr/local/cuda/lib64, 也不是search cuda


#define ROCBLAS_BLAS_ROUTINE_EACH_R4(__macro) \
__macro(rocblas_gemm_batched_ex); \
// __macro(rocblas_gemm_strided_batched_ex);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最好能注释一下当前无法支持的原因,以便以后修复

__macro(rocblas_dgemm); \
__macro(rocblas_hgemm); \
__macro(rocblas_dgeam); \
/*__macro(rocblas_gemm_ex); */\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最好能注释一下当前无法支持的原因,以便以后修复

__macro(hipModuleLoadData); \
__macro(hipModuleGetFunction); \
__macro(hipModuleUnload); \
/* __macro(hipOccupancyMaxActiveBlocksPerMultiprocessor);*/ \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同样,注释一下当前无法支持的原因,以便以后修复

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好滴 这些目前在rocm3.5 上还木有对应的支持

@@ -0,0 +1,36 @@
/* Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2020

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的 我改一下

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phlrain 改好啦 麻烦你再看看呢

Copy link
Contributor

@qili93 qili93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@XuanBaby XuanBaby requested a review from qili93 December 14, 2020 06:23
Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for CMakeLists.txt

@qili93 qili93 merged commit 7673850 into PaddlePaddle:develop Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants