On Tue, 13 Dec 2011 20:00:53 -0800 (PST), Dom Pazzula <[email protected]> wrote:
> If I have code like this, I get an error:
> import pyopencl as cl
> import numpy as np
> 
> n = 3
> 
> ctx = cl.create_some_context()
> queue = cl.CommandQueue(ctx)
> 
> a = np.array(range(1,10))
> 
> g_a = cl.array.to_device(queue, a)
> -------------------
> Traceback (most recent call last):
>   File "C:\Users\dom\workspace\PyDev_Test\src\subset_dot.py", line 12, in 
> <module>
>     g_a = cl.array.to_device(queue, a)
> AttributeError: 'module' object has no attribute 'array'
> 
> However, if I change my imports to this, everything is OK and it runs without 
> error:
> from pyopencl.clrandom import rand as clrand
> import pyopencl as cl
> import numpy as np

Yes, somewhere you need to 'import pyopencl.array'. clrandom does that
implicitly.

Andreas

Attachment: pgpU6XH4XcZ73.pgp
Description: PGP signature

_______________________________________________
PyOpenCL mailing list
[email protected]
http://lists.tiker.net/listinfo/pyopencl

Reply via email to