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
