Memory problems


I am working in a project and I have some troubles for few days. I will start by the one which appear now.

I do a cudaMemset after a cudaMalloc and I get this error : “all CUDA-capable devices are busy or unavailable”. But there is not other process running on my GPU. How can I reset my GPU (I have a GeForce GTX 580). Or do you know where the problem may come from?

Moreover, I use cudaResetDevice() at the beginning and the end of the main, is it a good idea?
One last comment, this problem doesn’t appear every time and in fact it often appears when I launch a second process or when I launch the program with cuda-gdb.

Thanks for your help


try using cudaSetDevice(0) at the beginning.

Unfortunately it changes nothing. It is strange because this error appears only with cuda-gdb. If I run my program without cuda-gdb I don’t have this error but an other one (Yes I have a lot of troubles actually). Is it a bug of cuda-gdb?

Did you remove the cudaDeviceReset in the beginning?

I didn’t but know I changed it. I think it changed nothing. But I reboot the machine and it seems to work now. It is magic. I hope to not have other problems but I am not sure because I don’t think of the magic in programming.

Thanks for answering me.