Hello, maybe there are a mistake in Tharang's code, i test with an example (chapter 20) from: http://code.google.com/p/opencl-book-samples/ and it's working.
i have "encapsulated" the way to create a context and a OpenCL program oriented to image processing in one function def ContextProgram(fileName): where "fileName" is a file with an OpenCL program the result is: http://tinypic.com/r/derx8k/5 http://i43.tinypic.com/derx8k.jpg Regards. ______________________________ def ContextProgram(fileName): # Create an OpenCL context on first available platform platforms = cl.get_platforms(); if len(platforms) == 0: print 'Failed to find any OpenCL platforms.' return None # Next, create an OpenCL context on the first platform. # Attempt to create a GPU-based context, and if that fails, # try to create a CPU-based context. devices = platforms[0].get_devices(cl.device_type.GPU) if len(devices) == 0: print 'Could not find GPU device, trying CPU...' devices = platforms[0].get_devices(cl.device_type.CPU) if len(devices) == 0: print 'Could not find OpenCL GPU or CPU device.' return None device = devices[0] # first device # Make sure the device supports images, otherwise exit if not device.get_info(cl.device_info.IMAGE_SUPPORT): print 'OpenCL device does not support images.' return None # Create a context on the first device context = cl.Context([device]) # Create a command-queue on the first device available Queue = cl.CommandQueue(context, device) # Create an OpenCL program from the kernel source file kernelFile = open(fileName, 'r') kernelStr = kernelFile.read() # Load the program source program = cl.Program(context, kernelStr) # Build the program and check for errors program.build(devices=[device]) return context, Queue, program ______________________________ _______________________________________________ PyOpenCL mailing list [email protected] http://lists.tiker.net/listinfo/pyopencl
