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

Macro redefinition on windows with CUDA #2603

Closed
orgonth opened this issue Dec 22, 2022 · 4 comments
Closed

Macro redefinition on windows with CUDA #2603

orgonth opened this issue Dec 22, 2022 · 4 comments
Labels

Comments

@orgonth
Copy link
Contributor

orgonth commented Dec 22, 2022

Describe the bug

Building my project on MSVC + CUDA, I have some CUDA tests (e.g. test_foo.cu) that are compiled with nvcc.
Compilation of these files fail with this error:

[build] catch2/internal/catch_compiler_capabilities.hpp(184): error C2220: the following warning is treated as an error
[build] catch2/internal/catch_compiler_capabilities.hpp(184): warning C4005: 'CATCH_INTERNAL_START_WARNINGS_SUPPRESSION': macro redefinition
[build] catch2/internal/catch_compiler_capabilities.hpp(64): note: see previous definition of 'CATCH_INTERNAL_START_WARNINGS_SUPPRESSION'
[build] catch2/internal/catch_compiler_capabilities.hpp(185): warning C4005: 'CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION': macro redefinition
[build] catch2/internal/catch_compiler_capabilities.hpp(65): note: see previous definition of 'CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION'

The problem is indeed that both _MSC_VER and __CUDACC__ are defined for these files.

Platform information:

  • OS: Windows 10
  • Compiler+version: Visual Studio 2019 + CUDA 11.3
  • Catch version: v3.2.1

Relates to: #2307

@j-stephan
Copy link

Same here with CUDA 12 and Visual Studio 2022.

@horenmar horenmar added the Bug label Jan 13, 2023
horenmar added a commit that referenced this issue Jan 14, 2023
@horenmar
Copy link
Member

Can you check if the linked commit fixes your issue?

@orgonth
Copy link
Contributor Author

orgonth commented Jan 16, 2023

It "works" but I have another error now:

[build] test_ProcDemodulate.cu(38): error C2220: the following warning is treated as an error
[build] test_ProcDemodulate.cu(38): warning C4068: unknown pragma 'nv_diagnostic'
[build] test_ProcDemodulate.cu(38): warning C4068: unknown pragma 'nv_diag_suppress'
[build] test_ProcDemodulate.cu(38): warning C4068: unknown pragma 'nv_diagnostic'
[build] test_ProcDemodulate.cu(60): warning C4068: unknown pragma 'nv_diagnostic'
[build] test_ProcDemodulate.cu(60): warning C4068: unknown pragma 'nv_diagnostic'
[build] test_ProcDemodulate.cu(63): warning C4068: unknown pragma 'nv_diagnostic'
[build] test_ProcDemodulate.cu(63): warning C4068: unknown pragma 'nv_diag_suppress'
[build] test_ProcDemodulate.cu(63): warning C4068: unknown pragma 'nv_diagnostic'
[build] test_ProcDemodulate.cu(83): warning C4068: unknown pragma 'nv_diagnostic'
[build] test_ProcDemodulate.cu(83): warning C4068: unknown pragma 'nv_diagnostic'

Looks like these pragma were introduced in CUDA 11.5
See __NVCC_DIAG_PRAGMA_SUPPORT__ to solve that:
https://developer.nvidia.com/blog/reducing-application-build-times-using-cuda-c-compilation-aids/

I can propose a fix, if you want

@horenmar
Copy link
Member

Yeah I don't have access to nvcc, so PRs are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants