Changeset 904 for trunk/src/series.m
- Timestamp:
- May 30, 2015, 1:26:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r903 r904 1608 1608 check_create=1; %need to create the result directory by default 1609 1609 while detect 1610 answer=msgbox_uvmat('INPUT_Y-N-Cancel',['use existing ouput directory: ' fullfile(Param.InputTable{1,1},SubDirOutNew) ', possibly delete previous data']); 1610 if Param.CheckOverwrite 1611 comment=', possibly overwrite previous data'; 1612 else 1613 comment=', will complement existing result files (no overwriting)'; 1614 end 1615 answer=msgbox_uvmat('INPUT_Y-N-Cancel',['use existing ouput directory: ' fullfile(Param.InputTable{1,1},SubDirOutNew) comment]); 1611 1616 if strcmp(answer,'Cancel') 1612 1617 return … … 1701 1706 else 1702 1707 ref_i=first_i:incr_i:last_i; 1703 if isempty(incr_j) 1708 if isempty(incr_j)% automatic finding of the existing j indices 1704 1709 [ref_j,tild]=find(squeeze(SeriesData.i1_series{1}(1,:,:))); 1705 1710 ref_j=ref_j-1; … … 1709 1714 end 1710 1715 end 1711 1716 CPUTime=5;% job time estimated at 5 min per iteration (on index i and j) by default 1717 if isfield(Param, 'CPUTime') && ~isempty(Param.CPUTime) 1718 CPUTime=Param.CPUTime;%Note: CpUTime for one iteration ref_i has to be multiplied by the number of j indices nbfield_j 1719 end 1720 nbfield_j=numel(ref_j); % number of j indices 1712 1721 if isempty(Param.IndexRange.NbSlice) 1713 NbProcess=NbCore;% choose one process per core if NbSlice is not imposed1722 NbProcess=NbCore;% choose one process per core by default if NbSlice is not imposed 1714 1723 switch RunMode 1715 1724 case 'cluster_oar' 1716 NbProcess=numel(ref_i); % split big list witdh oar-parexec (Gabriel Moreau) 1725 BlockLength= ceil(20/(CPUTime*nbfield_j));% short iterations are grouped such that the minimum time of a process is 20 min. 1726 NbProcess=ceil(numel(ref_i)/BlockLength) ; % nbre of processes sent to oar 1717 1727 end 1718 1728 else … … 1720 1730 NbCore=min(NbCore,NbProcess);% reduces the number of cores if it exceeds the number of processes 1721 1731 end 1722 BlockLength=ceil(numel(ref_i)/NbProcess);% nbre of input fields in each process 1723 nbfield_j=numel(ref_j); % number of j indices 1732 1733 %BlockLength=ceil(numel(ref_i)/NbProcess);% nbre of input fields in each process 1734 %nbfield_j=numel(ref_j); % number of j indices 1724 1735 1725 1736 %% record nbre of output files and starting time for computation for status … … 1837 1848 t=set(t,1,'name','Series'); 1838 1849 filexml=fullfile_uvmat(DirXml,'',Param.InputTable{1,3},'.xml',OutputNomType,... 1839 Param.IndexRange.first_i,Param.IndexRange.last_i,first_j,last_j) ;1850 Param.IndexRange.first_i,Param.IndexRange.last_i,first_j,last_j) 1840 1851 save(t,filexml);% save the parameter file 1841 1852 … … 1921 1932 end 1922 1933 end 1923 max_walltime=3600*20; % 20h max total calculation (cannot exceed 24 h) 1924 walltime_onejob=1800; % seconds, max estimated time for asingle file index value 1925 filename_joblist=fullfile(DirOAR,'job_list.txt');%create name of the global executable file 1934 filename_joblist=fullfile(DirOAR,'0_job_list.txt');%create name of the global executable file 1926 1935 fid=fopen(filename_joblist,'w'); 1927 1936 for p=1:length(batch_file_list) … … 1930 1939 fclose(fid); 1931 1940 system(['chmod +x ' filename_joblist]);% set the file to executable 1941 1942 % the command job_list.txt contains the list of NbProcess independent individual jobs 1943 % in which the total calculation has been split. Those are written as executable files .sh in the folder /O_EXE. 1944 % These individual jobs are grouped by the system as oar jobs on the NbCore processors. 1945 % For each processor, the oar job must stop after the walltime which has been set, which is limited to 24 h. 1946 % However, the oar job is automatically restarted (option 'idempotent') provided the individual jobs are 1947 % shorter than the wall time: in the time interval 'checkpoint' (WallTimeOneJob) before the end of the allowed duration, 1948 % the oar job restarts when an individual job ends. 1949 JobTime=CPUTime*BlockLength*nbfield_j% estimated time for one individual job (in minutes) 1950 % wall time (in hours ) for each oar job, allowing 10 individual jobs, but limited to 23 h: 1951 WallTimeTotal=min(23,4*JobTime/60); 1952 disp(['WallTimeTotal: ' num2str(WallTimeTotal) ' hours']) 1953 % estimated time of an individual job (in min), with a margin of error 1954 WallTimeOneJob=min(4*JobTime+10,WallTimeTotal*60/2);% estimated max time of an individual job for checkpoint 1955 disp(['WallTimeOneJob: ' num2str(WallTimeOneJob) ' minutes']) 1932 1956 oar_command=['oarsub -n UVmat_' ActionName ' '... 1933 '-t idempotent --checkpoint ' num2str( walltime_onejob+60) ' '...1957 '-t idempotent --checkpoint ' num2str(WallTimeOneJob*60) ' '... 1934 1958 '-l /core=' num2str(NbCore) ','... 1935 'walltime=' datestr( min(1.05*walltime_onejob/86400*max(NbProcess*BlockLength*nbfield_j,NbCore)/NbCore,max_walltime/86400),13) ' '...1959 'walltime=' datestr(WallTimeOneJob/24,13) ' '... 1936 1960 '-E ' regexprep(filename_joblist,'\.txt\>','.stderr') ' '... 1937 1961 '-O ' regexprep(filename_joblist,'\.txt\>','.stdout') ' '... … … 1939 1963 '"oar-parexec -s -f ' filename_joblist ' '... 1940 1964 '-l ' filename_joblist '.log"\n']; 1941 filename_oarcommand=fullfile(DirOAR,'oar_command'); 1965 1966 filename_oarcommand=fullfile(DirOAR,'0_oar_command'); 1942 1967 fid=fopen(filename_oarcommand,'w'); 1943 1968 fprintf(fid,oar_command); … … 1945 1970 fprintf(oar_command);% display in command line 1946 1971 system(oar_command); 1947 msgbox_uvmat('CONFIRMATION',[ActionName ' launched in cluster: press STATUS to see results'])1972 msgbox_uvmat('CONFIRMATION',[ActionName ' launched as ' num2str(NbProcess) ' processes in cluster: press STATUS to see results']) 1948 1973 case 'cluster_pbs' % for LMFA Kepler machine 1949 1974 %create subdirectory for pbs command and log files … … 2302 2327 end 2303 2328 2329 %% Introduce visibility of file overwrite option 2330 if isfield(ParamOut,'CheckOverwriteVisible')&& strcmp(ParamOut.CheckOverwriteVisible,'on') 2331 set(handles.CheckOverwrite,'Visible','on') 2332 else 2333 set(handles.CheckOverwrite,'Visible','off') 2334 end 2304 2335 2305 2336 %% Check whether alphabetical sorting of input Subdir is allowed by the Action fct (for multiples series entries) … … 2462 2493 set(handles.OutputDirExt,'Visible',OutputDirVisible) 2463 2494 set(handles.OutputSubDir,'Visible',OutputDirVisible) 2495 %set(handles.CheckOverwrite,'Visible',OutputDirVisible) 2464 2496 set(handles.OutputDir_title,'Visible',OutputDirVisible) 2465 2497 SeriesData.ActionName=ActionName;%record ActionName for next use … … 3561 3593 function OutputSubDir_Callback(hObject, eventdata, handles) 3562 3594 set(handles.OutputSubDir,'BackgroundColor',[1 1 1]) 3563 % hObject handle to OutputSubDir (see GCBO) 3595 3596 3597 % --- Executes on button press in CheckOverwrite. 3598 function CheckOverwrite_Callback(hObject, eventdata, handles) 3599 % hObject handle to CheckOverwrite (see GCBO) 3564 3600 % eventdata reserved - to be defined in a future version of MATLAB 3565 3601 % handles structure with handles and user data (see GUIDATA) 3566 3602 3567 % Hints: get(hObject,'String') returns contents of OutputSubDir as text 3568 % str2double(get(hObject,'String')) returns contents of OutputSubDir as a double 3603 % Hint: get(hObject,'Value') returns toggle state of CheckOverwrite 3604 3605 3606 % --- Executes on button press in TestCPUTime. 3607 function TestCPUTime_Callback(hObject, eventdata, handles) 3608 % hObject handle to TestCPUTime (see GCBO) 3609 % eventdata reserved - to be defined in a future version of MATLAB 3610 % handles structure with handles and user data (see GUIDATA) 3611 3612 3613 3614 3615
Note: See TracChangeset
for help on using the changeset viewer.