CUDA 推力库和 cudaDeviceReset()
CUDA thrust library and cudaDeviceReset()
当您调用 cudaDeviceReset() 时,是否会使范围内的任何 thrust::device_vectors 不可用?
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;
当我尝试重新填充 device_vector 时,我似乎遇到了一些后端错误,我不知道他们在做什么?
是的,它们无法使用。
在幕后,thrust::device_vector 定义在设备上创建分配。 cudaDeviceReset
使设备上的所有分配无效,因此原来的 device_vector 不再可用。
当您调用 cudaDeviceReset() 时,是否会使范围内的任何 thrust::device_vectors 不可用?
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;
当我尝试重新填充 device_vector 时,我似乎遇到了一些后端错误,我不知道他们在做什么?
是的,它们无法使用。
在幕后,thrust::device_vector 定义在设备上创建分配。 cudaDeviceReset
使设备上的所有分配无效,因此原来的 device_vector 不再可用。