Dynamic List

Hi @ll,

i need a dynamic list. Is this possible in CUDA?
I can’t make a forecast how big my list can be.

Thanks in advance for reading and maybe answering.



Short answer is not really. Long answer depends on how exactly you use it…

I need this dynamic list for ->

i have a point and this point has neigbours.

The signed integer are the origin point after this one there are the neigbours till the next signed integer. This list will ne very big but i can’t make a real forecast.


I know in c++ a way but in c or cuda c programming ???



i am not firm with C.

so could i use a self made structure to solve this. any tip would help me.



there are algorithms for parallel processing and pointers (look up pointer jumping and there are variations of the bitonic sort which use pointers). These algorithms however use a fixed size pointer list and then reorder them, calculate the parent in trees etc. Handling variable size lists (as in the size will change during a kernel) are quite tricky. But I have to admit I would love to be proven wrong on this :"> , since it would love to use (efficient) dynamic lists myself on cuda.

It looks to me like you’re trying to store a representation of a graph. Is that correct? Depending on the range of sizes for your input, you could go the adjacency matrix (or some version of) way.

You can build a linked list in global memory from host code, by calling cudaMalloc and cudaMemcpy functions. My guess is that it’ll probably be pretty inefficient. Shared memory is another issue, as dynamic allocation is limited to the parameter supplied to a global function’s call.