norlab-ulaval / libnabo

A fast K Nearest Neighbor library for low-dimensional spaces
http://norlab-ulaval.github.io/libnabo/
BSD 3-Clause "New" or "Revised" License
431 stars 142 forks source link

OpenCL disabled #12

Open skn123 opened 10 years ago

skn123 commented 10 years ago

In the Master. Why? If i forcefully enable it I get some errors like this: F:\Sources\libnabo\nabo\nabo.cpp: In instantiation of 'static Nabo::NearestNeigh bourSearch* Nabo::NearestNeighbourSearch::create(const Matrix&, Nabo::Near estNeighbourSearch::Index, Nabo::NearestNeighbourSearch::SearchType, unsig ned int, const Nabo::Parameters&) [with T = float; Nabo::NearestNeighbourSearch< T>::Matrix = Eigen::Matrix<float, -1, -1>; Nabo::NearestNeighbourSearch::Inde x = int]': F:\Sources\libnabo\nabo\nabo.cpp:162:18: required from here F:\Sources\libnabo\nabo\nabo.cpp:126:132: error: cannot allocate an object of ab stract type 'Nabo::KDTreeBalancedPtInNodesStackOpenCL' case KDTREE_CL_PT_IN_NODES: return new KDTreeBalancedPtInNodesStackOpenCL (cloud, dim, creationOptionFlags, CL_DEVICE_TYPE_GPU);

                                                ^

In file included from F:\Sources\libnabo\nabo\nabo.cpp:33:0: F:\Sources\libnabo\nabo\nabo_private.h:351:9: note: because the following virt ual functions are pure within 'Nabo::KDTreeBalancedPtInNodesStackOpenCL':

struct KDTreeBalancedPtInNodesStackOpenCL: public OpenCLSearch ^ In file included from F:\Sources\libnabo\nabo\nabo.cpp:32:0: F:\Sources\libnabo\nabo\nabo.h:331:25: note: long unsigned int Nabo::NearestN eighbourSearch::knn(const Matrix&, Nabo::NearestNeighbourSearch::IndexMatr ix&, Nabo::NearestNeighbourSearch::Matrix&, const Vector&, Nabo::NearestNeigh bourSearch::Index, T, unsigned int) const [with T = float; Nabo::NearestNeigh bourSearch::Matrix = Eigen::Matrix<float, -1, -1>; Nabo::NearestNeighbourSear ch::IndexMatrix = Eigen::Matrix<int, -1, -1>; Nabo::NearestNeighbourSearch ::Vector = Eigen::Matrix<float, -1, 1>; Nabo::NearestNeighbourSearch::Index = int] virtual unsigned long knn(const Matrix& query, IndexMatrix& indices, Matrix& dists2, const Vector& maxRadii, const Index k = 1, const T epsilon = 0, const un signed optionFlags = 0) const = 0; ^ F:\Sources\libnabo\nabo\nabo.cpp:127:134: error: cannot allocate an object of ab stract type 'Nabo::KDTreeBalancedPtInLeavesStackOpenCL' case KDTREE_CL_PT_IN_LEAVES: return new KDTreeBalancedPtInLeavesStackOpenCL< T>(cloud, dim, creationOptionFlags, CL_DEVICE_TYPE_GPU);

simonlynen commented 10 years ago

@skn123 the OpenCL support is experimental and not actively developed. As you can see from the errors there are some interface changes in the main version which did not get ported to the OpenCL version. If you can bring in the required changes to make it work on your machine, we are happy to accept pull-requests.

skn123 commented 10 years ago

@simonlynen Thanks. I will look into it. However, I need a few questions to be answered: What is the max. data size that will work for this algorithm; both the # of samples (rows) as well as the dimensions (the columns). Secondly, rather than interfacing the OpenCL version from Fabo, would it be feasible to hive this off as a separate folder within Fabo? Let it be called FaboCL so that Fabo remains a pure CPU implementation. Also, if you have Fabo, why do you need FLANN?

simonlynen commented 10 years ago

@skn123