Hi,
I am currently looking at tree and have the following structure
typedef struct nd{
short int final;
char number;
struct nd *child[2];
}node;
So my plan was to build the tree on the GPU, I get how to allocate memory, since I know exactly how many nodes I will have in there and can therefor avoid synchronisation, although I don’t see how to build the tree on the GPU.
Can I simply make some code like :
__global__ void Tree((node * tree, int size)) {
--> That's the part where I'm actually stuck. How can I build my tree here
}
int main(int argc, char **argv){
[...]
cudaMalloc( (void**)&treeCUDA, sizeof(node)*256*256 );
Tree<<<1,256>>>(treeCUDA, size);
[...]
}
Thanks for the help, I have also read that a tree could be contained in an array, are there any examples anywhere on how to do that ?
Thanks.