Andreas, Ryan, How did you decide about the Modified Reduction.py that Ryan published here: http://lists.tiker.net/pipermail/pycuda/2011-June/003196.html
It promises to do exactly what I want, yet I'm not sure it was committed or can still be applied as a patch to the more recent release of PyCUDA ReductionKernel. I tried anyway and got compilation problems from nvcc, identifier "x" is undefined, maxloc = ReductionKernel(dtype_out=numpy.int32, neutral="0", reduce_expr="(x[(int)a] > x[(int)b]) ? (int)a : (int)b", map_expr="i", arguments="float *x") Igor On Thu, Nov 17, 2011 at 12:26 PM, Igor <rych...@gmail.com> wrote: > Alternatively, I could split my struct into the array of the field > which max() is sought and the array of the remaining fields. But then > could ReduceKernel be made to return the _position_ and not the value? > I'd use it to retrieve all the values from the both arrays. > Igor > > > On Wed, Nov 16, 2011 at 9:38 PM, Igor <rych...@gmail.com> wrote: >> Either I'm doing something wrong or indeed it's by design that I can't >> use custom struct-types with ReductionKernel? How do I proceed? >> Igor >> >> >> >> Fxy= [('f','double'), ('i', gpuarray.vec.int2)] >> >> max = ReductionKernel(dtype_out=Fxy, neutral="0", >> reduce_expr="max(a.f,b.f)", map_expr="a[i]", arguments="Fxy *x") >> >> >> >> >> >> Traceback (most recent call last): >> ... >> >> File >> "/usr/local/sage/sage-test/sage-4.7.1/local/lib/python2.6/site-packages/pycuda-2011.1.2-py2.6-linux-x86_64.egg/pycuda/reduction.py", >> line 187, in __init__ >> dtype_to_ctype(dtype_out), self.block_size, >> File >> "/usr/local/sage/sage-test/sage-4.7.1/local/lib/python2.6/site-packages/pycuda-2011.1.2-py2.6-linux-x86_64.egg/pycuda/tools.py", >> line 399, in dtype_to_ctype >> raise ValueError, "unable to map dtype '%s'" % dtype >> ValueError: unable to map dtype '[('f', '<f8'), ('i', [('x', '<u4'), >> ('y', '<u4')])]' >> > _______________________________________________ PyCUDA mailing list PyCUDA@tiker.net http://lists.tiker.net/listinfo/pycuda