Thrust::copy crashes on RTX 2060 with CUDA 11.2

When I use thrust::copy with the following code it crashes

typedef struct Point_2D
	float x_;
	float y_;
	__host__ __device__ Point_2D() : x_(0.0f), y_(0.0f) {}
thrust::device_vector<Point2D> d_Vector(max_size);  // max_size = 2554
thrust::host_vector<Point2D> h_Vector(max_size);   // max_size = 2554
// Kernel calls which does some operations on d_Vector
auto last_error = cudaPeekAtLastError();
if (last_error != cudaSuccess) {
   return false;
thrust::copy(d_Vector.begin(), d_Vector.end(), h_Vector.begin());  // crashes

I recently upgraded my CUDA library to 11.2. Before I was using 9.2.

This particular code runs on a laptop equipped with GTX 1070, RTX 3070 without any error but fails to run on RTX 2060.
But before with CUDA 9.2, I didn’t have any problem running on RTX 2060.

I am using VS 2017 to build my code. And in Properties > CUDA C/C++ > Device > Code Generation, I have the following compute capability set.


Can anybody please help me out in resolving this issue?
Please let me know if I can provide you with any more information.

I’ll repeat what I said when you asked this on the thrust mailing list:

thrust::copy may be having trouble due to errors in your kernel calls.

Add a:


statement before:

auto last_error = cudaPeekAtLastError();

With adding cudaDeviceSynchronize() I can know what is the error in Kernel. Now it does not crash. I have to debug the CUDA kernel.

Thanks for your help.