Changeset 467 for trunk/src


Ignore:
Timestamp:
Jun 21, 2012, 8:42:26 PM (12 years ago)
Author:
sommeria
Message:

options 'local,background,cluster' introduced in civ

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ.m

    r465 r467  
    2424%TODO: search range
    2525
    26 % Last Modified by GUIDE v2.5 03-Jun-2012 22:16:42
     26% Last Modified by GUIDE v2.5 21-Jun-2012 20:22:39
    2727% Begin initialization code - DO NOT EDIT
    2828gui_Singleton = 1;
     
    7777    test_batch=strcmp(sparam.BatchParam.BatchMode,'sge'); %sge is currently the only implemented batch mod
    7878end
     79RUNVal=get(handles.RunMode,'Value');
    7980if test_batch==0
    80     set(handles.BATCH,'Enable','off')% put the BATCH button in grey (unactivated)
    81     set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])% put the BATCH button in grey (unactivated)
     81   if RUNVal>2
     82       set(handles.RunMode,'Value',1)
     83   end
     84   set(handles.RunMode,'String',{'local';'background'})
     85else
     86    set(handles.RunMode,'String',{'local';'background';'cluster'})
     87%     set(handles.BATCH,'Enable','off')% put the BATCH button in grey (unactivated)
     88%     set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])% put the BATCH button in grey (unactivated)
    8289end
    8390if isfield(sparam.RunParam,'CivBin')
     
    804811set(handles.RUN, 'Enable','Off')
    805812set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784])
    806 batch=0;
     813batch=get(handles.RunMode,'Value');
     814% batch=0;
    807815errormsg=launch_jobs(hObject, eventdata, handles,batch);
    808816set(handles.RUN, 'Enable','On')
     
    817825    status_Callback(hObject, eventdata, handles)
    818826end
    819 
    820 %------------------------------------------------------------------------
    821 % --- Executes on button press in BATCH: remote processing
    822 function BATCH_Callback(hObject, eventdata, handles)
    823 % -----------------------------------------------------------------------
    824 set(handles.BATCH, 'Enable','Off')
    825 set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])
    826 batch=1;
    827 errormsg=launch_jobs(hObject, eventdata, handles, batch);
    828 set(handles.BATCH, 'Enable','On')
    829 set(handles.BATCH,'BackgroundColor',[1 0 0])
    830 
    831 % display errors or start status callback to visualise results
    832 if ~isempty(errormsg)
    833     display(errormsg)
    834     msgbox_uvmat('ERROR',errormsg)
    835 elseif isfield(handles,'status')
    836     set(handles.status,'Value',1);%suppress status display
    837     status_Callback(hObject, eventdata, handles)
    838 end
     827%
     828% %------------------------------------------------------------------------
     829% % --- Executes on button press in BATCH: remote processing
     830% function BATCH_Callback(hObject, eventdata, handles)
     831% % -----------------------------------------------------------------------
     832% set(handles.BATCH, 'Enable','Off')
     833% set(handles.BATCH,'BackgroundColor',[0.831 0.816 0.784])
     834% batch=1;
     835% errormsg=launch_jobs(hObject, eventdata, handles, batch);
     836% set(handles.BATCH, 'Enable','On')
     837% set(handles.BATCH,'BackgroundColor',[1 0 0])
     838%
     839% % display errors or start status callback to visualise results
     840% if ~isempty(errormsg)
     841%     display(errormsg)
     842%     msgbox_uvmat('ERROR',errormsg)
     843% elseif isfield(handles,'status')
     844%     set(handles.status,'Value',1);%suppress status display
     845%     status_Callback(hObject, eventdata, handles)
     846% end
    839847
    840848%-------------------------------------------------------------------
     
    10901098end
    10911099test_interp=0; %eviter les variables test_ (LG)
    1092 if batch
     1100if batch==3 %computation dispatched on a cluster
    10931101    if isfield(s,'BatchParam')
    10941102        Param.xml=s.BatchParam;
     
    11141122
    11151123%% check batch mode supported
    1116 if batch
     1124if batch==3 %computation dispatched on a cluster
    11171125    switch batch_mode
    11181126        case 'sge'
     
    11871195
    11881196%% create subfolders for log, cmx, nml, xml, bat
    1189 RootBat=fileparts(filecell.nc.civ1{1,1})
    1190 dir_list={'0_BAT','0_CMX','0_XML','0_LOG',}
     1197RootBat=fileparts(filecell.nc.civ1{1,1});
     1198dir_list={'0_BAT','0_CMX','0_XML','0_LOG'};
    11911199for k=1:length(dir_list)
    11921200    if ~exist(fullfile(RootBat,dir_list{k}),'dir')
     
    13961404%% start calculation
    13971405
    1398 if batch
     1406if batch ==3
    13991407    switch batch_mode   
    14001408        case 'sge' %at the moment only psmn ENS Lyon uses it
     
    15401548                    return
    15411549                end
     1550               
     1551                fprintf(fid,['#!/bin/bash \n' ...
     1552                 '/etc/sysprofile \n'...
     1553                'matlab -nodisplay -nosplash -nojvm <<END_MATLAB \n']);
     1554 
     1555               
    15421556                fprintf(fid,['addpath(''' path_civ ''');\n']);
    15431557                for p=1:length(batch_file_list)
     
    15501564                   
    15511565                end
     1566                fprintf(fid, 'exit \n END_MATLAB \n');
     1567
    15521568                fclose(fid);
    1553                  eval(['run ' filename_superbat]);                     
     1569                 eval(['run ' filename_superbat]);               
     1570                 
    15541571            else
    15551572                for p=1:length(batch_file_list)
     
    43744391
    43754392if isequal(Param.CivMode,'Matlab')
    4376     if batch
     4393    if batch>1
    43774394        cmd=['#!/bin/bash \n '...
    43784395            '#$ -cwd \n '...
     
    45734590
    45744591
    4575 
     4592% --- Executes on selection change in RunMode.
     4593function RunMode_Callback(hObject, eventdata, handles)
Note: See TracChangeset for help on using the changeset viewer.