I am using the thrust library for my project and ran into the following problem:
I have a struct called box defined as
typedef struct {
int coord[4];
float h;
} box;
and am now trying to copy data from a device_vector of boxes to a host_vector of boxes:
thrust::device_vector<box> d_boxes(100);
thrust::host_vector<box> h_boxes;
thrust::copy(d_boxes.begin(), d_boxes.end(), h_boxes.begin());
But this throws the error
terminate called after throwing an instance of 'thrust::system::system_error' what(): invalid argument
If I do the same with int instead of box, it works fine. Unfortunately, the documentation does not seem to have any example of vectors of custom data types.
What did I miss?
thrust::copy, just assignd_boxestoh_boxesin its initialization. - Jared Hoberock