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

Add DPADDLE_WITH_CUDA for GCC #35448

Merged
merged 2 commits into from
Sep 7, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions python/paddle/utils/cpp_extension/cpp_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,9 @@ def unix_custom_single_compiler(obj, src, ext, cc_args, extra_postargs,
# See https://stackoverflow.com/questions/34571583/understanding-gcc-5s-glibcxx-use-cxx11-abi-or-the-new-abi
add_compile_flag(['-D_GLIBCXX_USE_CXX11_ABI=1'], cflags)

if not is_cuda_file(src):
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. windows需要加判断吗
  2. 如果用户仅编译cc文件,也会添加这个宏吗

Copy link
Contributor Author

Choose a reason for hiding this comment

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

windows也添加了。这里只会对Extension中联合编译了 .cu 文件时,才会对编译.cc文件额外添加PADDLE_WITH_CUDA

cflags.append('-DPADDLE_WITH_CUDA')

add_std_without_repeat(
cflags, self.compiler.compiler_type, use_std14=True)
original_compile(obj, src, ext, cc_args, cflags, pp_opts)
Expand Down