NVIDIA / NVIDIA/cccl

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

Open
#837 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
2.5k
Forks
486
Avg merge
2d 6h
Merged PRs (30d)
295

Description

Compiling this 3-line program `test-cuda.cpp`
```
#include

int main() { return 0; }
```
results in a compiler/warning error:
```console
$ 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.