cudaThreadSynchronize() error

I have a strange problem about this function.I use it in my code after the kernel.But when I debug the code step by step ,it often exit automatically at cudaThreadSynchronize().And the output window shows :cudaerror_enum occurs in memory 0x00125750.


 //copy device result to host



Who knows the reason?

You can try and use checkCUDAError() function. You could use it after the kernel call and see whether the kernel is properly executed or not.