我目前在 Matlab 工作,这是我第一次尝试并行处理。我的代码工作得很好,直到我matlabpool('open',4);
在代码的顶部和matlabpool('close');
底部添加。
如果我添加这两行,我所有的 CPU 核心都处于 100% 的工作负载(如预期的那样),并且我的代码仍然可以工作,除了我在 parfor 循环中实现的等待栏。
代码看起来像这样:
matlabpool('open',4);
global bar;
bar = waitbar(0, 'Waitbar');
parfor i=1:1000
//working code
try
waitbar(UPDATED_VALUE, bar, UPDATED_STRING);
end
end
try
close(bar);
end
//display results
matlabpool('close');
我得到的错误如下:
Warning: This functionality is no longer supported under the -nodisplay and -noFigureWindows startup options. For more information, see "Changes to -nodisplay and -noFigureWindows Startup Options" in the MATLAB Release Notes. To view the release note in your system browser, run web('http://www.mathworks.com/access/helpdesk/help/techdoc/rn/br5ktrh-1.html#br5ktrh-3', '-browser')
In uitools\private\warnfiguredialog at 26
In waitbar at 38
In montecarlo>(parfor body) at 41
In parallel_function>make_general_channel/channel_general at 891
In remoteParallelFunction at 28
我真的不知道我做错了什么。有人能帮助我吗?