This project is read-only.

Program hangs at free() or memory copy functions

Nov 30, 2012 at 7:32 PM


I am calling 4 different kernels in a sequence. At the begin of each sequence I am copyind data onto the device. At the end of each sequence I am copying data from the device. I am repeating this squence thousands of times. At arbitrary point in time the program hangs at funtions such as:




What could cause this? Any suggestions?



Dec 1, 2012 at 10:09 AM


I hope you call Free after CopyFromDevice...?

Are you making use of async launches and/or copies?

Monitor system and GPU memory usage to check for leaks. If you use CopyToDevice(hostVariable) memory on GPU is allocated automatically each time.


Dec 2, 2012 at 2:03 AM

Christian, what do you mean by "the program hangs" ? It gives an error/exception, or stops responding altogether?

Dec 5, 2012 at 2:23 PM


I looked into this issue again. The memory copy function are called in the right order.

I have added a gpu.Synchronize() after the last kernel call before I conduct memory operations. Now the program sporadicaly stops at the Syncronize() function. It "hangs" there. Meaning the issue might be within the kernels.

Any ideas? I checked with CUDA-memcheck but couldn't diagnose any errors.








Dec 5, 2012 at 2:59 PM

Christian, Best to simplify your kernel until the problem no longer appears then go back a step. Without seeing your kernel difficult to say much else. Nick