Changeset 897 for trunk/src/series.m


Ignore:
Timestamp:
May 25, 2015, 8:48:58 PM (9 years ago)
Author:
sommeria
Message:

sub_background corrected for volume and multilevel cases

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r896 r897  
    15561556end
    15571557
    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
    15591561switch RunMode
    15601562    case {'local','background'}
     
    15981600end
    15991601if 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
    16011603else
    1602     NbProcess=Param.IndexRange.NbSlice;% the nbre of run processes is equal to the number of slices
    1603     NbCore=min(NbCore,NbProcess);% at least one process per core
     1604    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
    16041606end
    16051607
     
    16621664OutputNomType=nomtype2pair(Param.InputTable{1,4});% nomenclature for output files
    16631665
    1664 %% get the set of reference field indices
    1665 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
     1667first_i=1;% first i index to process
     1668last_i=1;% last i index to process
     1669incr_i=1;% increment step in i index
     1670first_j=1;% first j index to process
     1671last_j=1;% last j index to process
     1672incr_j=1;% increment step in j index
    16711673if isfield(Param.IndexRange,'first_i')
    16721674    first_i=Param.IndexRange.first_i;
     
    16881690    set(handles.num_incr_i,'String','1')
    16891691end
     1692% case of no increment i defined: processing is done on the available files found in i1_series
    16901693if isempty(incr_i)
    16911694    if isempty(incr_j)
     
    17011704        ref_i=ref_i(ref_i>=first_i & ref_i<=last_i);
    17021705    end
     1706% increment i is defined: processing is done on first_i:incr_i:last_i;
    17031707else
    17041708    ref_i=first_i:incr_i:last_i;
     
    17111715    end
    17121716end
    1713 BlockLength=ceil(numel(ref_i)/NbProcess);
    1714 nbfield_j=numel(ref_j);
     1717BlockLength=ceil(numel(ref_i)/NbProcess);% nbre of input fields in each process
     1718nbfield_j=numel(ref_j); % number of j indices
    17151719
    17161720%% record nbre of output files and starting time for computation for status
     
    17291733set(handles.status,'UserData',StatusData)
    17301734
    1731 
     1735%% case of a function in Python
    17321736if strcmp(ActionExt, '.py (in dev.)')
    17331737    fprintf([
     
    17591763            %Param.IndexRange.last_i=min(first_i+(iprocess)*BlockLength*incr_i-1,last_i);
    17601764        else %multislices (then incr_i is not empty)
    1761              Param.IndexRange.first_i= first_i+incr_i*(iprocess-1);
    1762              Param.IndexRange.incr_i=incr_i*Param.IndexRange.NbSlice;
     1765            Param.IndexRange.first_i= first_i+incr_i*(iprocess-1);
     1766            Param.IndexRange.incr_i=incr_i*Param.IndexRange.NbSlice;
    17631767        end
    17641768        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);
    17701774        end
    17711775        switch ActionExt
     
    18951899        for iprocess=1:NbProcess
    18961900            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         end
     1901        end
     1902        msgbox_uvmat('CONFIRMATION',[ActionName ' launched in background: press STATUS to see results'])
    18991903    case 'cluster_oar' % option 'oar-parexec' used
    19001904        %create subdirectory for oar command and log files
     
    20412045drawnow
    20422046
    2043 %% check whether the input file(s) need to be refreshed
    2044 % SeriesData=get(handles.series,'UserData');%hidden parameters
    2045 % if ~isfield(SeriesData,'i1_series')
    2046 %     msgbox_uvmat('ERROR','The input field series needs to be refreshed: press REFRESH');
    2047 %     return
    2048 % end
    2049 
    20502047%% get Action name and path
    20512048NbBuiltinAction=get(handles.Action,'UserData'); %nbre of functions initially proposed in the menu ActionName (as defined in the Opening fct of series)
     
    21062103       set(handles.ActionName,'UserData',ActionPathList);
    21072104    set(handles.ActionExt,'Value',ActionExtIndex)
    2108 %     ActionPathList{ActionIndex,ActionExtIndex}=PathName;
    21092105       
    21102106    %record the user defined menu additions in personal file profil_perso
     
    21342130
    21352131%% 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
     2132if ~exist(ActionPath,'dir')
     2133    msgbox_uvmat('ERROR',['The prescribed function path ' ActionPath ' does not exist']);
     2134    return
     2135end
     2136current_dir=pwd;%current working dir
     2137cd(ActionPath)
     2138h_fun=str2func(ActionName);
     2139cd(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
    21512163
    21522164%% Activate the Action fct to adapt the configuration of the GUI series and bring specific parameters in SeriesData
     
    21852197FieldList_1=get(handles.FieldName_1,'String');% previous list as default
    21862198if ~iscell(FieldList_1),FieldList_1={FieldList_1};end
    2187 CheckList=0;% indicate whether FieldName has been updated
     2199%CheckList=0;% indicate whether FieldName has been updated
    21882200CheckList_1=1;% indicate whether FieldName_1 has been updated
    21892201handles_coord=[handles.Coord_x handles.Coord_y handles.Coord_z handles.Coord_x_title handles.Coord_y_title handles.Coord_z_title];
     
    21952207    set(handles.VelType_title,'Visible','on')
    21962208    FieldList=[set_field_list('U','V');{'C'};{'get_field...'}];%standard menu for civx data
    2197     CheckList=1;
     2209    %CheckList=1;
    21982210    set(handles.FieldName,'Value',1); %velocity vector choice by default
    21992211    if  VelTypeRequest_1 && numel(iview_civ)>=2
     
    23472359
    23482360%% NbSlice visibility
    2349 NbSliceVisible='off';%default
    2350 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 slices
     2361%NbSliceVisible='off';%default
     2362if isfield(ParamOut,'NbSlice') && (strcmp(ParamOut.NbSlice,'on')||isnumeric(ParamOut.NbSlice))
     2363    set(handles.num_NbSlice,'Visible','on')
     2364    set(handles.NbSlice_title,'Visible','on')
    23532365else
    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
     2371end
     2372if 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
     2375else
     2376    set(handles.num_NbSlice,'Enable','on'); % NbSlice can be modified on the GUI series
     2377end
     2378% set(handles.num_NbSlice,'Visible',NbSliceVisible)
     2379% set(handles.NbSlice_title,'Visible',NbSliceVisible)
    23582380
    23592381
     
    30033025%% create the function handle of the selected fct
    30043026if ~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
    30053031    current_dir=pwd;%current working dir
    30063032    cd(TransformPathList{TransformIndex})
     
    32943320end
    32953321
    3296 function num_NbProcess_Callback(hObject, eventdata, handles)
     3322%function num_NbProcess_Callback(hObject, eventdata, handles)
    32973323
    32983324
    32993325function num_NbSlice_Callback(hObject, eventdata, handles)
    33003326NbSlice=str2num(get(handles.num_NbSlice,'String'));
    3301 set(handles.num_NbProcess,'String',num2str(NbSlice))
     3327%set(handles.num_NbProcess,'String',num2str(NbSlice))
    33023328
    33033329%------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.