OpenCL Matlab Wrapper
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;
obj.CreateFunction(deviceId,code,'KernelName');
obj.Run(globalWorkload,LocalWorkload,scalar,buffer1,MemoryFlagsOfBuffer1,buffer2,MemoryFlagsOfBuffer2);
Cite As
MESC Labs (2025). OpenCL Matlab Wrapper (https://www.mathworks.com/matlabcentral/fileexchange/46826-opencl-matlab-wrapper), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
OpenCLWrapperMATLABMexInterface/
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
