CUDA推力库和cudaDeviceReset()

CUDA thrust library and cudaDeviceReset()

本文关键字:cudaDeviceReset CUDA      更新时间:2023-10-16

当您调用cudaDeviceReset()时,是否会使作用域中的任何推力::device_vector不可用?

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;

当我试图重新填充设备时,我似乎遇到了一些后端错误_vector是我不知道的事情吗?

是的,它们不可用。

在引擎盖下,thrust::device_vector定义在设备上创建一个分配。cudaDeviceReset将清空设备上的所有分配,因此原始的device_vector不再可用。