[PyCUDA] index multiple blocks and grids

Mike Tischler mikethesoilsguy at yahoo.com
Fri Mar 25 06:35:21 PDT 2011


Brilliant!  Thanks Lev!




________________________________
From: Lev Givon <lev at columbia.edu>
To: Mike Tischler <mikethesoilsguy at yahoo.com>
Cc: pycuda at tiker.net
Sent: Fri, March 25, 2011 9:33:30 AM
Subject: Re: [PyCUDA] index multiple blocks and grids

Received from Lev Givon on Thu, Mar 24, 2011 at 07:19:49PM EDT:
> Received from Mike Tischler on Thu, Mar 24, 2011 at 06:30:20PM EDT:
> > Lev,
> > 
> > Thanks for the explanation...that definitely helps.  But how does the 
>indexing 
>
> > work for a 2d case?
> > 
> >  z1 = numpy.zeros((1024)).astype(numpy.float32)
> >  kernel1(drv.Out(z1),block=(16,16,1),grid=(2,2))
> > 
> > int idx=??
> > int idy =??
> > 
> > Thanks!
> > Mike
> 
> There are a variety of ways. I have attached an example that accesses
> a 2D array as a 1D array.

Sorry - I accidentally transposed the grid dimensions. Change
grid=(4,1) to grid=(1,4) and it should work.

                        L.G.



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tiker.net/pipermail/pycuda/attachments/20110325/b3bd6b14/attachment.html>


More information about the PyCUDA mailing list