-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
fix compilation problems with MSVC+Cuda 12.9 #27522
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
Changes from 1 commit
511e220
c854065
b2aa2a8
b4b31ea
3bfb124
8cefc9a
c10576a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -388,8 +388,16 @@ macro(ocv_nvcc_flags) | |
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler=-fno-finite-math-only) | ||
endif() | ||
|
||
if(WIN32 AND NOT (CUDA_VERSION VERSION_LESS "11.2")) | ||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcudafe --display_error_number --diag-suppress 1394,1388) | ||
if(WIN32) | ||
if (NOT (CUDA_VERSION VERSION_LESS "11.2")) | ||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcudafe --display_error_number --diag-suppress 1394,1388) | ||
endif() | ||
if(CUDA_VERSION GREATER "12.7") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which compilation errors do you get with this version of CUDA without the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can get a lot of errors like :
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You get this with CUDA 12.8 and the latest version of Visual Studio 2022? I only see those errors with CUDA 12.9 without the addition of I'm building with Ninja are you building directly in VS? Update: I can't recreate this, can you provide your CMake arguments, the version of VS, CUDA and CMake you are using please. I can build OpenCV without the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right, I can't reproduce it either with 12.8. I must have fooled myself among my different experiments. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chacha21 Is that flag needed at all? In my testing only the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chacha21 Yes, details below.
The only addition I had to make was the fix in opencv/opencv_contrib#3968 to get cudev to build. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I confirm that on my build system, I do need "--expt-relaxed-constexpr", otherwise the first compilation errors start with opencv_test_cudev
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chacha21 Is that with the fix I linked to? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is with
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To fix the cudev error you need to apply the PR I linked to. Without it I get the errors you mentioned above even with the experimental flag ( |
||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} --expt-relaxed-constexpr) | ||
endif() | ||
if(CUDA_VERSION GREATER "12.8") | ||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler /Zc:preprocessor) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency with the rest of the file I would use |
||
endif() | ||
endif() | ||
|
||
if(CMAKE_CROSSCOMPILING AND (ARM OR AARCH64)) | ||
|
Uh oh!
There was an error while loading. Please reload this page.