Multi-Threading
23 ビュー (過去 30 日間)
古いコメントを表示
hello. I would like to implement multi-threading in matlab. There is any easy way to do so? For example, I have 4 processors and want to run an independent MCMC on each of them. I just need how can I tell matlab torun the 4 chains in parallel, one on each processor. Usually, I achieve this using the task manager: I open 4 matlab, and assing to each 1 processor, however i was wondering if there is a way to write a batch file that automatically tells matlab to do so. Thanks Andrea
0 件のコメント
回答 (1 件)
Jason Ross
2012 年 5 月 11 日
Have you looked at the Parallel Computing Toolbox?
There is a command in the toolbox called "batch" that can farm the work out.
There are also other constructs (parfor, job/task, spmd) that you can employ, as well.
NOTE: The syntax we are both using is a bit inexact. I believe what you are calling "multi-threading" is more "parallel processing" or "distributed processing". Threading is a different animal, to some extent -- and is already implemented for some things in MATLAB.
4 件のコメント
Kurt
2022 年 12 月 21 日
移動済み: Steven Lord
2022 年 12 月 21 日
The example link just leads to "Call Matlab from C", which is really no help.
Steven Lord
2022 年 12 月 21 日
I'm not sure which link you followed that led you to "Call MATLAB from C", as none of the ones in Jason's posts did.
But there is another approach that was introduced in release R2021b (I believe) that may be of interest to others with the same type of question as the original poster: running MATLAB functions in a thread-based environment.
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!