sgeParallelSubmitFcn.m

function sgeParallelSubmitFcn(scheduler, job, props, runtime_limit) 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                  %
% Submit a parallel Matlab job to a SGE scheduler  %
%                                                  %
% Copyright 2007 ECDF System Team                  %
% University of Edinburgh                          %
%                                                  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%[dirpart] = fileparts( mfilename( 'fullpath' ) );
%scriptName = fullfile( dirpart, 'sgeParallelWrapper.sh' );

scriptName = sprintf('/exports/work/is_iti_ug/ywan/sgeParallelWrapper.sh');

logFile = fullfile( scheduler.DataLocation, ...
                    sprintf( 'Job%d.mpiexec.out', job.ID) );

cmdLine = sprintf('qsub -v \
  MDCE_DECODE_FUNCTION=sgeParallelDecode,\
  MDCE_STORAGE_LOCATION=%s,\
  MDCE_STORAGE_CONSTRUCTOR=%s,\
  MDCE_JOB_LOCATION=%s,\
  MDCE_DEBUG=true,\
  MDCE_CMR=%s,\
  MDCE_MATLAB_EXE=/exports/home/local/Cluster-Apps/matlab-mdce/3.1-r2007a/bin/worker,\
  MDCE_MATLAB_ARGS=-parallel,\
  MDCE_TOTAL_TASKS=%d \
  -cwd -N Job%d -j yes -o "%s" -l s_rt="%s" -pe matlab %d "%s"', ...
  props.StorageLocation, props.StorageConstructor, props.JobLocation, scheduler.ClusterMatlabRoot, \
  props.NumberOfTasks, job.ID, logFile, runtime_limit, props.NumberOfTasks, scriptName);

full_cmd = sprintf('ssh eddie.ecdf.ed.ac.uk %s', cmdLine);
    
disp(full_cmd);

[s, w] = system( full_cmd );

if s ~= 0
    warning( 'distcompexamples:generic:SGE', ...
        'Submit failed with the following message:\n%s', w);
else
        % The output of successful submissions shows the SGE job identifier%
    fprintf( 1, 'Job output will be written to: %s\nQSUB output: %s\n', logFile,
 w );
end

end


sgeParallelSubmitFcn.m (linux) (last edited 2007-11-29 12:12:50 by Yuan WAN)