-
-
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
Octree Precompile #1639
Octree Precompile #1639
Conversation
@@ -247,9 +247,8 @@ namespace pcl | |||
|
|||
} | |||
|
|||
//#ifdef PCL_NO_PRECOMPILE | |||
// Note: Don't precompile this octree type to speed up compilation. It's probably rarely used. |
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.
This octree type drives the Supervoxel Clustering algorithm, which is extremely popular according to my feelings.
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.
So it should be added to the precompilation unit?
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.
It's being instantiated here. Not really where I would look for it normally. I would say for now leave it as it was, unless there's a solid reason to not precompile it.
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 comment should rather says something like:
Do not precompile this octree type because it is typically used with custom leaf containers.
LGTM |
@@ -39,7 +39,7 @@ | |||
#ifndef PCL_OCTREE_CONTAINER_H | |||
#define PCL_OCTREE_CONTAINER_H | |||
|
|||
#include <string.h> | |||
//#include <string.h> |
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.
leftover?
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.
Oh, right. Thx
32e6502
to
0959f5a
Compare
So, the final PR that I need to review. This is personally the most challenging PR to understand out of all selected for 1.8.1. Please bear with me if some of the comments/questions seem noobish. |
@@ -39,6 +39,8 @@ | |||
#ifndef PCL_OCTREE_2BUF_BASE_HPP | |||
#define PCL_OCTREE_2BUF_BASE_HPP | |||
|
|||
#include <pcl/octree/octree2buf_base.h> |
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.
Is this really necessary? I normally only see the corresponding *.hpp being included at the end of the *.h file and the *.hpp never includes the corresponding *.h .
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.
Yeah, you might be right. Still compiles without including anything here.
I'll remove it.
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.
So, remove 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.
Sorry, I've just realized that you remove it in a later commit.
Ping @stefanbuettner. I was wanting to merge in the short future to give enough time to "explode". |
Hey Sergio, |
0959f5a
to
c9b1816
Compare
Hey @stefanbuettner. Do you mind rebasing this to the current HEAD? I'm a little out of context since the last time I checked this thoroughly but this should be good to merge. Edit: Also if possible squash this into three commits:
|
2ae6e51
to
0e980d4
Compare
Done. |
The octree module didn't respect the PCL_NO_PRECOMPILE mechanism. This commit fixes that by implementing it for percompiled classes and fixing includes for non-precompiled classes.
* Remove unnecessary includes and fix compilation error in OctreePointcloudAdjacency. * Add OctreePointCloudAdjacency to octree.h and add comment for instantiation. * Replace general octree.h includes by specific ones. Only include what is necessary to minimize dependencies and reduce build times. * Remove leftover string comment
…ners. Using PCL_NO_PRECOMPILE in cpp files makes sense, since code has to be generated anyway. The scope of the preprocessor definition is the cpp file itself, so it doesn't pollute something. And since all classes are instantiated with other template parameter values, there is no duplicate code.
0e980d4
to
633343b
Compare
Just changed the comment you suggested, @taketwo. |
Thanks. The pipeline succeeded last time, so I cancelled this new build after changing comment. |
template class pcl::SupervoxelClustering<pcl::PointXYZRGBA>; | ||
template class PCL_EXPORTS pcl::SupervoxelClustering<pcl::PointXYZ>; | ||
template class PCL_EXPORTS pcl::SupervoxelClustering<pcl::PointXYZRGB>; | ||
template class PCL_EXPORTS pcl::SupervoxelClustering<pcl::PointXYZRGBA>; |
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.
@stefanbuettner Related #1909, why do we need to export these instantiation?
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.
Just gave it a try and I can compile this without PCL_EXPORTS on linux, with both PCL_NO_PRECOMPILE=ON and OFF.
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.
AFAIR PCL_EXPORTS
is mostly relevant for Windows. Every time you forget to add it to class declaration Windows users come and report unresolved symbols :D. But in this case PCL_EXPORTS
is already present in the declaration of SupervoxelClustering
, so indeed I don't see why we need it here.
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.
Maybe we should consider applying the same mechanism to *nix. See https://gcc.gnu.org/wiki/Visibility
At least we would be able to identify problems in advance in linux.
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.
Maybe... do you want this to become a 236th issue in this repository? 😢
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.
If I add it now it would only be 234 :) Nevertheless I think we should leave the idea there, so that "future people" remember it.
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 thought this should solve some unresolved symbols but from what I read while catching up on this issue, __declspec(dllexport)
is only needed for template function specializations and not for template class specializations. So the PCL_EXPORTS
probably shouldn't be there.
Hey there,
based on the mailing list issue Defining Octree Containers it seemed that the
PCL_NO_PRECOMPILE
mechanism was not fully implemented in the octree module.This PR should fix that and also tries to minimize the included headers by removing unnecessary ones and removing
#include <pcl/octree/octree.h>
throughout the library.For a non-working example prior to this PR see https://gist.github.com/stefanbuettner/0dcde8c6593dbb667ef74c60662cfafb.
Cheers,
Stefan