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
adding fast and parallel-friendly kdtree implementation #18288
Conversation
A new Pull Request was created by @felicepantaleo (Felice Pantaleo) for master. It involves the following packages: CommonTools/RecoAlgos @perrotta, @cmsbuild, @slava77, @davidlange6 can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
@cmsbuild please test |
The tests are being triggered in jenkins. |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
Comparison is ready Comparison Summary:
|
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.
In general, the huge indentation (it is better avoiding computer tabs for it) and the unnecessary and illogical insertion of empty lines and instructions broken in two or more lines, make the review of this code rather painful.
Could you please adjust it, and make it better readable?
v |= v >> 8; | ||
v |= v >> 16; | ||
return MultiplyDeBruijnBitPosition[(unsigned int)(v * 0x07C4ACDDU) >> 27]; | ||
|
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.
Please improve readability by removing the many empty lines (when not needed to separate methods or logical parts inside the code)
return MultiplyDeBruijnBitPosition[(unsigned int)(v * 0x07C4ACDDU) >> 27]; | ||
|
||
} | ||
|
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.
Remove till L28
{ | ||
theNumberOfPoints = 0; | ||
theDepth = 0; | ||
|
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.
remove
|
||
void push_back(const FKDPoint<TYPE, numberOfDimensions>& point) | ||
{ | ||
|
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.
remove empty lines here and below the instruction
|
||
void push_back(FKDPoint<TYPE, numberOfDimensions> && point) | ||
{ | ||
|
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.
remove empty lines here and below the instruction
if (length == 1) | ||
return 0; | ||
unsigned int index = 1 << (ilog2(length)); | ||
|
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.
remove one line
for (unsigned int i = 0; i < numberOfDimensions; ++i) | ||
theDimensions[i][position] = point[i]; | ||
theIds[position] = point.getId(); | ||
|
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.
remove
for (unsigned int i = 0; i < numberOfDimensions; ++i) | ||
theDimensions[i][position] = point[i]; | ||
theIds[position] = point.getId(); | ||
|
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.
remove
theSize = 0; | ||
theFront = 0; | ||
theTail = 0; | ||
} |
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.
here one empty line could help, instead...
theFront = 0; | ||
theTail = 0; | ||
theCapacity = 0; | ||
|
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 same comments about empty lines and indentations also hold for this file (not marked all them)
Dear @perrotta , I do not disagree on the specific, still we cannot change coding style at each coordinator change. |
Ciao @VinInn |
On 4/21/17 3:36 AM, Vincenzo Innocente wrote:
Dear @perrotta <https://github.com/perrotta> , I do not disagree on the
specific, still we cannot change coding style at each coordinator change.
I'm curious who was the last coordinator that asked you to code
with 8-char indentation or add extra empty lines inside function scopes.
… Is there a (still valid) cms coding rule about spacing and tabbing?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#18288 (comment)>, or
mute the thread
<https://github.com/notifications/unsubscribe-auth/AEdcbkkoZJLnbDwYTaG52-wf0hq90AKBks5ryIbEgaJpZM4M44fI>.
|
} | ||
|
||
|
||
void build() |
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 total duplication of the build()
function just to change the source of the points vector is unnecessary. This function only needs to exist once.
Pull request #18288 was updated. @perrotta, @cmsbuild, @slava77, @davidlange6 can you please check and sign again. |
@perrotta could you point me to unit tests of some other data structure so that I can imitate? |
Pull request #18288 was updated. @perrotta, @cmsbuild, @slava77, @davidlange6 can you please check and sign again. |
please test |
The tests are being triggered in jenkins. |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
+1 |
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request requires discussion in the ORP meeting before it's merged. @davidlange6, @smuzaffar |
+1 |
This PR adds a fast/parallel-friendly kd-tree implementation in CommonTools.
The plan is to replace the existing PF KDtree (based on lists) with this one which is based on vectors and SoA in HGCal wfs, making it friendly for accelerators.
Searching and building produces exactly the same results, searching with 3D point cloud of about 100k points makes it ~3x faster than the existing implementation.
@rovere @malgeri @VinInn @makortel