Discussion:
[PyCUDA] Reductions
Freddie Witherden
2014-09-29 13:50:53 UTC
Permalink
Hi all,

In my application I need to perform a (relatively) simple reduction of
the form: sum(f(x[i], y[i])) over two device allocations x, y. If
possible I would very much like to use the rather nice reduction code
already in the pycuda.reduction module.

However, the module only appears to work with GPUArrays and no raw
device allocations. Is anyone aware of any simple workarounds for this
-- other than creating actual GPUArrays for my data?

Regards, Freddie.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.tiker.net/pipermail/pycuda/attachments/20140929/c20f5317/attachment.sig>
Freddie Witherden
2014-09-29 17:35:24 UTC
Permalink
Hi Andreas,
GPUArrays don't actually care who "owns" the data, so if you're OK with
building a GPUArray as a 'descriptor' structure (which is quick and
lightweight) without moving any data around, then that would likely be a
reasonable way of going about this.
How does that sound?
That sounds like exactly what I am looking for. Do you have an API
reference for wrapping an allocation with a GPUArray structure?

Regards, Freddie.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.tiker.net/pipermail/pycuda/attachments/20140929/edb447de/attachment.sig>
Andreas Kloeckner
2014-10-05 03:08:25 UTC
Permalink
Post by Freddie Witherden
Hi Andreas,
GPUArrays don't actually care who "owns" the data, so if you're OK with
building a GPUArray as a 'descriptor' structure (which is quick and
lightweight) without moving any data around, then that would likely be a
reasonable way of going about this.
How does that sound?
That sounds like exactly what I am looking for. Do you have an API
reference for wrapping an allocation with a GPUArray structure?
The GPUArray constructor takes an (undocumented) gpudata argument:

https://github.com/inducer/pycuda/blob/master/pycuda/gpuarray.py#L158

that should be castable to an int.

Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <http://lists.tiker.net/pipermail/pycuda/attachments/20141004/dc2e7e44/attachment.sig>
Loading...