Changeset 882 for trunk/src/series.m


Ignore:
Timestamp:
Mar 10, 2015, 2:38:09 PM (10 years ago)
Author:
gostiaux
Message:

Added option for PBS job scheduler at LMFA

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r880 r882  
    150150    set(handles.MonitorCluster,'Visible','on'); % make visible button for access to Monika
    151151end
    152 [s,w]=system('qstat');% look for cluster system 'sge'
     152[s,w]=system('qstat --version');% look for cluster system 'sge'
    153153if isequal(s,0)
    154     RunModeList=[RunModeList;{'cluster_sge'}];
     154    if regexp(w,'^pbs')
     155        RunModeList=[RunModeList;{'cluster_pbs'}];
     156    else
     157        RunModeList=[RunModeList;{'cluster_sge'}];
     158    end
    155159end
    156160set(handles.RunMode,'String',RunModeList)
     
    15441548            NbCore=str2double(answer{1});
    15451549            extra_oar=answer{2};
     1550        end
     1551    case 'cluster_pbs'
     1552        if strcmp(ActionExt,'.m')% case of Matlab function (uncompiled)
     1553            NbCore=1;% one core used only (limitation of Matlab licences)
     1554            answer=msgbox_uvmat('INPUT_Y-N','Number of cores =1: select the compiled version .sh for multi-core processing. Proceed with the .m version?');
     1555            if ~strcmp(answer,'Yes')
     1556                errormsg='Action launch interrupted';
     1557                return
     1558            end
     1559            extra_oar='';
     1560        else
     1561            answer=inputdlg({'Number of cores (max 36)','extra oar options'},'oarsub parameter',1,{'12',''});
     1562            NbCore=str2double(answer{1});
     1563            %extra_oar=answer{2};%TODO : fix this for LMFA cluster. Maybe
     1564            %extrs_oar and extra_pbs are not the best names
    15461565        end
    15471566end
     
    18891908        system(oar_command); 
    18901909        msgbox_uvmat('CONFIRMATION',[ActionName ' launched in cluster: press STATUS to see results'])
     1910    case 'cluster_pbs' % for LMFA Kepler machine
     1911        %create subdirectory for pbs command and log files
     1912        DirPBS=fullfile(OutputDir,'0_PBS'); %todo : common name OAR/PBS
     1913        if exist(DirPBS,'dir')% delete the content of the dir 0_OAR to allow new input
     1914            curdir=pwd;
     1915            cd(DirPBS)
     1916            delete('*')
     1917            cd(curdir)
     1918        else
     1919            [tild,msg1]=mkdir(DirPBS);
     1920            if ~strcmp(msg1,'')
     1921                errormsg=['cannot create ' DirPBS ': ' msg1];%error message for directory creation
     1922                return
     1923            end
     1924        end
     1925        max_walltime=3600*20; % 20h max total calculation (cannot exceed 24 h)
     1926        walltime_onejob=600;%seconds, max estimated time for asingle file index value
     1927        filename_joblist=fullfile(DirPBS,'job_list.txt');%create name of the global executable file
     1928        fid=fopen(filename_joblist,'w');
     1929        for p=1:length(batch_file_list)
     1930            fprintf(fid,[batch_file_list{p} '\n']);% list of exe files
     1931        end
     1932        fclose(fid);
     1933        system(['chmod +x ' filename_joblist]);% set the file to executable
     1934        pbs_command=['qstat -n CIVX '...
     1935            '-t idempotent --checkpoint ' num2str(walltime_onejob+60) ' '...
     1936            '-l /core=' num2str(NbCore) ','...
     1937            'walltime=' datestr(min(1.05*walltime_onejob/86400*max(NbProcess*BlockLength*nbfield_j,NbCore)/NbCore,max_walltime/86400),13) ' '...
     1938            '-E ' regexprep(filename_joblist,'\.txt\>','.stderr') ' '...
     1939            '-O ' regexprep(filename_joblist,'\.txt\>','.stdout') ' '...
     1940            extra_oar ' '...
     1941            '"oar-parexec -s -f ' filename_joblist ' '...
     1942            '-l ' filename_joblist '.log"\n'];
     1943        filename_oarcommand=fullfile(DirPBS,'pbs_command');
     1944        fid=fopen(filename_oarcommand,'w');
     1945        fprintf(fid,pbs_command);
     1946        fclose(fid);
     1947        fprintf(pbs_command);% display in command line
     1948        %system(pbs_command); 
     1949        msgbox_uvmat('CONFIRMATION',[ActionName ' command ready to be launched in cluster'])       
    18911950    case 'python'
    18921951        command = [
Note: See TracChangeset for help on using the changeset viewer.