pcl icon indicating copy to clipboard operation
pcl copied to clipboard

Make omp naming and functionality consistent.

Open larshg opened this issue 6 months ago • 7 comments

larshg avatar Jun 13 '25 20:06 larshg

An idea: how about, instead of having unsigned int num_threads_{1}; in so many classes, we move that to PCLBase? That would have the additional benefit that there is no ABI break every time parallelization is added to a class (like in the two recent PRs).

As a second step, we could then discuss also moving setNumberOfThreads to PCLBase (to reduce code duplication), however that would make it less clear which classes actually use this setting.

mvieth avatar Jun 14 '25 12:06 mvieth

An idea: how about, instead of having unsigned int num_threads_{1}; in so many classes, we move that to PCLBase? That would have the additional benefit that there is no ABI break every time parallelization is added to a class (like in the two recent PRs).

As a second step, we could then discuss also moving setNumberOfThreads to PCLBase (to reduce code duplication), however that would make it less clear which classes actually use this setting.

Yeah, It seems PCLBase is used for all algorithms, so could make sense. I'm not sure how we should do it with setNumberOfThreads. Not sure if it its enough, just documenting, that not all classes make use of the set value.

larshg avatar Jun 16 '25 18:06 larshg

Should we default to using omp_get_num_procs() threads instead of 1 - I would expect code to be multithreaded by default 😄

larshg avatar Jun 16 '25 20:06 larshg

I'm not sure how we should do it with setNumberOfThreads. Not sure if it its enough, just documenting, that not all classes make use of the set value.

I am also fine with setNumberOfThreads staying in each parallelized class.

Should we default to using omp_get_num_procs() threads instead of 1 - I would expect code to be multithreaded by default 😄

Sounds good to me. How are you planning to do that? Calling setNumberOfThreads(0) in each constructor?

mvieth avatar Jun 17 '25 07:06 mvieth

Should SampleConsensus inherit from PCLBase as well?

The I/O Imagegrabber also has parallelizing, but should they also inherit from PCLBase? The Brieft from PCLBase: PCL base class. Implements methods that are used by most PCL algorithms.

So I guess I/O shouldn't, but SampleConsesus could(Should)?

larshg avatar Jun 17 '25 12:06 larshg

Should SampleConsensus inherit from PCLBase as well?

The I/O Imagegrabber also has parallelizing, but should they also inherit from PCLBase? The Brieft from PCLBase: PCL base class. Implements methods that are used by most PCL algorithms.

So I guess I/O shouldn't, but SampleConsesus could(Should)?

I think I would not change any inheritance. SampleConsensus and the image grabber can then simply keep their own num_threads_ member.

mvieth avatar Jun 17 '25 14:06 mvieth

Rebased to include the update to search https://github.com/PointCloudLibrary/pcl/pull/6284

larshg avatar Sep 18 '25 10:09 larshg