so, the firs two elements of a vector are always garbage?
can i solve it allocating manually the memory? but should be the same of 
drv.Out() i think..or no?

> Date: Wed, 11 Jul 2012 00:08:39 +1000
> Subject: Re: [PyCUDA] Thread Problem
> From: [email protected]
> To: [email protected]
> CC: [email protected]
> 
> Hi Andrea,
> 
> On Tue, Jul 10, 2012 at 11:55 PM, Andrea Cesari
> <[email protected]> wrote:
> > But if i modify the kernel in this mode:
> >
> > const int i = threadIdx.x+2
> > dest[i]=i;
> >
> > the result is: [1 0 2 3 4 5 6 7 8 9]
> > while, in my opinion,should be [0,0,2,3,4,5,6,7,8,9] (confirmed by C code).
> > why?
> 
> drv.Out() allocates an empty array which you later fill in your
> kernel, except for the first two elements. So these first two elements
> contain garbage, something that was in this part of video memory
> before. In your case it is 1 and 0, but could be anything. The fact
> that you create the CPU array with numpy.zeros() does not mean
> anything, since all the values in the CPU array are overwritten by the
> data from GPU.
                                          
_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda

Reply via email to