-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[CppExtension Cuda] Add cuda unit test for CppExtension #52900
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
Error raises when using CUDA 12 and pybind11, see:
We also need to patch codes. |
… extension-add-cuda-example
… extension-add-cuda-example
@@ -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} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是不是只能作为临时方案,后边如果pybind第三方代码有变动是不是会有问题,如果是临时方案的话可以加个TODO
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
不可以吗
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…#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
…#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
) * [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
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 的单测,