From f67880d0f95487c1747645fdab0762ce1c73b02e Mon Sep 17 00:00:00 2001 From: Markus Vieth Date: Tue, 4 Feb 2025 20:15:07 +0100 Subject: [PATCH] Small fixes - C++20 and later provides std::lerp, in that case our definition may collide - the SSE and AVX flags are not passed to the CUDA compiler (NVCC), so it often displays the new alignment warning -> silenced on NVCC - thrust::unary_function is deprecated in the newest thrust/cuda release. Luckily, it is easily replaced with two typedefs --- benchmarks/search/radius_search.cpp | 2 +- common/include/pcl/memory.h | 2 +- cuda/common/include/pcl/cuda/cutil_math.h | 3 +++ gpu/utils/include/pcl/gpu/utils/device/functional.hpp | 5 +++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/benchmarks/search/radius_search.cpp b/benchmarks/search/radius_search.cpp index 9641375bed3..12336a8f95f 100644 --- a/benchmarks/search/radius_search.cpp +++ b/benchmarks/search/radius_search.cpp @@ -26,7 +26,7 @@ BM_OrganizedNeighborSearch(benchmark::State& state, const std::string& file) int searchIdx = indices[radiusSearchIdx++ % indices.size()]; double searchRadius = 0.1; // or any fixed radius like 0.05 - std::vector k_indices; + pcl::Indices k_indices; std::vector k_sqr_distances; auto start_time = std::chrono::high_resolution_clock::now(); diff --git a/common/include/pcl/memory.h b/common/include/pcl/memory.h index b8bef5a25fe..98d1d9b45f2 100644 --- a/common/include/pcl/memory.h +++ b/common/include/pcl/memory.h @@ -52,7 +52,7 @@ #include // for std::enable_if_t, std::false_type, std::true_type #include // for std::forward -#if !defined(PCL_SILENCE_MALLOC_WARNING) +#if !defined(PCL_SILENCE_MALLOC_WARNING) && !defined(__NVCC__) #if PCL_USES_EIGEN_HANDMADE_ALIGNED_MALLOC // EIGEN_DEFAULT_ALIGN_BYTES and EIGEN_MALLOC_ALREADY_ALIGNED will be set after including Eigen/Core // this condition is the same as in the function aligned_malloc in Memory.h in the Eigen code diff --git a/cuda/common/include/pcl/cuda/cutil_math.h b/cuda/common/include/pcl/cuda/cutil_math.h index 6b6b0c21b34..466bb84cffb 100644 --- a/cuda/common/include/pcl/cuda/cutil_math.h +++ b/cuda/common/include/pcl/cuda/cutil_math.h @@ -1001,10 +1001,13 @@ inline __host__ __device__ uint4 max(uint4 a, uint4 b) // - linear interpolation between a and b, based on value t in [0, 1] range //////////////////////////////////////////////////////////////////////////////// +#if !defined(__cplusplus) || (__cplusplus < 202002L) +// C++20 and higher provides std::lerp inline __device__ __host__ float lerp(float a, float b, float t) { return a + t*(b-a); } +#endif inline __device__ __host__ float2 lerp(float2 a, float2 b, float t) { return a + t*(b-a); diff --git a/gpu/utils/include/pcl/gpu/utils/device/functional.hpp b/gpu/utils/include/pcl/gpu/utils/device/functional.hpp index c4e8b1b5e4b..743c4cf942c 100644 --- a/gpu/utils/include/pcl/gpu/utils/device/functional.hpp +++ b/gpu/utils/include/pcl/gpu/utils/device/functional.hpp @@ -46,7 +46,6 @@ namespace pcl { // Function Objects - using thrust::unary_function; using thrust::binary_function; // Arithmetic Operations @@ -79,8 +78,10 @@ namespace pcl using thrust::bit_or; using thrust::bit_xor; - template struct bit_not : unary_function + template struct bit_not { + typedef T argument_type; + typedef T result_type; __forceinline__ __device__ T operator ()(const T& v) const {return ~v;} };