On Tue, 11 Oct 2011 17:41:56 -0700, Matthew Graham <m...@cacr.caltech.edu> 
wrote:
> Hi,
> 
> I'm making successive calls to a function with each call requiring an 
> initialization and a release of the CUDA context. However, memory on the 
> device is not getting freed between calls. What I have in a call is:
> 
> driver.init()
> dev = driver.Device(num)
> context = dev.make_context()
> print driver.mem_get_info()
> mod = compiler.SourceModule(code)
> ... # application logic here
> context.pop()
> 
> and this is showing:
> 
> Obj 1
> (195731456, 265945088)
> (182132736, 265945088)
> (168099840, 265945088)
> (154075136, 265945088)
> Obj 2
> (140050432, 265945088)
> (126025728, 265945088)
> (112001024, 265945088)
> (98009088, 265945088)
> Obj 3
> (83984384, 265945088)
> Obj 4
> (69959680, 265945088)
> (55934976, 265945088)
> (41517056, 265945088)
> (26443776, 265945088)
> Obj 5
> [11/Oct/2011:16:23:57] HTTP Traceback (most recent call last):
>   File 
> "/Library/Frameworks/Python.framework/Versions/6.0.0/lib/python2.6/site-packages/cherrypy/_cprequest.py",
>  line 606, in respond
>     cherrypy.response.body = self.handler()
>   File 
> "/Library/Frameworks/Python.framework/Versions/6.0.0/lib/python2.6/site-packages/cherrypy/_cpdispatch.py",
>  line 25, in __call__
>     return self.callable(*self.args, **self.kwargs)
>   File "/Users/mjg/Projects/python/kiss/culsp.py", line 203, in culsp
>     context = dev.make_context()
> MemoryError: cuCtxCreate failed: out of memory
> 
> I've tried to put in del calls for the gpuarrays used after popping the 
> context (as per the 2DFFT and MultipleThreads example codes) but this is not 
> doing anything. How can I release the memory on the device between calls?

Try pycuda.tools.clear_context_caches().

Andreas

Attachment: pgpOthdR3a7F9.pgp
Description: PGP signature

_______________________________________________
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda

Reply via email to