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

2 views (last 30 days)
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 Comments
Lockywolf
Lockywolf on 22 Jul 2019
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' );

Sign in to comment.

Answers (0)

Categories

Find more on Parallel Computing Fundamentals in Help Center and File Exchange

Products


Release

R2013a

Community Treasure Hunt

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

Start Hunting!