Multi-Threading w/ MEX: Adding Two Vectors

版本 1.0.0 (6.0 KB) 作者: oreoman
A basic MEX function that adds two vectors together, but utilizes multiple threads. Created as a way to learn MEX multi-threading.
38.0 次下载
更新时间 2019/2/27

查看许可证

In order to optimize certain pieces of a simulation, I tried to build out a multi-threaded algorithm for solving certain linear algebra problems that I couldn't find good solutions to in various libraries or that couldn't be vectorized in proper MATLAB code.

Since I found a lot of the tutorials available online very confusing, once I figured things out I thought it would be handy to share what I learned. With thanks to Yair Altman and his multi-threading example from 2018 that included all of the information I needed to finally figure things out:

https://undocumentedmatlab.com/blog/multi-threaded-mex

To add non-Windows compatibility, you can add in pthreads by following along with Yair's example.

This needs to be compiled with the command, "mex -R2018a madd.cpp"

引用格式

oreoman (2024). Multi-Threading w/ MEX: Adding Two Vectors (https://www.mathworks.com/matlabcentral/fileexchange/70406-multi-threading-w-mex-adding-two-vectors), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2018b
与 R2018a 及更高版本兼容
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 MATLAB Algorithm Acceleration 的更多信息
标签 添加标签
mex

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0