-
-
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
Apply clangformat to gpu code #4719
Apply clangformat to gpu code #4719
Conversation
Would it be possible to split this PR? 50k lines of diff to parse is not easy |
Splitting the PR is a great idea! I will think of logical and manageable chunks and the commit again. Thanks for the comment! |
I reverted the previous commit and formatted only the code in the |
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.
Can we also add gpu/containers
to the format.sh file?
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.
4/10 files reviewed
PS: your format CI is failing
{ DeviceMemory::operator=(other); return *this; } | ||
template <class T> | ||
inline DeviceArray<T>::DeviceArray() | ||
{} |
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.
Let's separate these functions with newlines
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.
Yes, that is an excellent idea! I wonder why clang-format cannot do that automatically for us, but I couldn't find a corresponding setting. You don't know one either?
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.
I don't think there's an option for that: https://releases.llvm.org/11.0.0/tools/clang/docs/ClangFormatStyleOptions.html
gpu/containers/include/pcl/gpu/containers/impl/device_array.hpp
Outdated
Show resolved
Hide resolved
You need to run clang-format 2-3 times till it settles on an equilibrium. See the functions offending the clang-format: |
Thanks for your comments and explanations! I hope I did address your concerns; the files look much better now! |
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.
The print statements in initiaization.cpp don't look pretty, but apart from that, LGTM.
I'll approve if we can't improve the visual feel of print statements (it's a minor issue that's all)
rows() const; | ||
|
||
/** \brief Returns stride between two consecutive rows in bytes for internal buffer. | ||
* Step is stored always and everywhere in bytes!!! */ |
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.
I think the line regarding Step is stored... bytes!!!
can be converted to a note or a warning. Not relevant to this PR
{ DeviceMemory::operator=(other); return *this; } | ||
template <class T> | ||
inline DeviceArray<T>::DeviceArray() | ||
{} |
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.
I don't think there's an option for that: https://releases.llvm.org/11.0.0/tools/clang/docs/ClangFormatStyleOptions.html
Thanks for the review, @kunaltyagi! The print statements in |
This reverts commit 5171078.
15253cb
to
eea673b
Compare
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.
minor comments aside, lgtm
This has been a long time coming 😆 |
@kunaltyagi Could you run the "Generate Documentation" CI to check if no doxygen warnings appear? |
Thank you so much, Kunal and Markus, for guiding me through this! |
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.
Seems fine
As discussed with @kunaltyagi in PR #4677, we thought clang-formatting the GPU codebase in a batched commit might be helpful. This commit tries to do that. I applied clang-format with the following lines of code:
find . -name '*.h' -or -name '*.hpp' -or -name '*.cpp' | xargs /usr/bin/clang-format-10 -i -style=file
The command finds all files with h, hpp, or cpp ending recursively in the GPU folder and formats it according to the
.clang-format
file.