在MATLAB中进行简单的并行执行 [英] Simple parallel execution in MATLAB
问题描述
我已经找到了一些很棒的方法来加快我的MATLAB代码:矢量化,arrayfun,基本上只是摆脱了for循环(不使用parfor).我要进行下一步.
I have figured out some awesome ways of speeding up my MATLAB code: vectorizing, arrayfun, and basically just getting rid of for loops (not using parfor). I want to take it to the next step.
假设我有2个需要大量计算的函数调用.
Suppose I have 2 function calls that are computationally intensive.
x = fun(a);
y = fun(b);
它们是完全独立的,我想并行而不是串行地运行它们.我没有并行处理工具箱.感谢您的帮助.
They are completely independent, and I want to run them in parallel rather than serially. I dont have the parallel processing toolbox. Any help is appreciated.
谢谢
推荐答案
MATLAB解释器是单线程的,因此,跨MATLAB函数实现并行性的唯一方法是运行多个MATLAB实例.并行计算工具箱为您完成了此任务,并以PARFOR/SPMD/PARFEVAL等形式为您提供了方便的界面.您可以手动运行多个MATLAB实例,但是可能需要做一些工作才能组织工作你想完成的事情.
The MATLAB interpreter is single-threaded, so the only way to achieve parallelism across MATLAB functions is to run multiple instances of MATLAB. Parallel Computing Toolbox does this for you, and gives you a convenient interface in the form of PARFOR/SPMD/PARFEVAL etc. You can run multiple MATLAB instances manually, but you'll probably need to do a fair bit of work to organise the work that you want to be done.
这篇关于在MATLAB中进行简单的并行执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!