This is what I am getting on an NVIDIA GTX580.

<pyopencl.Context at 0x1c0b29c0 on <pyopencl.Device 'GeForce GTX 580' on
'NVIDIA CUDA' at 0x1c1112d0>>
<pyopencl._cl.CommandQueue object at 0x1c1c49f0>
[[ 5.+0.j  0.+0.j]
 [ 0.+0.j  0.+0.j]]
clarr on gpu: [[ 5.+0.j  0.+0.j]
 [ 0.+0.j  0.+0.j]]
Traceback (most recent call last):
  File "test.py", line 25, in <module>
    res= clarr / 5 # this reproduces: <program source>:20:20: error: can't
convert between vector values of different size ('cfloat_t
  File
"/home/ahnitz/local/pyopencl/lib/python2.7/site-packages/pyopencl-2011.2-py2.7-linux-x86_64.egg/pyopencl/array.py",
line 629, in __div__
    1/other, self, self.dtype.type(0))
  File
"/home/ahnitz/local/pyopencl/lib/python2.7/site-packages/pyopencl-2011.2-py2.7-linux-x86_64.egg/pyopencl/array.py",
line 146, in kernel_runner
    knl = kernel_getter(*args)
  File
"/home/ahnitz/local/pyopencl/lib/python2.7/site-packages/pyopencl-2011.2-py2.7-linux-x86_64.egg/pyopencl/array.py",
line 392, in _axpbz
    a.dtype, x.dtype, b.dtype, out.dtype)
  File "<string>", line 2, in get_axpbz_kernel
  File
"/home/ahnitz/local/pyopencl/lib/python2.7/site-packages/pyopencl-2011.2-py2.7-linux-x86_64.egg/pyopencl/tools.py",
line 81, in first_arg_dependent_memoize
    result = func(cl_object, *args)
  File
"/home/ahnitz/local/pyopencl/lib/python2.7/site-packages/pyopencl-2011.2-py2.7-linux-x86_64.egg/pyopencl/elementwise.py",
line 423, in get_axpbz_kernel
    name="axpb")
  File
"/home/ahnitz/local/pyopencl/lib/python2.7/site-packages/pyopencl-2011.2-py2.7-linux-x86_64.egg/pyopencl/elementwise.py",
line 129, in get_elwise_kernel
    name=name, options=options, **kwargs)
  File
"/home/ahnitz/local/pyopencl/lib/python2.7/site-packages/pyopencl-2011.2-py2.7-linux-x86_64.egg/pyopencl/elementwise.py",
line 104, in get_elwise_kernel_and_types
    name=name, options=options, preamble=preamble, **kwargs)
  File
"/home/ahnitz/local/pyopencl/lib/python2.7/site-packages/pyopencl-2011.2-py2.7-linux-x86_64.egg/pyopencl/elementwise.py",
line 69, in get_elwise_program
    return Program(context, source).build(options)
  File
"/home/ahnitz/local/pyopencl/lib/python2.7/site-packages/pyopencl-2011.2-py2.7-linux-x86_64.egg/pyopencl/__init__.py",
line 124, in build
    cache_dir=cache_dir)
  File
"/home/ahnitz/local/pyopencl/lib/python2.7/site-packages/pyopencl-2011.2-py2.7-linux-x86_64.egg/pyopencl/cache.py",
line 459, in create_built_program_from_source_cached
    ctx, src, options, devices, cache_dir)
  File
"/home/ahnitz/local/pyopencl/lib/python2.7/site-packages/pyopencl-2011.2-py2.7-linux-x86_64.egg/pyopencl/cache.py",
line 383, in _create_built_program_from_source_cached
    prg.build(options, [devices[i] for i in to_be_built_indices])
  File
"/home/ahnitz/local/pyopencl/lib/python2.7/site-packages/pyopencl-2011.2-py2.7-linux-x86_64.egg/pyopencl/__init__.py",
line 377, in program_build
    raise err
pyopencl.RuntimeError: clBuildProgram failed: build program failure -

Build on <pyopencl.Device 'GeForce GTX 580' on 'NVIDIA CUDA' at 0x1c1112d0>:

:20:20: error: can't convert between vector values of different size
('cfloat_t __attribute__((address_space(1)))' (aka 'float2
__attribute__((address_space(1)))') and 'double')
            z[i] = cfloat_cast(a*x[i]) + cfloat_cast(b);
                   ^~~~~~~~~~~~~~~~~~~
:20:33: note: instantiated from:
            z[i] = cfloat_cast(a*x[i]) + cfloat_cast(b);


On Wed, Mar 7, 2012 at 2:52 PM, Andreas Kloeckner
<[email protected]>wrote:

> <#part sign=pgpmime>
> On Mon, 05 Mar 2012 15:06:55 +0100, Karsten Wiesner <
> [email protected]> wrote:
> > Hi all,
> >
> > I observed a problem with typecasting from a real number to a complex
> > number an a Tesla 2050 using pyopencl (from git w/ latest commit
> > d6926eea21351f3044fd441cae64637441e3172f). A code snipped may explain
> > that better:
> >
> > import pyopencl as _cl
> > import pyopencl.array as _clarray
> >
> > import numpy as _numpy
> > from numpy import float32,float64,complex64,complex128
> >
> > print _cl.__file__
> > print _numpy.__file__
> >
> >
> > cl_context = _cl.create_some_context()
> > print cl_context
> >
> > cl_queue = _cl.CommandQueue(cl_context)
> > print cl_queue
> >
> > narr= _numpy.zeros(shape=(2,2), dtype=complex64)
> > narr[0,0]= 5
> >
> > print narr
> >
> > clarr= _clarray.to_device(cl_queue, narr)
> > print "clarr on gpu: {0}".format(clarr)
> >
> > res= clarr / 5 # this reproduces: <program source>:20:20: error: can't
> > convert between vector values of different size ('cfloat_t
> > __attribute__((address_space(1)))' and 'double')
> > #res=  clarr / (5+0j) # this works
> >
> > print clarr
>
> Works for me on Intel CPU and AMD CPU.
>
> Andreas
>
>
> _______________________________________________
> PyOpenCL mailing list
> [email protected]
> http://lists.tiker.net/listinfo/pyopencl
>
_______________________________________________
PyOpenCL mailing list
[email protected]
http://lists.tiker.net/listinfo/pyopencl

Reply via email to