Have a video processing system I’ve been working on for some time, and now adding some capability via FFT’s. Ran into an issue where I would get an execution error, and eventually tracked it down to a cudaMemsetAsync that was writing twice as many bytes as it should have (don’t know how that hasn’t impacted something else to this point…). Now I’m getting another error that’s more confusing.
I have an object that does some processing, and the code runs fine before and after it’s creation. However, if I delete that object during processing (essentially turning that feature off), I see the Visual Studio warning me of the aforementioned exception. Started stripping down the object to see if perhaps I was over writing more memory, but what it boiled down to was the simple allocation for a device pointer. Even though it was never used (the code that used it got commented out), the very allocation of that variable’s memory cause the object to have cuda throw this exception when the object was deleted much later. If I commented that line out, every thing worked fine (of course the underlying algorithms didn’t work 'cause it wasn’t doing its job). And it turns out, that if one of these exceptions are thrown, the CUFFT executions will not work. The FFTs work before that ‘rogue’ object was created, they work fine after it’s created, but start failing the instant the object is deleted (the FFT’s are done in another object and have nothing to do this this object). If I turn off the other feature requiring the FFT, and uncomment all the code I commented out for debugging in the ‘rogue’ object, it runs fine and I can create and destroy that object hundred’s of times with no problem.
At first I though perhaps another function somewhere else was writing into that guy’s space, but several other allocations happen after the one the causes the problems, testing shows whether they were allocated or not didn’t cause the exception to be thrown. As a backup, ran cuda-memcheck on the application, but it showed zero errors.
Looked at several threads on these forums but most are quite old, or discuss code that can’t run. My code (minus the newly added FFT part) seems to run fine with the errors. I also get exceptions thrown when running the FFT plans, but that doesn’t stop them from executing until this object gets deleted.
Any comments about what can cause this exception to get thrown on destruction of an object that uses device memory allocations? On many occasions I’ve done the double free and free empties, but this is something else.