I get some data from a library on the host as a pointer to an array. How do I create a device_vector that holds this data on the device?
int* data;
int num;
get_data_from_library( &data, &num );
thrust::device_vector< int > iVec; // How to construct this from data?
As per this answer, all you need is:
int* data;
int num;
get_data_from_library( &data, &num );
thrust::device_vector< int > iVec(data, data+num);
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