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

[CppExtension Cuda] Add cuda unit test for CppExtension #52900

Merged
merged 16 commits into from
Apr 24, 2023

Conversation

jiahy0825
Copy link
Contributor

@jiahy0825 jiahy0825 commented Apr 13, 2023

PR types

Others

PR changes

Others

Description

Pcard-66987

[CppExtension Cuda] Add cuda unit test for CppExtension.

CppExtension supports cuda codes, add a unit test to monitor this feature.

Finish one TODO item in #49893.

Update: Patch codes to pybind/cast.h, because pybind and the cuda12's nvcc compiler are incompatible. Detailed PRs are listed below.

由于 cuda12 的 nvcc 编译器和 pybind 有冲突,因此需要往 pybind 代码里打补丁,并添加了 Extension 机制支持 CUDA 的单测,

@paddle-bot
Copy link

paddle-bot bot commented Apr 13, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@jiahy0825
Copy link
Contributor Author

jiahy0825 commented Apr 18, 2023

@@ -33,6 +41,7 @@ ExternalProject_Add(
# third-party library version changes cannot be incorporated.
# reference: https://cmake.org/cmake/help/latest/module/ExternalProject.html
UPDATE_COMMAND ""
PATCH_COMMAND ${PYBIND_PATCH_COMMAND}
Copy link
Contributor

Choose a reason for hiding this comment

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

这个是不是只能作为临时方案,后边如果pybind第三方代码有变动是不是会有问题,如果是临时方案的话可以加个TODO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pybind 现在已经固定 tag 了,所以 pybind 代码更新不会引入问题,后续 pybind 再有升级 tag 的计划时,可以考虑去掉 patch

Paddle has already fixed the tag version of pybind, so no problem would be involved if pybind updates it's codes.
We can remove this patch if Paddle updates pybind to a new tag version.

@@ -21,6 +21,14 @@ set(PYBIND_TAG v2.10.3)
set(PYBIND_INCLUDE_DIR ${THIRD_PARTY_PATH}/pybind/src/extern_pybind/include)
include_directories(${PYBIND_INCLUDE_DIR})

set(PYBIND_PATCH_COMMAND "")
if(NOT WIN32)
file(TO_NATIVE_PATH ${PADDLE_SOURCE_DIR}/patches/pybind/cast.h.patch
Copy link
Contributor

Choose a reason for hiding this comment

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

这里为啥要变换一下路径,直接使用${PADDLE_SOURCE_DIR}/patches/pybind/cast.h.patch不可以吗

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 的 PATCH 操作保持一致

We can also use cmake path, use TO_NATIVE_PATH here to be consistent with other cmake files in Paddle.

Ref: https://www.jianshu.com/p/ed151fdcf473

image

Copy link
Contributor

@heavyrain-lzy heavyrain-lzy left a comment

Choose a reason for hiding this comment

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

LGTM

@jiahy0825 jiahy0825 merged commit 7a9754a into PaddlePaddle:develop Apr 24, 2023
jiahy0825 added a commit to jiahy0825/Paddle that referenced this pull request Apr 24, 2023
…#52900)

* [CppExtension Cuda] Add cuda unit test for CppExtension

* update extra_compile_args for CUDAExtension

* add debug info

* Add patch to fix CUDA12 compile error

* patch for all env

* add windows judgement

* Try to fix setup function not found error

* fix mix_relu_and_extension include file

* fix setup compile error

* remove useless debug comments

* add sleep, debug CI-build

* add space to disable cmake cache

* remove debug info

* add space to pass CI-build
lijialin03 pushed a commit to lijialin03/Paddle that referenced this pull request Apr 25, 2023
…#52900)

* [CppExtension Cuda] Add cuda unit test for CppExtension

* update extra_compile_args for CUDAExtension

* add debug info

* Add patch to fix CUDA12 compile error

* patch for all env

* add windows judgement

* Try to fix setup function not found error

* fix mix_relu_and_extension include file

* fix setup compile error

* remove useless debug comments

* add sleep, debug CI-build

* add space to disable cmake cache

* remove debug info

* add space to pass CI-build
phlrain pushed a commit that referenced this pull request Apr 25, 2023
)

* [CppExtension Cuda] Add cuda unit test for CppExtension

* update extra_compile_args for CUDAExtension

* add debug info

* Add patch to fix CUDA12 compile error

* patch for all env

* add windows judgement

* Try to fix setup function not found error

* fix mix_relu_and_extension include file

* fix setup compile error

* remove useless debug comments

* add sleep, debug CI-build

* add space to disable cmake cache

* remove debug info

* add space to pass CI-build
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.

None yet

4 participants