vcpkg/ports/pcl/fix-namespace-cub.patch
Frank b9bd699e64
[PCL] Fix namespace and VS2022 error C3052 (#23273)
* Fix namespace clashing between cub and thrust::cub.

Fix VS2022 error C3052: 'k': variable doesn't appear in a data-sharing clause under a default(none) clause

* update version
2022-02-28 13:54:28 -08:00

131 lines
5.2 KiB
Diff

diff --git a/gpu/features/src/centroid.cu b/gpu/features/src/centroid.cu
index 045fe6f..3e9ef8b 100644
--- a/gpu/features/src/centroid.cu
+++ b/gpu/features/src/centroid.cu
@@ -44,7 +44,6 @@
#include "pcl/gpu/utils/device/vector_math.hpp"
-using namespace thrust;
namespace pcl
{
@@ -124,9 +123,10 @@ float3 pcl::device::getMaxDistance(const DeviceArray<PointT>& cloud, const float
thrust::counting_iterator<int> ce = cf + cloud.size();
thrust::tuple<float, int> init(0.f, 0);
- thrust::maximum< tuple<float, int> > op;
+ thrust::maximum<thrust::tuple<float, int>> op;
- tuple<float, int> res = transform_reduce(
+ thrust::tuple<float, int> res =
+ transform_reduce(
make_zip_iterator(make_tuple( src_beg, cf )),
make_zip_iterator(make_tuple( src_beg, ce )),
TupleDistCvt(pivot), init, op);
@@ -151,9 +151,9 @@ float3 pcl::device::getMaxDistance(const DeviceArray<PointT>& cloud, const Indic
thrust::counting_iterator<int> ce = cf + indices.size();
thrust::tuple<float, int> init(0.f, 0);
- thrust::maximum< tuple<float, int> > op;
+ thrust::maximum<thrust::tuple<float, int>> op;
- tuple<float, int> res = transform_reduce(
+ thrust::tuple<float, int> res = transform_reduce(
make_zip_iterator(make_tuple( make_permutation_iterator(src_beg, map_beg), cf )),
make_zip_iterator(make_tuple( make_permutation_iterator(src_beg, map_end), ce )),
TupleDistCvt(pivot), init, op);
diff --git a/gpu/octree/src/cuda/bfrs.cu b/gpu/octree/src/cuda/bfrs.cu
index d392f67..0635e1e 100644
--- a/gpu/octree/src/cuda/bfrs.cu
+++ b/gpu/octree/src/cuda/bfrs.cu
@@ -43,7 +43,6 @@
#include "cuda.h"
-using namespace thrust;
namespace pcl
{
@@ -80,11 +79,11 @@ void pcl::device::bruteForceRadiusSearch(const OctreeImpl::PointCloud& cloud, co
InSphere cond(query.x, query.y, query.z, radius);
- device_ptr<const PointType> cloud_ptr((const PointType*)cloud.ptr());
- device_ptr<int> res_ptr(buffer.ptr());
+ thrust::device_ptr<const PointType> cloud_ptr((const PointType*)cloud.ptr());
+ thrust::device_ptr<int> res_ptr(buffer.ptr());
- counting_iterator<int> first(0);
- counting_iterator<int> last = first + cloud.size();
+ thrust::counting_iterator<int> first(0);
+ thrust::counting_iterator<int> last = first + cloud.size();
//main bottle neck is a kernel call overhead/allocs
//work time for 871k points ~0.8ms
diff --git a/gpu/octree/src/cuda/octree_builder.cu b/gpu/octree/src/cuda/octree_builder.cu
index dfd2093..faad764 100644
--- a/gpu/octree/src/cuda/octree_builder.cu
+++ b/gpu/octree/src/cuda/octree_builder.cu
@@ -51,7 +51,6 @@
#include <thrust/device_ptr.h>
using namespace pcl::gpu;
-using namespace thrust;
namespace pcl
{
@@ -316,7 +315,7 @@ void pcl::device::OctreeImpl::build()
// 3 * sizeof(int) => +1 row
const int transaction_size = 128 / sizeof(int);
- int cols = max<int>(points_num, transaction_size * 4);
+ int cols = std::max<int>(points_num, transaction_size * 4);
int rows = 10 + 1; // = 13
storage.create(rows, cols);
@@ -338,8 +337,8 @@ void pcl::device::OctreeImpl::build()
{
//ScopeTimer timer("reduce-morton-sort-permutations");
- device_ptr<PointType> beg(points.ptr());
- device_ptr<PointType> end = beg + points.size();
+ thrust::device_ptr<PointType> beg(points.ptr());
+ thrust::device_ptr<PointType> end = beg + points.size();
{
PointType atmax, atmin;
@@ -355,15 +354,15 @@ void pcl::device::OctreeImpl::build()
octreeGlobal.maxp = make_float3(maxp.x, maxp.y, maxp.z);
}
- device_ptr<int> codes_beg(codes.ptr());
- device_ptr<int> codes_end = codes_beg + codes.size();
+ thrust::device_ptr<int> codes_beg(codes.ptr());
+ thrust::device_ptr<int> codes_end = codes_beg + codes.size();
{
//ScopeTimer timer("morton");
thrust::transform(beg, end, codes_beg, CalcMorton(octreeGlobal.minp, octreeGlobal.maxp));
}
- device_ptr<int> indices_beg(indices.ptr());
- device_ptr<int> indices_end = indices_beg + indices.size();
+ thrust::device_ptr<int> indices_beg(indices.ptr());
+ thrust::device_ptr<int> indices_end = indices_beg + indices.size();
{
//ScopeTimer timer("sort");
thrust::sequence(indices_beg, indices_end);
@@ -378,9 +377,9 @@ void pcl::device::OctreeImpl::build()
}
{
- device_ptr<float> xs(points_sorted.ptr(0));
- device_ptr<float> ys(points_sorted.ptr(1));
- device_ptr<float> zs(points_sorted.ptr(2));
+ thrust::device_ptr<float> xs(points_sorted.ptr(0));
+ thrust::device_ptr<float> ys(points_sorted.ptr(1));
+ thrust::device_ptr<float> zs(points_sorted.ptr(2));
//ScopeTimer timer("perm2");
thrust::transform(make_permutation_iterator(beg, indices_beg),
make_permutation_iterator(end, indices_end),