Discussion:
[PyCUDA] returning a view
Keith Brown
2015-11-25 19:07:02 UTC
Permalink
Is it possible to have pycuda return a view instead of a real array?
Lev Givon
2015-11-25 19:23:32 UTC
Permalink
Post by Keith Brown
Is it possible to have pycuda return a view instead of a real array?
To what purpose? What do you mean by a view in this case?
--
Lev Givon
Bionet Group | Neurokernel Project
http://lebedov.github.io/
http://neurokernel.github.io/
Keith Brown
2015-11-25 20:47:32 UTC
Permalink
Hi Lev,

Here is the context.

np.dot(a.T,a)
Here a.T is a view and doesnt take up a lot of memory.
if I would do
np.dot(a.T.copy(),a) it would take up more memory.

This is part of my memory saving quest on the GPU. Trying to find some
ways around it...
Post by Lev Givon
Post by Keith Brown
Is it possible to have pycuda return a view instead of a real array?
To what purpose? What do you mean by a view in this case?
--
Lev Givon
Bionet Group | Neurokernel Project
http://lebedov.github.io/
http://neurokernel.github.io/
Lev Givon
2015-11-25 23:11:33 UTC
Permalink
Post by Keith Brown
Hi Lev,
Here is the context.
np.dot(a.T,a)
Here a.T is a view and doesnt take up a lot of memory.
if I would do
np.dot(a.T.copy(),a) it would take up more memory.
This is part of my memory saving quest on the GPU. Trying to find some
ways around it...
If you tell skcuda.linalg.dot() to treat its first argument as transposed, you
don't need to copy the matrix:

skcuda.linalg.dot(a, a, 'T', 'N')
--
Lev Givon
Bionet Group | Neurokernel Project
http://lebedov.github.io/
http://neurokernel.github.io/
Loading...