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

Don't include host_defines.h if not using nvcc in year 2023 #837

Open
mattpulver opened this issue Apr 7, 2023 · 0 comments
Open

Don't include host_defines.h if not using nvcc in year 2023 #837

mattpulver opened this issue Apr 7, 2023 · 0 comments

Comments

@mattpulver
Copy link

Compiling this 3-line program test-cuda.cpp

#include <thrust/execution_policy.h>

int main() { return 0; }

results in a compiler/warning error:

$ g++ -std=c++17 test-cuda.cpp -I/opt/cuda/targets/x86_64-linux/include -Werror
In file included from /opt/cuda/targets/x86_64-linux/include/cuda_runtime_api.h:147,
                 from /opt/cuda/targets/x86_64-linux/include/cub/detail/detect_cuda_runtime.cuh:38,
                 from /opt/cuda/targets/x86_64-linux/include/cub/util_arch.cuh:41,
                 from /opt/cuda/targets/x86_64-linux/include/cub/util_debug.cuh:40,
                 from /opt/cuda/targets/x86_64-linux/include/thrust/system/cuda/config.h:43,
                 from /opt/cuda/targets/x86_64-linux/include/thrust/system/cuda/detail/execution_policy.h:35,
                 from /opt/cuda/targets/x86_64-linux/include/thrust/iterator/detail/device_system_tag.h:23,
                 from /opt/cuda/targets/x86_64-linux/include/thrust/iterator/iterator_traits.h:62,
                 from /opt/cuda/targets/x86_64-linux/include/thrust/detail/type_traits/pointer_traits.h:23,
                 from /opt/cuda/targets/x86_64-linux/include/thrust/detail/raw_pointer_cast.h:20,
                 from /opt/cuda/targets/x86_64-linux/include/thrust/detail/execute_with_allocator.h:23,
                 from /opt/cuda/targets/x86_64-linux/include/thrust/execution_policy.h:25,
                 from test-cuda.cpp:1:
/opt/cuda/targets/x86_64-linux/include/crt/host_defines.h:86: error: "__forceinline__" redefined [-Werror]
   86 | #define __forceinline__ \
      | 
In file included from /opt/cuda/targets/x86_64-linux/include/cuda/std/version:13,
                 from /opt/cuda/targets/x86_64-linux/include/cuda/std/cstddef:20,
                 from /opt/cuda/targets/x86_64-linux/include/cuda/std/type_traits:17,
                 from /opt/cuda/targets/x86_64-linux/include/thrust/detail/type_traits.h:27,
                 from /opt/cuda/targets/x86_64-linux/include/thrust/detail/execute_with_allocator_fwd.h:21,
                 from /opt/cuda/targets/x86_64-linux/include/thrust/detail/execute_with_allocator.h:21:
/opt/cuda/targets/x86_64-linux/include/cuda/std/detail/__config:38: note: this is the location of the previous definition
   38 |         #define __forceinline__
      | 
cc1plus: all warnings being treated as errors

This is similar to a past issue NVIDIA/thrust#382 but seems to be back.

Is there a way we can compile this with GCC without the warning, since our project uses -Werror?

Cuda: 12.1.0
GCC: 12.2.1
OS: arch linux

@jarmak-nv jarmak-nv transferred this issue from NVIDIA/thrust Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant