Is it possible to use push_back with Thrust library? and what about a vector of vectors? I would like to use in the GPU what in the CPu is:
vector< vector<int> > MyVector( 100 );
...
MyVector[i].push_back(j);
Is there a way to use it like for example:
thrust::device_vector<thrust::device_vector<int>> d_vec(4);
and what about creating an array of device_vectors? Is it possible?
thrust::device_vector
has a push_back
method just like a std::vector
.device_vector
containing device_vectors
. If you need that sort of functionality in thrust I would recommend looking at thrust::zip_iterator
which can provide "array of structures" like access to a series of distinct vectors or iterators.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With