I have something stored in std::map, which maps string to vector. Its keys and values looks like
key value "a"-----[1,2,3] "b"-----[8,100] "cde"----[7,10] For each thread, it needs to process one query. The query looks like
["a", "b"] or
["cde", "a"] So I need to get the value from the map and then do some other jobs like combine them. So as for the first query, the result will be
[1,2,3,8,100] The problem is, how can threads access the map and find the value by a key?
At first, I tried to store it in global memory. However, It looks like it can only pass arrays from host to device.
Then I tried to use thrust, but I can only use it to store vector.
Is there any other way I can use? Or maybe I ignored some methods in thrust? Thanks!
**Ps: I do not need to modify the map, I just need to read data from it.
std::map. But OP also states: "At first, I tried to store it in global memory. However, It looks like it can only pass arrays from host to device." In whatever way OP decided that arrays could be passed from host to device, I am claiming that similar arrays can also be passed from device to host. I am not referring tostd::mapspecifically here, and with respect to the quotation I have excerpted, I don't believe OP was referring specifically tostd::mapthere either, when OP used the non-specific word "arrays". I stand by my statement.std::mapin device code. However you should be able to realize an alternate form ofstd::mapwith an array of keys and an array of values, and create the resultant arrays just as OP is describing. The resultant arrays desired by the OP don't appear to be any part of astd::mapthat I can tell.