On Tue, 13 Dec 2011 19:57:31 -0800 (PST), Dom Pazzula <[email protected]> wrote:
> Previously asked how to use the subset_dot.  Got to trying it out tonight and 
> am getting an error.  Tried this in PYCUDA at work and got a similar error.  
> Maybe I am doing something wrong.
> 
> from pyopencl.clrandom import rand as clrand
> 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)
> g_b = cl.array.to_device(queue, a)
> 
> print g_a;
> 
> subset = np.array(range(2,4))
> print type(subset)
> x = cl.array.subset_dot(subset,g_a,g_b,queue=queue)
> 
> print "a[2:4] dot a[2:4]", x
> 
> ---------------------------------
> 
> [1 2 3 4 5 6 7 8 9]
> <type 'numpy.ndarray'>
> Traceback (most recent call last):
>   File "C:\Users\dom\workspace\PyDev_Test\src\subset_dot.py", line 19, in 
> <module>
>     x = cl.array.subset_dot(subset,g_a,g_b,queue=queue)
>   File "C:\Python27\lib\site-packages\pyopencl\array.py", line 1136, in 
> subset_dot
>     return krnl(subset, a, b, queue=queue)
>   File "C:\Python27\lib\site-packages\pyopencl\reduction.py", line 358, in 
> __call__
>     allocator=repr_vec.allocator)
> AttributeError: 'numpy.ndarray' object has no attribute 'allocator' 

All arguments to subset_dot must be device arrays, including subset.

Andreas

Attachment: pgpCNc9HH9tum.pgp
Description: PGP signature

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

Reply via email to