Thomas Unterthiner <[email protected]> writes: > Hi again! > > How do you completely shut down PyCUDA? After running the following lines: > > from pycuda import driver as pycuda_drv > pycuda_drv.init() > device = pycuda_drv.Device(0) > ctx = device.make_context() > > I can see a new process listed when using `nvidia-smi` on GPU 0 (as > expected). However, this process does not go away after: > > from pycuda.tools import clear_context_caches > clear_context_caches() > ctx.pop() > > # make sure the context is gone: > del(ctx) > del(device) > import gc > gc.collect() > > > So it seems like the context is still alive on the GPU. Grepping for > "cuCtxDestroy" in the pycuda source also yields no results. So I am > assuming the underlying cuda context is never deleted. Is this by design > (i.e., is there are reason for this), or was there just never a need to > do this before?
You're the first one to ask for this. In fact, PyCUDA still uses the context management functions from CUDAs 1.x days that are by now deprecated (I think). This was a terrible interface, and the resulting context management code was scary and brittle. So from my perspective, I'd very much support ripping out and modernizing the context management bit of PyCUDA's code. If you've got a bit of spare time, I'd love to review a patch. Andreas
pgpUocpopCt2h.pgp
Description: PGP signature
_______________________________________________ PyCUDA mailing list [email protected] http://lists.tiker.net/listinfo/pycuda
