-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Fix compilation of CUDA code on Windows #3634
Fix compilation of CUDA code on Windows #3634
Conversation
Adding a macro instead would for sure reduce the code duplication. |
The best way would be to actually remove deprecated usage in the library itself, rather than patch over. That's not to say that the macro is a bad addition since several other headers in common use deprecated attribute. |
I checked the code of the repository and it seems that the deprecated types are not used anymore so I think we can remove them. We should probably do the stuff with the macro in a separate PR. |
I fetched this macro from somewhere which does the trick on windows. if of interest. |
They were deprecated for the stability of projects using them. As such, their removal isn't scheduled before 1.12 release. Your fork seems to have a nice macro suite of macros. |
So should we use the macros from @larshg? |
I liked this version better since it fits in the syntax better IMO. But it'll need to be modified to work with nvcc |
Ok, then I'll use this version. |
I introduced the macros for the different versions of 'deprecated' and replaced all occurences with the macros. To be able to correctly support older versions of the Visual Studio compiler I needed a macro If we would ignore the deprecated attribute for Visual Studio compilers older than 2015 we could remove the macros |
Did parentheses not work instead of a delay macro? Maybe use a more descriptive name instead of
It's not a lot of code so doesn't matter to me. Others might have differing opinion though. You should however put this as a comment in the code so that in future when 2015 is definitely old enough, then the "dead code can be removed" |
Do I understand your message correctly that Visual Studio 2015 and above do not need I think macros |
@kunaltyagi: I tried using parentheses but it didn't work because the will end up with something like @taketwo: No quite. Visual Studio 2015 and above don't need the I like the version where we don't have a special macro for the using keyword better because you can than use the macro in the same way as you would use the deprecated attribute. So taking the things into account @taketwo wrote we would end up with only a single macro Is this Ok for everyone if I do the changes like that? |
6292eaa
to
cbb5c28
Compare
I made the changes as discussed and rebased the branch on the new master because there was a merge conflict. I'll just wait for the CI to see if the changes work on all platforms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Squash & Merge pending CI 🚀 (1 commit is sufficient, 2 at max: adding new macro and replacement)
Thanks @office-florian-hubner 😄
Hi @office-florian-hubner I had to change: or I'd still get an error: regards, Lars |
That's interesting. How does nvcc claim truth and yet throw an error? Let's add that patch with a comment related to nvcc's quirk PS: any way to compile CUDA on windows on the CI? |
In pcl_macros.h the attribute [[deprecated]] is used. It seems that nvcc doesn't support this attribute under Windows at the moment. I tried it with CUDA Toolkit 10.1 with Windows 10. I also checked the release notes of 10.2 but they didn't address it there. To fix this I introduced a macro PCL_DEPRECATED that handles the details for the different platforms and compilers.
6d43961
to
e514ef1
Compare
I added the check for CUDACC and added a comment. I squashed the commits so if the CI passes I think the branch can be integrated. Thank you all for your feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending CI
In pcl_macros.h the attribute [[deprecated]] is used. It seems that
nvcc doesn't support this attribute under Windows at the moment.
I tried it with CUDA Toolkit 10.1 with Windows 10. I also checked the
release notes of 10.2 but they didn't address it there.
To fix this I omit the attribute under Windows when nvcc is used using
preprocessor directives. This is the simplest way of avoiding the
issue. A more elegant solution would be if we added a macro similar to
how it is done at the bottom of pcl_macros.h with [[fallthrough]] and
[[nodiscard]].
Let me know if this is ok or if we should use a macro.