Aidan Possemiers
Aidan Possemiers

Reputation: 25

CUDA thrust library and cudaDeviceReset()

When you call cudaDeviceReset() does that make any thrust::device_vectors in scope unusable?

thrust::host_vector<int> h_intVec;
thrust::device_vector<int> d_intVec;

... set the host vector to something...

d_intVec = h_intVec;

... do some GPU stuff ...

h_intVec = d_intVec;

cudaDeviceReset();

d_intVec = h_intVec;

I seem to get some back end error when I try to refill the device_vector is their something I don't know about going on?

Upvotes: 1

Views: 497

Answers (1)

Robert Crovella
Robert Crovella

Reputation: 151799

Yes, they are unusable.

Under the hood, a thrust::device_vector definition creates an allocation on the device. cudaDeviceReset voids all allocations on the device, so the original device_vector is no longer usable.

Upvotes: 4

Related Questions