[PyCUDA] index multiple blocks and grids
lev at columbia.edu
Fri Mar 25 06:33:30 PDT 2011
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.
More information about the PyCUDA