Home

Awesome

MatCL

License DOI DOI

MatCL is an OpenCL interface for MathWorks Matlab. This MEX-based toolbox aims at providing a simple and easy to use solution to transfer memory and launch OpenCL kernels from Matlab using a single command. In comparison to other Matlab OpenCL solutions, MatCL is not just an OpenCL API wrapper but encapsulates the low-level host API calls necessary to initialize devices, create OpenCL buffers from Matlab workspace variables and build and launch kernels. MatCL is primarily intended to help in the development and testing of OpenCL kernels by allowing to transparently pass data from and to Matlab. Because MatCL handles the entire low-level process, this toolbox makes it possible to execute kernels without in depth knowledge of the host implementation necessary to support the execution of OpenCL kernels. MatCL is also optimized to allow efficient execution of OpenCL kernels within Matlab to accelerate computationally intensive tasks without having to rely on Nvidia CUDA. In addition to single command kernel execution, MatCL also allows for an independent two-step kernel compilation and launch workflow to save the kernel compile time and allow efficient repetitive kernel execution.

A practical example for how MatCL can be used for scientific research is the Induction Equation project.

Tested using Nvidia (Tesla, GTX), AMD (Ryzen, Radeon R9, FirePro) and Intel (Xeon, Core, HD Graphics) devices with Matlab R2015b and up.

Usage

Usage information for the individual functions is available through the Matlab help command (e.g. help cl_get_devices) and the documentation browser (e.g. doc cl_get_devices).

Setup

Just use git clone https://github.com/IANW-Projects/MatCL and run compile_linux.m, compile_windows.m, or compile_mac to compile MatCL. Depending on the OpenCL libraries used, the library path may have to be changed in these files. Than add the folder MatCL to the search path of Matlab. Alternatively, some precompiled binaries are available at https://github.com/IANW-Projects/MatCL/releases.

There may be problems with old C/C++ libraries supplied by Matlab under Linux, resulting in errors such as Invalid MEX-file '/..../cl_get_devices.mex64', followed by many missing symbols. If you use a Debian based system, install the package matlab-support via sudo apt-get install matlab-support and choose the option to rename the GCC libraries of Matlab during setup.

Reference

MatCL can be referenced using the DOI 10.1145/3204919.3204927 and the following bibtex entry.

@inproceedings{heinisch2018MatCL,
  title={{MatCL}: {A} new easy-to use {OpenCL} toolbox for {MathWorks} {Matlab}},
  author={Heinisch, Philip and Ostaszewski, Katharina},
  year={2018},
  pages={8:1--8:1},
  booktitle={Proceedings of the International Workshop on OpenCL},
  series={IWOCL '18, May 2018, Oxford (United Kingdom)},
  publisher={ACM},
  address={New York, NY, USA},
  note={\url{https://github.com/IANW-Projects/MatCL}},
  doi={10.1145/3204919.3204927}
}

The latest release can be cited with

@misc{MatCLGit,
  title={{MatCL}: {A} new easy-to use {OpenCL} toolbox for {MathWorks} {Matlab}},
  author={Heinisch, Philip and Ostaszewski, Katharina and Ranocha, Hendrik},
  month={01},
  year={2019},
  howpublished={\url{https://github.com/IANW-Projects/MatCL}},
  doi={10.5281/zenodo.2531474}
}

License

This project is licensed under the terms of the Creative Commons CC BY-NC-ND 4.0 license.

Disclaimer

Product and company names may be trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them or their affiliates. Everything is provided as is and without warranty. Use at your own risk!