I am new to cuda and I would like to pass from my cpp program vector of struct to thrust “type” vector"
Assistance will be appreciated.
The call from cpp to my cu file is as following:
int _declspec(dllexport) run_on_cuda(CPictureData* cpp_vec, int number_of_elements)
Why not use thrust::host_vector in lieu of std::vector?
inside your run_on_cuda procedure, the following should work:
thrust::device_vector d_vec(cpp_vec, cpp_vec+number_of_elements);
This assumes previously in the same file you have:
A thrust::host_vector can be constructed in a similar fashion.
More information about thrust:
thanks! this seems to work…