Hi, 
i'm new in PyCuda.
I should implement a cross-correlation in CUDA. 
Doing this i encountered some problem. So i'm doing some basic samples.
For example, if i do this :

import pycuda.autoinit
import pycuda.driver as drv
import numpy


from pycuda.compiler import SourceModule
mod = SourceModule("""
__global__ void thread_index(float *dest)
{
  int i = threadIdx.x;
    dest[i]=i;
}
""")
lung_vett=10;
thread_index = mod.get_function("thread_index")
dest=numpy.zeros(lung_vett);
thread_index(drv.Out(dest),block=(lung_vett,1,1))

print dest

I expect that dest is like this: dest= [0,1,2,3,4,5,6,7,8,9,10].
But pycuda returns random number like this : [  7.81250000e-003   
3.20000076e+001   2.04800049e+003   3.27680079e+004
   2.62144063e+005   1.76718726e+300   2.39291672e+300   1.11420383e+282
   2.23435632e+297   7.47372270e+294].

I wrote the same script in C and the result is correct. That is to say :  dest= 
[0,1,2,3,4,5,6,7,8,9,10].
where is my error? 
 
Excuse me for my horrible english but i'm an italian student.
Thank to all.

                                          
_______________________________________________
PyCUDA mailing list
[email protected]
http://lists.tiker.net/listinfo/pycuda

Reply via email to