File Exchange

image thumbnail

OpenCL Matlab Wrapper

version 1.0 (17.7 KB) by

OpenCL wrapper for MATLAB that allows for powerful yet simple interfacing



View License

This wrapper provides an interface between MATLAB and OpenCL in a fashion similar to that of Mathematica's OpenCLLink. Control everything in the environment, copy data back and forth, launch threads in an intuitive fashion, all organized in a class and done by simple function interface. It takes only 2 calls to compile a kernel, copy buffers, launch threads and read the data back. The class includes:
obj = OpenCLInterface - Constructor which queries all available devices.
obj.PrintDevices - Print all available devices.
obj.GetGPUDevices - Get ids of all GPU devices.
obj.GetCPUDevices - Get ids of all CPU devices.
obj.CreateFunction - Read kernel code from file or string, compile it and cache it.
obj.Run - Launch the kernel with the specified local and global workloads, scalars and buffers with their memory flags. Buffers specified as Outputs will contain the result data after execution.
Sample Program layout:
obj = OpenCLInterface;

Comments and Ratings (1)


Axel (view profile)

We currently assess the functionality of this wrapper against the older (unmaintained) opencl toolbox. It seems that we identified a major limitation. It seems to be required to allocate for every device buffer a host buffer. Is there a way to avoid that?

MATLAB Release
MATLAB 7.8 (R2009a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video