-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Use __CUDA__ macro with __NVCC__. #3539
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3539 +/- ##
============================================
+ Coverage 45.64% 45.74% +0.09%
Complexity 188 188
============================================
Files 166 166
Lines 13234 13233 -1
Branches 445 445
============================================
+ Hits 6041 6053 +12
+ Misses 6989 6976 -13
Partials 204 204
Continue to review full report at Codecov.
|
Can you elaborate your reasoning for replacing |
@hcho3 To some degree. __CUDA__ is a macro defined by clang to indicate the current scope, __NVCC__ is a similar macro defined by NVCC. As you can see from the patch, it's not really replacing, just checking for the right one to use. With this patch clang can compile a larger portion of the code, but still not the whole project. But the reason for myself is I can use better syntax checking and code static analyse tools from clang. Now I can see error/warning and do code navigation for CUDA interactively in my editor just like normal c++ code. NVCC provides very primitive error handling facility and confusing error message. So the patch is mainly for easy development. :) |
I'm not sure I like substituting macros with more macros. It can be a little confusing. What about doing this:
|
* __CUDA__ is defined in clang. Making the change won't make clang compile xgboost, but syntax checking from clang is at least partially working.
87aacfa
to
e1a4292
Compare
@RAMitchell Done. |
compile xgboost, but syntax checking for *.cu from clang is at least partially
working.