On Wed, Jul 11, 2012 at 12:15 AM, Andrea Cesari
<[email protected]> wrote:
> 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?
The first two elements are garbage because:
1) you have not initialized them to anything (consequence of using drv.Out), and
2) you have not written anything there (consequence of using i =
threadIdx.x + 2)
So if you want them to contain something meaningful, fix either 1) or 2).
1) can be fixed, for example, like this:
# to_gpu() takes numpy array, copies it to GPU and returns you
reference to this GPU array
from pycuda.gpuarray import to_gpu
lung_vett=10;
thread_index = mod.get_function("thread_index")
dest=numpy.zeros(lung_vett);
dest_gpu = to_gpu(dest)
thread_index(dest_gpu, block=(lung_vett,1,1))
print dest_gpu.get()
_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda