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

조회 수: 2 (최근 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