CUDA SDK samples throw errors on application exit

When I compile & run the SDK samples in Debug mode, the application throws the following error when it exits:

First-chance exception at 0x7c812a5b in histogram256.exe: Microsoft C++ exception: cudaError_enum at memory location 0x0012fa60..

I can even reproduce this error in a program with only a single line of code in the main() function:

int main(int argc, char* argv[])

{

     cudaThreadSynchronize();

}

However in release mode there is no error thrown. This behaviour (within Debug mode) is very annoying as I usually break my program at exceptions in Visual Studio, and simply turning off exception-breaking for cudaError_enum is not an option, as this exception might also be thrown due to my own program errors.

Bump, as this also happens to me, however it happens in both Debug, Release, EmuDebug and EmuRelease. I haven’t tested with every sample, but it seems to happen for the ones I’ve looked at, in particular for histogram256, as well as for my own code. It also happens with just a cudaThreadSynchronize() call as Esdger posted.

The exact error I get is:
First-chance exception at 0x7c81eb33 (kernel32.dll) in histogram256.exe: Microsoft C++ exception: cudaError_enum at memory location 0x0012fc78…

Though the program usually runs fine and produces correct output, it’s a bit unnerving that this happens. Does anyone know the cause and solution? I’ve tried searching the forums but this post is the closest I got. I have an 8800gt running the 169 drivers.

I am getting the same error. I am running it on a Thinkpad T-61 with the Quadro NVS 140M. Anybody has any ideas. I am getting the error both with the Debug and Release mode.