Changeset 997 for trunk/src/series.m
- Timestamp:
- Feb 6, 2017, 8:05:39 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r996 r997 1455 1455 % --- called by RUN_Callback 1456 1456 %------------------------------------------------------------------------ 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 1457 1470 function errormsg=launch_action(handles) 1458 1471 errormsg=''; % default … … 1568 1581 NbCore=1; % no need to split the calculation 1569 1582 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) 1572 1587 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}; 1584 1598 case {'cluster_pbs', 'cluster_sge', 'cluster_qstat_unknown'} 1585 1599 if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled) … … 1722 1736 switch RunMode 1723 1737 case {'cluster_oar','cluster_pbs','cluster_sge','cluster_qstat_unknown'} 1738 JobNumberMax=SeriesData.SeriesParam.OarParam.JobNumberMax; 1739 JobCPUTimeAdvised=SeriesData.SeriesParam.OarParam.JobCPUTimeAdvised; 1724 1740 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 500jobs1741 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 1727 1743 NbProcess=ceil(numel(ref_i)/BlockLength) ; % nbre of processes sent to oar 1728 1744 else 1729 1745 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 processes1731 end1746 end 1747 NbCore=min(NbCore,NbProcess); % reduces the number of cores if it exceeds the number of processes 1732 1748 otherwise 1733 1749 if ~isempty(Param.IndexRange.NbSlice) … … 1858 1874 filelog_global=fullfile(OutputDir,'0_LOG',filelog_global); 1859 1875 1860 for iprocess=1:NbProcess 1861 1862 %create the executable file 1863 1876 for iprocess=1:NbProcess 1877 %create the executable file 1864 1878 batch_file_list{iprocess}=fullfile(OutputDir,'0_EXE',regexprep(extxml{iprocess},'.xml$',ExeExt)); 1865 1879 1866 1880 % 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')); 1869 1882 end 1870 1883 end … … 2001 2014 % shorter than the wall time: in the time interval 'checkpoint' (WallTimeOneJob) before the end of the allowed duration, 2002 2015 % 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) 2004 2018 % 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); 2006 2020 %disp(['WallTimeTotal: ' num2str(WallTimeTotal) ' hours']) 2007 2021 % estimated time of an individual job (in min), with a margin of error … … 2314 2328 %% Activate the Action fct to adapt the configuration of the GUI series and bring specific parameters in SeriesData 2315 2329 Param=read_GUI_series(handles); % read the parameters from the GUI series 2330 Param.Action.RUN=0; 2316 2331 ParamOut=h_fun(Param); % run the selected Action function to get the relevant input 2317 2332 … … 2527 2542 set(handles.NbSlice_title,'Visible','off') 2528 2543 end 2529 if is numeric(ParamOut.NbSlice)2544 if isfield(ParamOut,'NbSlice') && isnumeric(ParamOut.NbSlice) 2530 2545 set(handles.num_NbSlice,'String',num2str(ParamOut.NbSlice)) 2531 2546 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.