The patch I wrote worked with whatever was in the repository (or whatever the point release was) at that time. I've been away from that project for a while now, and I won't be getting back to it until the summer.
I remember the issue being in how variable names were chosen during the generation of the ReductionKernel. Before I wrote that little hack, I just threw my array at numpy and used argmax. Way slower and required the data to be pulled off the device and put back on, but it was better than not functioning at all. Sorry I can't help you out. Thanks, Ryan Marcus On Thu, Nov 17, 2011 at 1:00 PM, <[email protected]> wrote: > Send PyCUDA mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.tiker.net/listinfo/pycuda > or, via email, send a message with subject or body 'help' to > [email protected] > > You can reach the person managing the list at > [email protected] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of PyCUDA digest..." > > > Today's Topics: > > 1. Re: extending ReductionKernel (Igor) > 2. Re: extending ReductionKernel (Igor) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 17 Nov 2011 12:26:54 +1300 > From: Igor <[email protected]> > To: [email protected] > Subject: Re: [PyCUDA] extending ReductionKernel > Message-ID: > <caobzsy0g12fooqggdiohnasytf6jzgpdg9vv7hnnxolatd_...@mail.gmail.com > > > Content-Type: text/plain; charset=ISO-8859-1 > > 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 <[email protected]> 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')])]' > > > > > > ------------------------------ > > Message: 2 > Date: Thu, 17 Nov 2011 22:44:47 +1300 > From: Igor <[email protected]> > To: [email protected] > Cc: [email protected] > Subject: Re: [PyCUDA] extending ReductionKernel > Message-ID: > <CAObZSy1OejgXKg1zm7VdwAeLQjMAGcPYd=7wxp6e8okcbdj...@mail.gmail.com > > > Content-Type: text/plain; charset=ISO-8859-1 > > 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 <[email protected]> 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 <[email protected]> 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 > [email protected] > http://lists.tiker.net/listinfo/pycuda > > > End of PyCUDA Digest, Vol 41, Issue 8 > ************************************* >
_______________________________________________ PyCUDA mailing list [email protected] http://lists.tiker.net/listinfo/pycuda
