Hi,
Did you get any prints (in stderr) before the error that would hint at what is the issue?
Also you can rerun your code while setting the CUDA_LAUNCH_BLOCKING=1 environment variable to make sure that the line showed by the stack trace is relevant (the API is asynchronous by default and so it most likely points to the wrong line right now).