What is “cuModuleLoadDataEx failed” error?

I am running code which is written in pyCUDA. It works fine for 45333 iterations, but when it reaches 45334th iteration

pycuda._driver.LogicError: cuModuleLoadDataEx failed: an illegal memory access was encountered - 
PyCUDA WARNING: a clean-up operation failed (dead context maybe?)
cuModuleUnload failed: an illegal memory access was encountered
PyCUDA WARNING: a clean-up operation failed (dead context maybe?)
cuMemFree failed: an illegal memory access was encountered

This problem has occured thrice, earlier I thought it was a memory issue but it isn’t.
https://stackoverflow.com/questions/46404868/what-is-cumoduleloaddataex-failed-error

It means that a previous kernel call failed due to an illegal memory access.
You may also be running into a kernel timeout.

There is not enough information here for me to say anything else

Thanks for help. I don’t know how it is going to illegal memory at the iteration 45334. I got some cue from stackoverflow; but not very convincing. The link to code is [url]https://github.com/dhariyalbhaskar/Project/blob/master/current2.py[/url]
Error image [url]https://i.stack.imgur.com/BzBvf.png[/url]