optimplot optimization monitoring if the optimfunction has a parfor loop inside doesn't redraw the figure.

1 次查看(过去 30 天)
Hello, everyone.
I have a very heavy optimization process, with each step requiring several hours of running.
To increase the speed at least a little bit, I use the follwoing:
  • I set 'Use Parallel' 'always' as an optimoption to compute gradients in parallel.
  • I use a parfor over a dataset inside every objective function computation.
My dataset is typically about 20 points, and the amount of variables is 10. In total, my cluster has 36 cores ( 18 dual-core Celeron machines).
I ask Matlab to plot the objective function value, as well as the variables themselves.
The problem is, however, that the main monitoring figure is only redrawn when the control returns to the main Matlab instance, which only happens between the optimization steps, and not for a long time. Moreover, if I move the monitoring figure, or resize it, the plots disappear, and ever the menubar takes a few minutes to ger drawn. The figure menu is also completely unresponsive.
I would like to use drawnow or snapnow, but I don't know where to plug them is, since the objective function's 'drawnow' is executed at the nodes, not the main machine.
I use Matlab Distributed Computing Toolbox and Matlab Parallel Computing Toolbox 2013a.
  2 个评论
Lockywolf
Lockywolf 2019-7-22
options = optimoptions( @fmincon, ...
'Algorithm', 'interior-point', ...
'Diagnostics', 'on',...
'Display', 'iter-detailed',...
'TolX', 1.0e-4,...
'TolFun', 1.0e-4,...
'OutputFcn', { @(x, optimValues, state, varargin) myOutputFunction( x, optimValues, state, varargin) },... % doesn't do any plotting
'PlotFcns', {...
@optimplotfval, ...
@optimplotstepsize, ...
@optimplotfirstorderopt, ...
@optimplotx,...
@(x, optimValues, state, varargin) my_otimplotxi( 'ParamName', 1, x, optimValues, state, varargin)},...
'MaxIter', 30,...
'MaxFunEvals', 9999999999999, %
'UseParallel', 'always' );

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Parallel Computing Fundamentals 的更多信息

产品


版本

R2013a

Community Treasure Hunt

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

Start Hunting!

Translated by