Sorry, I don't understand. What do you mean by 'life support for arrays *and
the module they're from*, but not for device pointers? My question was
worded poorly. Let me be more explicit; after I call foo(), the only
variable left in the current module's scope is the texture reference. At
this point: does the texture keep a reference to the device pointer? If it
does not, then is the linear array `a` still allocated on the device, and
can it still be accessed from the texture in the kernel?

On Wed, May 18, 2011 at 12:45 PM, Andreas Kloeckner <li...@informa.tiker.net
> wrote:

> On Wed, 18 May 2011 10:51:00 -0400, Anthony LaTorre <tlator...@gmail.com>
> wrote:
> > I have a question about when allocated texture memory is freed on the
> device
> > by pycuda. Suppose I have a function which does the following:
> >
> > >>> def foo():
> > >>>     a = np.zeros(100, dtype=np.uint32)
> > >>>     a_gpu = cuda.to_device(a)
> > >>>     a_tex = mod.get_texref('a_tex')
> > >>>     a_tex.set_address(a_gpu, a.nbytes)
> > >>>     a_tex.set_format(cuda.array_format.UNSIGNED_INT32, 1)
> > >>>     return a_tex
> >
> > If I call foo() I get back the texture reference, but the device pointer
> has
> > gone out of scope. Is it still safe to assume that memory is still
> available
> > on the GPU?
>
> Nope. Texture references provide 'life support' for arrays and the
> module they're from, but not for device pointers.
>
> HTH,
> Andreas
>
_______________________________________________
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda

Reply via email to