pycuda
pycuda copied to clipboard
Implement `__enter__` and `__exit__` for CUDA context
People like me always forgot to pop context and cause errors. By implementing these two methods, the python will handle the context automatically. See https://book.pythontips.com/en/latest/context_managers.html This also helps when there is an exception.
That sounds reasonable. I'd be happy to take a PR.