I have the following code (condensed and renamed from the actual test code):


ctx = cl.Context(dev_type=cl.device_type.GPU)

print orig_array.shape, orig_array.strides
cl_array = numpy.asarray(orig_array, order='F')
cl_array.resize((256, 512, 512))
print cl_array.shape, cl_array.strides

cl_image = cl.Image(ctx, mf.READ_ONLY | mf.COPY_HOST_PTR,
cl.ImageFormat(cl.channel_order.INTENSITY, cl.channel_type.FLOAT),
hostbuf=cl_array)


Which produces the following output:


Traceback (most recent call last):
  File .../test_cl.py", line 485, in test_50_opencl
    cl_image = cl.Image(ctx, mf.READ_ONLY | mf.COPY_HOST_PTR,
cl.ImageFormat(cl.channel_order.INTENSITY, cl.channel_type.FLOAT),
hostbuf=cl_array)
LogicError: clCreateImage3D failed: invalid image size
-------------------- >> begin captured stdout << ---------------------
(176, 512, 512) (1048576, 2048, 4)
(256, 512, 512) (4, 1024, 524288)


And I can't figure out what's going wrong.  I've played with the
pitches argument to Image, I've tried resizing the array to 512**3,
I've checked the max image dimensions:


>>> pyopencl.get_platforms()[0]
<pyopencl.Platform 'Apple' at 0x7fff0000>
>>> pyopencl.get_platforms()[0].get_devices()[0]
<pyopencl.Device 'GeForce GT 330M' at 0x1022600>
>>> pyopencl.get_platforms()[0].get_devices()[0].image3d_max_width
2048
>>> pyopencl.get_platforms()[0].get_devices()[0].image3d_max_height
2048
>>> pyopencl.get_platforms()[0].get_devices()[0].image3d_max_depth
2048


And per my reading of the spec:


CL_INVALID_IMAGE_SIZE if image_width, image_height are 0 or if
image_depth <= 1 or if they exceed values specified in
CL_DEVICE_IMAGE3D_MAX_WIDTH, CL_DEVICE_IMAGE3D_MAX_HEIGHT or
CL_DEVICE_IMAGE3D_MAX_DEPTH respectively for all devices in context or
if values specified by image_row_pitch and image_slice_pitch do not
follow rules described in the argument description above.


That should be fine.  I'm on a 2010 macbook pro running OSX 10.6,
which means OpenCL 1.0.

Any suggestions?

Thanks,
Eli

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

Reply via email to