<#part sign=pgpmime>
On Thu, 22 Mar 2012 13:37:17 +0100, wrb <[email protected]> wrote:
> On 03/21/12 at 01:45P, Andreas Kloeckner wrote:
> > For a row-major matrix, row-wise scan is effectively segmented scan,
> > which is a tiny change to the existing scan code that's been on my todo
> > list for a long while. I'll try to get to that soon. And I'd be very
> > surprised if the optimal way to do column-wise scan weren't transpose,
> > row-wise scan, transpose. :)
> 
> That sounds great! Also shame on me for not spotting the row-wise scan
> = segmented scan, I should know about parallel algorithms to realize
> that.
> 
> Is there any way I can help? At least with testing perhaps?

Sure, if you'd like to take a crack at this, I'd be more than happy to
help. Here's the story:

The code is in pyopencl/compyte/scan.py
Start from a git checkout.

I'd like to do a few things to that code:

- Allow evaluation of a map before the scan starts, without ever
  explicitly storing the map result. Such a map *could* (but wouldn't be
  required to) involve widening each entry of the array to a struct that
  contains the entry and a segment flag. The map would be fed in as a C
  expression (i.e. as a string) and would be allowed to use all the
  arguments given to the kernel (same idea as ElementwiseKernel), and it
  would have its desired index available in the formal variable 'i'.

- A separate (Boolean-valued) expression (defaulting to None) that
  marks segment boundaries, based on array indices and intermediate
  scan values.

- A final expression that manages storing the output. By default, this
  just writes the scan result to the output array, but it could also use
  the scan result as an index or do other funny business.

Having this should enable us to very easily replicate thrust's zoo of
scan-based goodies:

- copy_if
- partition
- remove, remove_if
- unique, unique_by_key

The only tricky bit with segmented scan is correctly managing the
exclusive scan variant.

Andreas


_______________________________________________
PyOpenCL mailing list
[email protected]
http://lists.tiker.net/listinfo/pyopencl

Reply via email to