Dynamic array creation

Mar 6, 2013 at 1:44 PM

Is there any way to create dynamic arrays using cudafy ?
I want to create an array and go increasing his size with time

Mar 8, 2013 at 8:38 PM
No, not really. You would need to manually manage your memory to achieve something like this.
Mar 10, 2013 at 8:40 AM
Isn't there though? I think the code I posted in the patch area allowed creating arrays or something like that... take a peek if it doesn't maybe it will help point you in the right direction.
Mar 13, 2013 at 8:28 PM
I asked that because I need to implement a hashtable.
Somebody here already did that?

Mar 14, 2013 at 5:25 PM
Are you sure you want to do that on the GPU? It just seems so wrong.
You only have a handful of registers per thread, and a very limited amount of shared memory within a block.
You should only run very specialized inner-loop algos on a GPU.
If you're sure, then you ought to alloc a fixed-size array, able to hold whatever you want to store in it, and keep its actual length in another variable. You'd have to consider where you'd want it stored - shared or device memory. Each have their issues, and are totally dependent on your particular requirements.
Then, remember that within the GUP, it's all about thread concurrency - you'll have to be really careful to avoid racing conditions when using your hashtable.
As for a hashtable implementation, well, it's usually a mixture of a hashing algorithm - which is entirely dependent on what your keys are made of - and (usually) a sorted list. There are countless examples of it on the web.
I know I'm being vague, but your question is very generic.