I seem to be doing something wrong. dump-info.py indicates that all of the
following extensions should be supported on my card, but I get errors on
compile. How does pycuda handle the pre-processor ( or whatever stage of
compilation handles #pragma ) ?
$ python atomicdemo.py
Traceback (most recent call last):
File "atomicdemo.py", line 27, in <module>
""").build()
File "/usr/lib/python2.5/site-packages/pyopencl/__init__.py", line 130, in
program_build
"Build on %s:\n\n%s" % (dev, log) for dev, log in build_logs))
pyopencl.RuntimeError: clBuildProgram failed: invalid error code
Build on <pyopencl.Device 'GeForce GTX 280' at 0x10000>:
:2: warning: unknown action for '#pragma OPENCL' - ignored
#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable
^
:3: warning: unknown action for '#pragma OPENCL' - ignored
#pragma OPENCL EXTENSION cl_nv_compiler_options : enable
^
:4: warning: unknown action for '#pragma OPENCL' - ignored
#pragma OPENCL EXTENSION cl_nv_device_attribute_query : enable
^
:5: warning: unknown action for '#pragma OPENCL' - ignored
#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable
^
:6: warning: unknown action for '#pragma OPENCL' - ignored
#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics : enable
^
:7: warning: unknown action for '#pragma OPENCL' - ignored
#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics : enable
^
:8: warning: unknown action for '#pragma OPENCL' - ignored
#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics : enable
^
:13: error: no matching overload found for arguments of type 'float
__attribute__((address_space(1)))*, int'
atom_inc(&c[gid]);
^~~~~~~~
===========================================================================
Build on <pyopencl.Device 'Tesla T10 Processor' at 0x10001>:
===========================================================================
Build on <pyopencl.Device 'Tesla T10 Processor' at 0x10002>:
here is the test program ( tries to turn on all available extensions and
does almost nothing )
import pyopencl as cl
import numpy
a = numpy.random.rand(50000).astype(numpy.int32)
ctx = cl.Context()
queue = cl.CommandQueue(ctx)
mf = cl.mem_flags
a_buf = cl.Buffer(ctx, mf.READ_ONLY | mf.COPY_HOST_PTR, hostbuf=a)
dest_buf = cl.Buffer(ctx, mf.WRITE_ONLY, a.nbytes)
prg = cl.Program(ctx, """
#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable
#pragma OPENCL EXTENSION cl_nv_compiler_options : enable
#pragma OPENCL EXTENSION cl_nv_device_attribute_query : enable
#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable
#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics : enable
#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics : enable
#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics : enable
__kernel void foo(__global const float *a, __global float *c)
{
int gid = get_global_id(0);
c[gid] = a[gid];
atom_inc(&c[gid]);
}
""").build()
prg.foo(queue, a.shape, a_buf, dest_buf)
inced = numpy.empty_like(a)
cl.enqueue_read_buffer(queue, dest_buf, inced).wait()
hopefully its not just a typo ( I did triplecheck ).
--mrule
On Tue, Dec 15, 2009 at 3:23 PM, Andreas Klöckner
<[email protected]>wrote:
> On Dienstag 15 Dezember 2009, Michael Rule wrote:
> > I am having trouble finding documentation on this matter. All other
> aspects
> > of PyOpenCL appear functional.
>
> It would seem that all you have to do is mention somethin glike
>
> #pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics : enable
>
> in the OpenCL program source. Or is there something more complicated that
> I'm
> overlooking?
>
> Andreas
>
> _______________________________________________
> PyOpenCL mailing list
> [email protected]
> http://tiker.net/mailman/listinfo/pyopencl_tiker.net
>
>
_______________________________________________
PyOpenCL mailing list
[email protected]
http://tiker.net/mailman/listinfo/pyopencl_tiker.net