When working on packaging PyOpenCL I have noticed
that one of test (image_2d) fails.

Short description of my hardware and software situation.
I am running those test on eeePC 1201N with NVIDIA ION
GPU (GeForce 9400M) with drivers 280.13, CUDA 4.0.17, OpenCL 1.0.
I have also installed unofficial package of AMD APP 2.4
which uses Intel Atom 330 CPU as OpenCL 1.1 device.

When running test, image_2d from test_wrapper.py runs
without problems on GPU, but fails on the CPU:
[<pyopencl.Device 'Intel(R) Atom(TM) CPU  330   @ 1.60GHz' at
0x18b1210>]
590.605
[<pyopencl.Device 'ION' at 0x18b87b0>]
0.0

Those are generated by attached program, which is just
looping over all available devices and running test_image_2d
on all of them.

Is this problem in my configuration (e.g. conflict between
AMD and NVIDIA OpenCL libraries), or something other?

Best regards.


-- 
Tomasz Rybak <[email protected]> GPG/PGP key ID: 2AD5 9860
Fingerprint A481 824E 7DD3 9C0E C40A  488E C654 FB33 2AD5 9860
http://member.acm.org/~tomaszrybak
#! /usr/bin/python

import numpy as np
import numpy.linalg as la
import pyopencl as cl

def test_image_2d(context):
	print context.devices
	device, = context.devices

	if not device.image_support:
		print("images not supported on %s" % device)
		return

	prg = cl.Program(context, """
	__kernel void copy_image(
	__global float *dest,
	__read_only image2d_t src,
	sampler_t samp,
	int width)
	{
	int x = get_global_id(0);
	int y = get_global_id(1);
	/*
	const sampler_t samp =
	CLK_NORMALIZED_COORDS_FALSE
	| CLK_ADDRESS_CLAMP
	| CLK_FILTER_NEAREST;
	*/
	dest[x + width*y] = read_imagef(src, samp, (float2)(x, y)).x;
	// dest[x + width*y] = get_image_height(src);
	}
	""").build()

	num_channels = 1
	a = np.random.rand(1024, 1024, num_channels).astype(np.float32)
	if num_channels == 1:
		a = a[:,:,0]

	queue = cl.CommandQueue(context)
	a_img = cl.image_from_array(context, a, num_channels)
	a_dest = cl.Buffer(context, cl.mem_flags.READ_WRITE, a.nbytes)

	samp = cl.Sampler(context, False,
		cl.addressing_mode.CLAMP,
		cl.filter_mode.NEAREST)
	prg.copy_image(queue, a.shape, None, a_dest, a_img, samp, np.int32(a.shape[0]))

	a_result = np.empty_like(a)
	cl.enqueue_copy(queue, a_result, a_dest)

	print la.norm(a_result - a)

devices = []
contexts = []
for platform in cl.get_platforms():
	for device in platform.get_devices():
		devices.append(device)
		contexts.append(cl.Context(devices=[device]))

for c in contexts:
	test_image_2d(c)

Attachment: signature.asc
Description: This is a digitally signed message part

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

Reply via email to