For example I have array of (x,y) points and I want to organize them in kd-tree
Building kd-tree includes sorting and computing bounding boxes. These algorithms work fine on CUDA, but is there any way to build kd-tree utilizing as many threads as possible?
I think there should be some tricks:
Usually, kd-tree is implemented with recursion, but as far as I know, CUDA processors don't have hardware stack, so recursion should be avoided.
How can I build kd-tree in Cuda effectively?
Because a d-dimensional kd-tree for a set of n points is a binary tree with n leaves, it uses O(n) storage. The construction time is O(n logn).
In order to construct a balanced k-d Tree, each node should split the space such that there are an equal number of nodes in the left subspace as the right subspace. Therefore we need to pick the median among the nodes for the current dimension and make it the subroot.
A K-D Tree(also called as K-Dimensional Tree) is a binary search tree where data in each node is a K-Dimensional point in space. In short, it is a space partitioning(details below) data structure for organizing points in a K-Dimensional space.
You might want to have a look at the following papers:
Stackless KD-Tree Traversal for High Performance GPU Ray Tracing
Real-Time KD-Tree Construction on Graphics Hardware
They might help you along. Google them and you'll find them available online.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With