I was using this vector of vector approach in CUDA since I am still used to Matlab and Python style programming environment. I was able to extract data from host side in the device vectors but now I am not sure how to access that data, for example, for printing. I tried using iterators but it I get error saying device_reference has no member "begin" or "end".
(Using VS 2010 with CUDA Toolkit 5.0)
thrust::device_vector<thrust::device_vector<int>> kmers;
//Do some stuff here to fill kmers
//
//
thrust::device_vector<thrust::device_vector<int>>::iterator ii;
thrust::device_vector<int>::iterator i;
for (ii = kmers.begin();ii!=kmers.end();++ii)
{
for (i = (*ii).begin(); i != (*ii).end(); i++){
std::cout << (*i) << "\n";
}
}
Any advice? Edit: I understand that thrust containers currently cannot be directly passed on to CUDA kernels. Are there any other libraries/containers which would allow me to do so?
AFAIK there were limitations in the CUDA back-end that prevented vectors of vectors from being usable.
Not sure if this was addressed in CUDA 6.0 but it surely wasn't in CUDA 5.0
You'll have to linearize your vector.