Changeset 997 for trunk/src/series.m


Ignore:
Timestamp:
Feb 6, 2017, 8:05:39 PM (8 years ago)
Author:
sommeria
Message:

ActionInput? button introduced in series, use of parameter file series.xml

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r996 r997  
    14551455% --- called by RUN_Callback
    14561456%------------------------------------------------------------------------
     1457% The calculations are launched in three different ways:
     1458% RunMode='local': calculation on the local Matlab session, will prevent other actions during that time.
     1459% RunMode='background': calculation on the local computer, but in a new Matlab session (with no graphic output).
     1460% RunMode='cluster': calculations dispatched in a cluster, using a managing system, 'oar, 'sge, or 'sgb'.
     1461% In the latter case, the calculation is split in 'packets' of i index (all j indices are contained in a single packet).
     1462% This splitting is possible only if the different calculations in the series are independent. Otherwise the action
     1463% function imposes a number of processes NbSlice in input, for instance NbSlice=1 for a time series.
     1464% If NbSlice is not imposed, the splitting in packets (jobs) is determined
     1465% so that a job is optimum length AdvisedJobCPUTime), and the total job number in any case smaller
     1466% than MaxJobNumber (these parameters are defined in the file series.xml in
     1467% accordance with the management strategy for the cluster). The jobs are
     1468% dispatched in parallel into NbCore processors by the cluster managing system.
     1469
    14571470function errormsg=launch_action(handles)
    14581471errormsg=''; % default
     
    15681581        NbCore=1; % no need to split the calculation
    15691582    case 'cluster_oar'
    1570         NbCoreDefault=SeriesData.OarParam.NbCoreDefault;%proposed number of cores (for cluster)
    1571             if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
     1583        %proposed number of cores to reserve in the cluster
     1584        NbCoreAdvised=SeriesData.SeriesParam.OarParam.NbCoreAdvised;
     1585        NbCoreMax=SeriesData.SeriesParam.OarParam.NbCoreMax;
     1586        if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
    15721587            warning_string=', preferably use .sh option to save Matlab licences';
    1573             else
    1574                 warning_string='';
    1575             end
    1576             answer=inputdlg({['Number of cores (max 36)' warning_string],'extra oar options'},'oarsub parameter',1,{num2str(NbCoreDefault),''});
    1577             if isempty(answer)
    1578                                 errormsg='Action launch interrupted by user';
    1579                 return
    1580             end
    1581             NbCore=str2double(answer{1});
    1582             extra_oar=answer{2};
    1583  %       end
     1588        else
     1589            warning_string=')';
     1590        end
     1591        answer=inputdlg({['Number of cores (max ' num2str(NbCoreMax) warning_string],'extra oar options'},'oarsub parameter',1,{num2str(NbCoreAdvised),''});
     1592        if isempty(answer)
     1593            errormsg='Action launch interrupted by user';
     1594            return
     1595        end
     1596        NbCore=str2double(answer{1});
     1597        extra_oar=answer{2};
    15841598    case {'cluster_pbs', 'cluster_sge', 'cluster_qstat_unknown'}
    15851599        if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
     
    17221736switch RunMode
    17231737    case {'cluster_oar','cluster_pbs','cluster_sge','cluster_qstat_unknown'}
     1738        JobNumberMax=SeriesData.SeriesParam.OarParam.JobNumberMax;
     1739        JobCPUTimeAdvised=SeriesData.SeriesParam.OarParam.JobCPUTimeAdvised;
    17241740        if isempty(Param.IndexRange.NbSlice)% if NbSlice is not defined
    1725             BlockLength= ceil(20/(CPUTime*nbfield_j)); % short iterations are grouped such that the minimum time of a process is 20 min.
    1726             BlockLength=max(BlockLength,ceil(numel(ref_i)/500)); % possibly increase the BlockLength to have less than 500 jobs
     1741            BlockLength= ceil(JobCPUTimeAdvised/(CPUTime*nbfield_j)); % iterations are grouped in sets with length BlockLength  such that the typical CPU time of a job is MinJobNumber.
     1742            BlockLength=max(BlockLength,ceil(numel(ref_i)/JobNumberMax)); % possibly increase the BlockLength to have less than MaxJobNumber jobs
    17271743            NbProcess=ceil(numel(ref_i)/BlockLength) ; % nbre of processes sent to oar
    17281744        else
    17291745            NbProcess=Param.IndexRange.NbSlice; % the parameter NbSlice sets the nbre of run processes
    1730             NbCore=min(NbCore,NbProcess); % reduces the number of cores if it exceeds the number of processes
    1731         end
     1746        end
     1747        NbCore=min(NbCore,NbProcess); % reduces the number of cores if it exceeds the number of processes
    17321748    otherwise
    17331749        if ~isempty(Param.IndexRange.NbSlice)
     
    18581874    filelog_global=fullfile(OutputDir,'0_LOG',filelog_global);
    18591875
    1860     for iprocess=1:NbProcess
    1861        
    1862         %create the executable file
    1863        
     1876    for iprocess=1:NbProcess   
     1877        %create the executable file       
    18641878        batch_file_list{iprocess}=fullfile(OutputDir,'0_EXE',regexprep(extxml{iprocess},'.xml$',ExeExt));
    18651879       
    18661880        % set the log file name
    1867         filelog{iprocess}=fullfile(OutputDir,'0_LOG',regexprep(extxml{iprocess},'.xml$','.log'));
    1868        
     1881        filelog{iprocess}=fullfile(OutputDir,'0_LOG',regexprep(extxml{iprocess},'.xml$','.log'));     
    18691882    end
    18701883end
     
    20012014        % shorter than the wall time: in the time interval 'checkpoint' (WallTimeOneJob) before the end of the allowed duration,
    20022015        %  the oar job restarts when an individual job ends.
    2003         JobTime=CPUTime*BlockLength*nbfield_j; % estimated time for one individual job (in minutes)
     2016        WallTimeMax=SeriesData.SeriesParam.OarParam.WallTimeMax;
     2017        JobTime=CPUTime*BlockLength*nbfield_j; % estimated CPU time for one individual job (in minutes)
    20042018        % wall time (in hours ) for each oar job, allowing 10 individual jobs, but limited to 23 h:
    2005         WallTimeTotal=min(23,4*JobTime/60);
     2019        WallTimeTotal=min(WallTimeMax,4*JobTime/60);
    20062020        %disp(['WallTimeTotal: ' num2str(WallTimeTotal) ' hours'])
    20072021        % estimated time of an individual job (in min), with a margin of error
     
    23142328%% Activate the Action fct to adapt the configuration of the GUI series and bring specific parameters in SeriesData
    23152329Param=read_GUI_series(handles); % read the parameters from the GUI series
     2330Param.Action.RUN=0;
    23162331ParamOut=h_fun(Param); % run the selected Action function to get the relevant input
    23172332
     
    25272542    set(handles.NbSlice_title,'Visible','off')
    25282543end
    2529 if isnumeric(ParamOut.NbSlice)
     2544if isfield(ParamOut,'NbSlice') && isnumeric(ParamOut.NbSlice)
    25302545    set(handles.num_NbSlice,'String',num2str(ParamOut.NbSlice))
    25312546    set(handles.num_NbSlice,'Enable','off'); % NbSlice set by the activation of the Action function
Note: See TracChangeset for help on using the changeset viewer.