Skip to content

Commit 69a2392

Browse files
committed
Remove default(none) clause in some OpenMP for-loops
clang 17 complains that in these loops, some variables do not have an explicitly defined data sharing attribute, e.g. `Eigen::Dynamic` (which is a `const int`). Explicitly defining it as shared would be weird since the use of `Eigen::Dynamic` is not obvious in those loops, and would also likely lead to problems with other compilers because const variables are implicitly shared (at least in OpenMP versions < 4.0), and defining them explicitly as shared leads to compiler errors (see also http://jakascorner.com/blog/2016/07/omp-default-none-and-const.html). Removing default(none) solves the problem. Generally, the use of default(none) is recommended while writing the code because it forces the programmer to think about whether each variable should be shared or private, but since the code is already finished, removing default(none) should have no downsides.
1 parent c0c0064 commit 69a2392

File tree

8 files changed

+0
-8
lines changed

8 files changed

+0
-8
lines changed

apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ pcl::rec_3d_framework::GlobalNNCRHRecognizer<Distance, PointInT, FeatureT>::reco
297297

298298
// clang-format off
299299
#pragma omp parallel for \
300-
default(none) \
301300
shared(VOXEL_SIZE_ICP_, cloud_voxelized_icp) \
302301
num_threads(omp_get_num_procs())
303302
// clang-format on

apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,6 @@ pcl::rec_3d_framework::GlobalNNCVFHRecognizer<Distance, PointInT, FeatureT>::rec
456456

457457
// clang-format off
458458
#pragma omp parallel for \
459-
default(none) \
460459
shared(cloud_voxelized_icp, VOXEL_SIZE_ICP_) \
461460
num_threads(omp_get_num_procs())
462461
// clang-format on

apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/local_recognizer.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ pcl::rec_3d_framework::LocalRecognitionPipeline<Distance, PointInT, FeatureT>::
371371

372372
// clang-format off
373373
#pragma omp parallel for \
374-
default(none) \
375374
shared(cloud_voxelized_icp) \
376375
schedule(dynamic,1) \
377376
num_threads(omp_get_num_procs())

common/src/range_image.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,6 @@ RangeImage::getOverlap (const RangeImage& other_range_image, const Eigen::Affine
865865
float max_distance_squared = max_distance*max_distance;
866866

867867
#pragma omp parallel for \
868-
default(none) \
869868
shared(max_distance_squared, other_range_image, pixel_step, relative_transformation, search_radius) \
870869
schedule(dynamic, 1) \
871870
reduction(+ : valid_points_counter) \

keypoints/include/pcl/keypoints/impl/harris_3d.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,6 @@ pcl::HarrisKeypoint3D<PointInT, PointOutT, NormalT>::refineCorners (PointCloudOu
506506
Eigen::Vector3f NNTp;
507507
constexpr unsigned max_iterations = 10;
508508
#pragma omp parallel for \
509-
default(none) \
510509
shared(corners) \
511510
firstprivate(nnT, NNT, NNTp) \
512511
num_threads(threads_)

keypoints/src/narf_keypoint.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,6 @@ NarfKeypoint::calculateSparseInterestImage ()
478478

479479
//double interest_value_calculation_start_time = getTime ();
480480
#pragma omp parallel for \
481-
default(none) \
482481
shared(array_size, border_descriptions, increased_radius_squared, radius_reciprocal, radius_overhead_squared, range_image, search_radius, \
483482
surface_change_directions, surface_change_scores) \
484483
num_threads(parameters_.max_no_of_threads) \

tools/fast_bilateral_filter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ int
114114
batchProcess (const std::vector<std::string> &pcd_files, std::string &output_dir, float sigma_s, float sigma_r)
115115
{
116116
#pragma omp parallel for \
117-
default(none) \
118117
shared(output_dir, pcd_files, sigma_r, sigma_s)
119118
// Disable lint since this 'for' is part of the pragma
120119
// NOLINTNEXTLINE(modernize-loop-convert)

tools/normal_estimation.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ int
133133
batchProcess (const std::vector<std::string> &pcd_files, std::string &output_dir, int k, double radius)
134134
{
135135
#pragma omp parallel for \
136-
default(none) \
137136
shared(k, output_dir, pcd_files, radius)
138137
// Disable lint since this 'for' is part of the pragma
139138
// NOLINTNEXTLINE(modernize-loop-convert)

0 commit comments

Comments
 (0)