This is somewhat related to my previous question. After some searching, I came to the conclusion that I need a map with integer numbers as keys and memory-intensive structures as values. But I can’t find any good example on how to implement it?
I need to get value by key, insert key-value pair and get the total count of pairs. I saw cuda-thrust-extensions
, but that’s not really what I need.
Maybe I should write a custom kernel for this and not use Thrust?
Thank you, and sorry if my question seems stupid.
Are all your values of the same size? Do all your values actually have to be copied into the data structure? Or do they already exist in memory? Or would it be simpler to load them contiguously into memory like a stream.
You could store an index or a pointer to the actual value. You could in addition store a hash value.
Yes, that’s a good idea, thank you!
If you store them as stream, it could still make sense to align the values at 32-byte boundaries for performant accesses.
Optionally later on, you could use int4 or float4 memory accesses and access one value per thread (16-byte accesses) or one value per 2 threads (to get 32-byte accesses), with 32 threads accessing different values in parallel.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.