Hi Lev,

On Sun, 2 Jan 2011 17:45:46 -0500, Lev Givon <l...@columbia.edu> wrote:
> I recently attempted to run the following code with CUDA 3.2 and
> Pycuda 0.94.2 on a Quadro NVS 290 installed on a Linux x86_64 system:
> 
> import pycuda.gpuarray as gpuarray
> import pycuda.driver as drv
> import pycuda.autoinit
> import numpy as np
> 
> from pycuda.compiler import SourceModule
> func_mod = SourceModule("""
> #include <pycuda/pycuda-complex.hpp>                                          
>                                 
> #define TYPE pycuda::complex<float>                                           
>                                 
> 
> __global__ void func(TYPE *a, TYPE *b, int N)
> {
>     int idx = threadIdx.x;
>     if (idx < N) 
>         b[idx] = pow(a[idx], 2); 
> }
> """)
> 
> func = func_mod.get_function("func")
> 
> N = 10
> a = np.complex64(np.random.rand(N)+np.random.rand(N)*1j)
> b = np.complex64(np.zeros(N))
> 
> func(drv.In(a), drv.Out(b), np.uint32(N), block=(512,1,1))
> print 'in: ', a
> print 'out (cuda): ', b
> print 'out (np): ', a**2

This should be fixed in git. Note that you should include
<pycuda-complex.hpp>, not <pycuda/pycuda-complex.hpp>.

Thanks for the report,
Andreas

Attachment: pgpE8zhRWZKnV.pgp
Description: PGP signature

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

Reply via email to