cudaDeviceReset() destroys all memory allocations on the device (among other things).
~SimulationCudaFacade() calls cudaDeviceReset() at the end of its destructor, meaning that the subsequent destruction of some of its members (such as EditKernelsLauncher) ends up trying to cudaFree these allocations after they were already freed by cudaDeviceReset. Fishy.
The program gets away with this by ignoring the return codes, but that's perhaps a bit dubious. A bit of refactoring of the object lifecycles might be called for (as well as not ignoring cuda return codes).
(I tripped over this while fiddling with something else using SCALE's exception mode, which found this unrelated problem :P ).
cudaDeviceReset() destroys all memory allocations on the device (among other things).
~SimulationCudaFacade()
callscudaDeviceReset()
at the end of its destructor, meaning that the subsequent destruction of some of its members (such asEditKernelsLauncher
) ends up trying to cudaFree these allocations after they were already freed by cudaDeviceReset. Fishy.The program gets away with this by ignoring the return codes, but that's perhaps a bit dubious. A bit of refactoring of the object lifecycles might be called for (as well as not ignoring cuda return codes).
(I tripped over this while fiddling with something else using SCALE's exception mode, which found this unrelated problem :P ).