From ec0f0b78b2795622b0a2607b17f67ffd4d39ebb9 Mon Sep 17 00:00:00 2001 From: Jan Lebert Date: Fri, 8 Dec 2023 16:01:14 -0800 Subject: [PATCH 1/2] Fix unused variable error when OpenMP is disabled Occurs on macOS Sonoma when building without OpenMP. Fixes #6514 --- cpp/open3d/pipelines/registration/Feature.cpp | 2 ++ cpp/open3d/t/pipelines/registration/Feature.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/cpp/open3d/pipelines/registration/Feature.cpp b/cpp/open3d/pipelines/registration/Feature.cpp index c4441a27005..3a4fe8ee279 100644 --- a/cpp/open3d/pipelines/registration/Feature.cpp +++ b/cpp/open3d/pipelines/registration/Feature.cpp @@ -157,6 +157,8 @@ CorrespondenceSet CorrespondencesFromFeatures(const Feature &source_features, const int kOuterThreads = std::min(kMaxThreads, num_searches); const int kInnerThreads = std::max(kMaxThreads / num_searches, 1); + (void)kOuterThreads; + (void)kInnerThreads; #pragma omp parallel for num_threads(kOuterThreads) for (int k = 0; k < num_searches; ++k) { geometry::KDTreeFlann kdtree(features[1 - k]); diff --git a/cpp/open3d/t/pipelines/registration/Feature.cpp b/cpp/open3d/t/pipelines/registration/Feature.cpp index 81ddfb87e13..603f76ba8fa 100644 --- a/cpp/open3d/t/pipelines/registration/Feature.cpp +++ b/cpp/open3d/t/pipelines/registration/Feature.cpp @@ -102,6 +102,7 @@ core::Tensor CorrespondencesFromFeatures(const core::Tensor &source_features, const int kMaxThreads = utility::EstimateMaxThreads(); const int kOuterThreads = std::min(kMaxThreads, num_searches); + (void)kOuterThreads; // corres[0]: corres_ij, corres[1]: corres_ji #pragma omp parallel for num_threads(kOuterThreads) From 700c3e2dc669857ce99a91ed6e066a0763ffd717 Mon Sep 17 00:00:00 2001 From: Jan Lebert Date: Sat, 9 Dec 2023 19:23:04 -0800 Subject: [PATCH 2/2] Add code comment for clarity --- cpp/open3d/pipelines/registration/Feature.cpp | 3 +-- cpp/open3d/t/pipelines/registration/Feature.cpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cpp/open3d/pipelines/registration/Feature.cpp b/cpp/open3d/pipelines/registration/Feature.cpp index 3a4fe8ee279..2815159dcc4 100644 --- a/cpp/open3d/pipelines/registration/Feature.cpp +++ b/cpp/open3d/pipelines/registration/Feature.cpp @@ -154,10 +154,9 @@ CorrespondenceSet CorrespondencesFromFeatures(const Feature &source_features, std::vector corres(num_searches); const int kMaxThreads = utility::EstimateMaxThreads(); - const int kOuterThreads = std::min(kMaxThreads, num_searches); const int kInnerThreads = std::max(kMaxThreads / num_searches, 1); - (void)kOuterThreads; + (void)kOuterThreads; // Avoids compiler warning if OpenMP is disabled (void)kInnerThreads; #pragma omp parallel for num_threads(kOuterThreads) for (int k = 0; k < num_searches; ++k) { diff --git a/cpp/open3d/t/pipelines/registration/Feature.cpp b/cpp/open3d/t/pipelines/registration/Feature.cpp index 603f76ba8fa..d20e1a1b58c 100644 --- a/cpp/open3d/t/pipelines/registration/Feature.cpp +++ b/cpp/open3d/t/pipelines/registration/Feature.cpp @@ -102,7 +102,7 @@ core::Tensor CorrespondencesFromFeatures(const core::Tensor &source_features, const int kMaxThreads = utility::EstimateMaxThreads(); const int kOuterThreads = std::min(kMaxThreads, num_searches); - (void)kOuterThreads; + (void)kOuterThreads; // Avoids compiler warning if OpenMP is disabled // corres[0]: corres_ij, corres[1]: corres_ji #pragma omp parallel for num_threads(kOuterThreads)