Error when trying to find the memory information on the GPU: unspecified launch failure

I have successfully installed Theano, a GPU optimized Python package for evaluating large scale mathematical expressions, on Windows 7 x64 for Python 3. When I was running theano.test(), the Python kernel died. Here’s part of the error messages, which are more related to CUDA than Theano as I believe:

....Error when tring to find the memory information on the GPU: unspecified launch failure
Error freeing device pointer 0000000200140000 (unspecified launch failure). Driver report zd bytes free and zd bytes total
CudaNdarray_uninit: error freeing self->devdata. (self=0000000024533B70, self->devata=0000000200140000)
Error when tring to find the memory information on the GPU: unspecified launch failure
Error freeing device pointer 0000000200140200 (unspecified launch failure). Driver report zd bytes free and zd bytes total
device_free: cudaFree() returned an error, but there is already an Python error set. This happen during the clean up when there is a first error and the CUDA driver is in a so bad state that it don't work anymore. We keep the previous error set to help debugging it.CudaNdarray_uninit: error freeing self->devdata. (self=0000000024533970, self->devata=0000000200140200)
Error when tring to find the memory information on the GPU: unspecified launch failure
Error freeing device pointer 0000000200140A00 (unspecified launch failure). Driver report zd bytes free and zd bytes total
device_free: cudaFree() returned an error, but there is already an Python error set. This happen during the clean up when there is a first error and the CUDA driver is in a so bad state that it don't work anymore. We keep the previous error set to help debugging it.CudaNdarray_uninit: error freeing self->devdata. (self=00000000240096F0, self->devata=0000000200140A00)
Error when tring to find the memory information on the GPU: unspecified launch failure
Error freeing device pointer 0000000200140C00 (unspecified launch failure). Driver report zd bytes free and zd bytes total
device_free: cudaFree() returned an error, but there is already an Python error set. This happen during the clean up when there is a first error and the CUDA driver is in a so bad state that it don't work anymore. We keep the previous error set to help debugging it.CudaNdarray_uninit: error freeing dev_structure memory 0000000200140C00 (self=00000000240096F0)
Error when trying to find the memory information on the GPU: unspecified launch failure

Any ideas for these errors? Thank you.

(unspecified launch failure) means usually too many threads per block or too many blocks, or there is not enough registers or shared memory available.

I also posted the question to Theano’s user group. Someone answered:

“2G is enough memory to run the tests. A more likely cause is if you are
using the GPU to drive your display as well.

If a GPU is used for display, then it is in a mode that prevents any
CUDA kernel to run from more than a certain amount of time (5s if I
recall correctly), any kernel not returning after that duration is
killed. Theano does not handle it well when kernels are killed, and the
following errors look like the ones you have (unspecified launch failure
for about anything). ”

Actually my laptop has Optimus, so I want to use the Intel HD Graphics 4000 to display, and use the GT650M to run CUDA programs. There’s a switch of cards in the NVIDIA Control Panel for 3D content:

I tried this switch but the program still halts. Any further ideas?