【问题标题】:Creating a progress screen for MATLAB distributed computing applications为 MATLAB 分布式计算应用程序创建进度屏幕
【发布时间】:2014-04-28 22:12:18
【问题描述】:

我正在集群上运行高度并行化的 MATLAB 应用程序。我将为用户构建一个等待屏幕,并且我想显示集群作业的进度。这里有一些上下文:

clusterHandle = findResource(...);
jobHandle = createJob(clusterHandle);
% 'Do some setup stuff for the job...'
submit(jobHandle);
WaitFunction(jobHandle);

WaitFunction(jobHandle)

    while (~doneflag)

        % 'Your advice goes here...'

        doneflag = strcmp(jobHandle.State, 'finished');

    end

end

我的问题是:我可以通过哪些方式操纵 jobHandle 结构及其字段来生成作业的完成百分比?作业中的任务都具有大致相同的运行时间。对于奖励代表:我也对等待屏幕的任何有趣格式的信息/链接感兴趣。对您的建议和想法的唯一限制是解决方案不能太慢。谢谢!

【问题讨论】:

  • 我之前用过matlabwaitbar,很好用。
  • 如果所有作业的时间大致相同,那么您可以使用第一个作业的开始和结束之间的差异来简单地估计下一个作业的时间。然后,您可以使用所有作业在处理继续时所用时间的平均值来更新时间。如果您愿意,我可以将其写成答案。 job properties
  • 感谢等待栏的建议。欢迎你写出来。

标签: matlab user-interface parallel-processing cluster-computing distributed-computing


【解决方案1】:

您可以使用第一个作业来估计所有剩余作业的时间。

% //Setup the wait bar
firstjob=true;
hw=waitbar(0,'Calculating Important cluster stuff',...
             'Name','Cluster Job',...
             'CreateCancelBtn',...
             'setappdata(gcbf,''canceling'',1)');
setappdata(hw,'canceling',0);
times=nan(numjobs);
clusterHandle = findResource(...);
jobHandle = createJob(clusterHandle);
% //'Do some setup stuff for the job...'
for i=1:num_jobs
    % //Add a stoping condition for the cancel button
    if getappdata(hw,'canceling')
        break;
    end
    % //if a job has completed update the runtime
    if ~firstjob
        waitbar(i/num_jobs,hw,sprintf('%2.0f %% Complete: Approx %d minutes remain',100*i/num_jobs,round(nanmean(times)/60)));
    end
    submit(jobHandle);
    WaitFunction(jobHandle);
    firstjob=false;
    % //This will be in seconds
    times(i) = etime(jobHandle.endTime,jobHandle.startTime);
end 

你的waitfunction和上面一样

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-29
    • 1970-01-01
    • 2011-01-11
    • 1970-01-01
    相关资源
    最近更新 更多