Hi everyone,
    I recently got a new MacBook Pro running Snow Leopard, and I'm
trying to install PyCuda 0.94 on a 64-bit install of python 2.6. The
installation seems to have worked, but I'm getting weird results and
crashes on simple programs.

For example, consider the trivial program below:

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

from pycuda.compiler import SourceModule

mod = SourceModule("""
__global__ void setit(int *dest, int *a)
{
  const int i = threadIdx.x;
  dest[i] = a[i];
}
""")

setit = mod.get_function("setit")

a = numpy.zeros(10).astype(numpy.int32)
dest = numpy.zeros(10).astype(numpy.int32)

print dest # Should be all zeros
setit(drv.Out(dest), drv.In(a), block=(10,1,1))
print dest # Should still be all zeros


This ought to print only zeros, because all it does is copy one array
of all zeros into another array of all zeros. Instead it prints:
[0 0 0 0 0 0 0 0 0 0]
[-16576992 -16445665 -16641753 -16575962 -16445152 -16575708 -16575451
 -16641242 -16640984 -16640983]

Oddly, if I replace "a[i]" with "i" in the kernel source, it works
fine (producing [0 1 2...9]), so the problem seems to be that it can't
read from a.

Moreover, I added the following:

from pycuda import gpuarray
a = gpuarray.zeros(10, numpy.int32)
dest = gpuarray.zeros(10, numpy.int32)
setit(dest, a, block=(10,1,1))
print dest # Should STILL be all zeros

and running it froze my graphics card.

I've tested this code on a different machine and had no problem. Has
anyone run into this before?

Thanks,
Dan Lepage

_______________________________________________
PyCUDA mailing list
PyCUDA@tiker.net
http://lists.tiker.net/listinfo/pycuda

Reply via email to