Changeset 897 for trunk/src/series.m
- Timestamp:
- May 25, 2015, 8:48:58 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r896 r897 1556 1556 end 1557 1557 1558 %% set nbre of cluster cores and processes 1558 %% set nbre of cluster cores and processes: 1559 % NbCore is the number of computer processors used 1560 % NbProcess is the number of independent processes in which the required calculation is split 1559 1561 switch RunMode 1560 1562 case {'local','background'} … … 1598 1600 end 1599 1601 if isempty(Param.IndexRange.NbSlice) 1600 NbProcess=NbCore;% choose one process per core 1602 NbProcess=NbCore;% choose one process per core if NbSlice is not imposed 1601 1603 else 1602 NbProcess=Param.IndexRange.NbSlice;% the nbre of run processes is equal to the number of slices1603 NbCore=min(NbCore,NbProcess);% at least one process per core1604 NbProcess=Param.IndexRange.NbSlice;% the parameter NbSlice sets the nbre of run processes 1605 NbCore=min(NbCore,NbProcess);% reduces the number of cores if it exceeds the number of processes 1604 1606 end 1605 1607 … … 1662 1664 OutputNomType=nomtype2pair(Param.InputTable{1,4});% nomenclature for output files 1663 1665 1664 %% get the set of reference field indices1665 first_i=1; 1666 last_i=1; 1667 incr_i=1; 1668 first_j=1; 1669 last_j=1; 1670 incr_j=1; 1666 %% get the set of reference input field indices 1667 first_i=1;% first i index to process 1668 last_i=1;% last i index to process 1669 incr_i=1;% increment step in i index 1670 first_j=1;% first j index to process 1671 last_j=1;% last j index to process 1672 incr_j=1;% increment step in j index 1671 1673 if isfield(Param.IndexRange,'first_i') 1672 1674 first_i=Param.IndexRange.first_i; … … 1688 1690 set(handles.num_incr_i,'String','1') 1689 1691 end 1692 % case of no increment i defined: processing is done on the available files found in i1_series 1690 1693 if isempty(incr_i) 1691 1694 if isempty(incr_j) … … 1701 1704 ref_i=ref_i(ref_i>=first_i & ref_i<=last_i); 1702 1705 end 1706 % increment i is defined: processing is done on first_i:incr_i:last_i; 1703 1707 else 1704 1708 ref_i=first_i:incr_i:last_i; … … 1711 1715 end 1712 1716 end 1713 BlockLength=ceil(numel(ref_i)/NbProcess); 1714 nbfield_j=numel(ref_j); 1717 BlockLength=ceil(numel(ref_i)/NbProcess);% nbre of input fields in each process 1718 nbfield_j=numel(ref_j); % number of j indices 1715 1719 1716 1720 %% record nbre of output files and starting time for computation for status … … 1729 1733 set(handles.status,'UserData',StatusData) 1730 1734 1731 1735 %% case of a function in Python 1732 1736 if strcmp(ActionExt, '.py (in dev.)') 1733 1737 fprintf([ … … 1759 1763 %Param.IndexRange.last_i=min(first_i+(iprocess)*BlockLength*incr_i-1,last_i); 1760 1764 else %multislices (then incr_i is not empty) 1761 1762 1765 Param.IndexRange.first_i= first_i+incr_i*(iprocess-1); 1766 Param.IndexRange.incr_i=incr_i*Param.IndexRange.NbSlice; 1763 1767 end 1764 1768 if isfield(Param,'OutputSubDir') 1765 t=struct2xml(Param);1766 t=set(t,1,'name','Series');1767 filexml=fullfile_uvmat(DirXml,'',Param.InputTable{1,3},'.xml',OutputNomType,...1768 Param.IndexRange.first_i,Param.IndexRange.last_i,first_j,last_j);1769 save(t,filexml);1769 t=struct2xml(Param); 1770 t=set(t,1,'name','Series'); 1771 filexml=fullfile_uvmat(DirXml,'',Param.InputTable{1,3},'.xml',OutputNomType,... 1772 Param.IndexRange.first_i,Param.IndexRange.last_i,first_j,last_j); 1773 save(t,filexml); 1770 1774 end 1771 1775 switch ActionExt … … 1895 1899 for iprocess=1:NbProcess 1896 1900 system([batch_file_list{iprocess} ' &'])% directly execute the command file for each process 1897 msgbox_uvmat('CONFIRMATION',[ActionName ' launched in background: press STATUS to see results'])1898 end1901 end 1902 msgbox_uvmat('CONFIRMATION',[ActionName ' launched in background: press STATUS to see results']) 1899 1903 case 'cluster_oar' % option 'oar-parexec' used 1900 1904 %create subdirectory for oar command and log files … … 2041 2045 drawnow 2042 2046 2043 %% check whether the input file(s) need to be refreshed2044 % SeriesData=get(handles.series,'UserData');%hidden parameters2045 % if ~isfield(SeriesData,'i1_series')2046 % msgbox_uvmat('ERROR','The input field series needs to be refreshed: press REFRESH');2047 % return2048 % end2049 2050 2047 %% get Action name and path 2051 2048 NbBuiltinAction=get(handles.Action,'UserData'); %nbre of functions initially proposed in the menu ActionName (as defined in the Opening fct of series) … … 2106 2103 set(handles.ActionName,'UserData',ActionPathList); 2107 2104 set(handles.ActionExt,'Value',ActionExtIndex) 2108 % ActionPathList{ActionIndex,ActionExtIndex}=PathName;2109 2105 2110 2106 %record the user defined menu additions in personal file profil_perso … … 2134 2130 2135 2131 %% create the function handle for Action 2136 path_series=which('series'); 2137 if ~isequal(ActionPath,path_series) 2138 eval(['spath=which(''' ActionName ''');']) %spath = current path of the selected function ACTION 2139 if ~exist(ActionPath,'dir') 2140 errormsg=['The prescribed function path ' ActionPath ' does not exist']; 2141 return 2142 end 2143 if ~isequal(spath,ActionPath) 2144 addpath(ActionPath)% add the prescribed path if not the current one 2145 end 2146 end 2147 eval(['h_fun=@' ActionName ';'])%create a function handle for ACTION 2148 if ~isequal(ActionPath,path_series) 2149 rmpath(ActionPath)% add the prescribed path if not the current one 2150 end 2132 if ~exist(ActionPath,'dir') 2133 msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']); 2134 return 2135 end 2136 current_dir=pwd;%current working dir 2137 cd(ActionPath) 2138 h_fun=str2func(ActionName); 2139 cd(current_dir) 2140 2141 % 2142 % checkaddpath=0; 2143 % path_series=which('series'); 2144 % %eval(['spath=which(''' ActionName ''');']) %spath = current path of the selected function ACTION 2145 % spath=fileparts(which(ActionName)); %spath = current path of the selected function ACTION 2146 % if ~exist(ActionPath,'dir') 2147 % msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']); 2148 % return 2149 % end 2150 % if ~strcmp(spath,ActionPath) 2151 % if strcmp(pwd,spath) 2152 % msgbox_uvmat('ERROR',[ 'a function called ' ActionName ' on your working space oversets the selected one']); 2153 % return 2154 % else 2155 % addpath(ActionPath)% add the prescribed path if not the current one 2156 % checkaddpath=1; 2157 % end 2158 % end 2159 % eval(['h_fun=@' ActionName ';'])%create a function handle for ACTION 2160 % if checkaddpath && ~isequal(ActionPath,path_series) 2161 % rmpath(ActionPath)% add the prescribed path if not the current one 2162 % end 2151 2163 2152 2164 %% Activate the Action fct to adapt the configuration of the GUI series and bring specific parameters in SeriesData … … 2185 2197 FieldList_1=get(handles.FieldName_1,'String');% previous list as default 2186 2198 if ~iscell(FieldList_1),FieldList_1={FieldList_1};end 2187 CheckList=0;% indicate whether FieldName has been updated2199 %CheckList=0;% indicate whether FieldName has been updated 2188 2200 CheckList_1=1;% indicate whether FieldName_1 has been updated 2189 2201 handles_coord=[handles.Coord_x handles.Coord_y handles.Coord_z handles.Coord_x_title handles.Coord_y_title handles.Coord_z_title]; … … 2195 2207 set(handles.VelType_title,'Visible','on') 2196 2208 FieldList=[set_field_list('U','V');{'C'};{'get_field...'}];%standard menu for civx data 2197 CheckList=1;2209 %CheckList=1; 2198 2210 set(handles.FieldName,'Value',1); %velocity vector choice by default 2199 2211 if VelTypeRequest_1 && numel(iview_civ)>=2 … … 2347 2359 2348 2360 %% NbSlice visibility 2349 NbSliceVisible='off';%default2350 if isfield(ParamOut,'NbSlice') && isequal(ParamOut.NbSlice,'on')2351 NbSliceVisible='on';2352 set(handles. num_NbProcess,'String',get(handles.num_NbSlice,'String'))% the nbre of processes is imposed as the nbre of slices2361 %NbSliceVisible='off';%default 2362 if isfield(ParamOut,'NbSlice') && (strcmp(ParamOut.NbSlice,'on')||isnumeric(ParamOut.NbSlice)) 2363 set(handles.num_NbSlice,'Visible','on') 2364 set(handles.NbSlice_title,'Visible','on') 2353 2365 else 2354 set(handles.num_NbProcess,'String','')% free nbre of processes 2355 end 2356 set(handles.num_NbSlice,'Visible',NbSliceVisible) 2357 set(handles.NbSlice_title,'Visible',NbSliceVisible) 2366 set(handles.num_NbSlice,'Visible','off') 2367 set(handles.NbSlice_title,'Visible','off') 2368 % set(handles.num_NbProcess,'String',get(handles.num_NbSlice,'String'))% the nbre of processes is imposed as the nbre of slices 2369 % else 2370 % set(handles.num_NbProcess,'String','')% free nbre of processes 2371 end 2372 if isnumeric(ParamOut.NbSlice) 2373 set(handles.num_NbSlice,'String',num2str(ParamOut.NbSlice)) 2374 set(handles.num_NbSlice,'Enable','off'); % NbSlice set by the activation of the Action function 2375 else 2376 set(handles.num_NbSlice,'Enable','on'); % NbSlice can be modified on the GUI series 2377 end 2378 % set(handles.num_NbSlice,'Visible',NbSliceVisible) 2379 % set(handles.NbSlice_title,'Visible',NbSliceVisible) 2358 2380 2359 2381 … … 3003 3025 %% create the function handle of the selected fct 3004 3026 if ~isempty(TransformName) 3027 if ~exist(TransformPathList{TransformIndex},'dir') 3028 msgbox_uvmat('ERROR',['The prescribed transform function path ' TransformPathList{TransformIndex} ' does not exist']); 3029 return 3030 end 3005 3031 current_dir=pwd;%current working dir 3006 3032 cd(TransformPathList{TransformIndex}) … … 3294 3320 end 3295 3321 3296 function num_NbProcess_Callback(hObject, eventdata, handles)3322 %function num_NbProcess_Callback(hObject, eventdata, handles) 3297 3323 3298 3324 3299 3325 function num_NbSlice_Callback(hObject, eventdata, handles) 3300 3326 NbSlice=str2num(get(handles.num_NbSlice,'String')); 3301 set(handles.num_NbProcess,'String',num2str(NbSlice))3327 %set(handles.num_NbProcess,'String',num2str(NbSlice)) 3302 3328 3303 3329 %------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.