#!/bin/csh # Purpose: To launch multiple serial/parallel batch jobs # (MATLAB, MATLAB standalone or any other executable). # Usage: scc1% submitmjobs i1 i2 j1 j2 batch_script "SGE options" # i1 -- starting index of outer loop # i2 -- ending index of outer loop # j1 -- starting index of inner loop # j2 -- ending index of inner loop # batch_script -- 1. batch_scc (serial/parallel MATLAB batch jobs) # 2. batch_standalone (MATLAB standalone batch jobs) # "SGE options"-- valid Sun Grid Engine batch options. # Example: # scc1% submitmjobs i1 i2 j1 j2 batch_scc "-l h_rt=09:00:00" # # In the above, running submitmjobs launches a series of jobs with a # wallclock limit of 9 hours for each of (i2-i1+1)*(j2-j1+1) tasks. The # optional input between quotes define/override any SGE options. # The Sun Grid Engine batch preserves the current dir in batch. # A different dir may also be used # cd my_dir if ($# == 0) then echo Usage is : submitmjobs i1 i2 j1 j2 batch_scc ... exit endif @ i1 = $1 @ i2 = $2 @ j1 = $3 @ j2 = $4 set batch_script = $5 set options = "$6" set myjob = myjob foreach i (`seq $i1 $i2`) setenv MATLAB_I $i foreach j (`seq $j1 $j2`) setenv MATLAB_J $j setenv JOBNAME $myjob\_$i\_$j qsub -N $JOBNAME $options -V $batch_script end end # The next job performs post processing AFTER the above jobs are done. # If you need this operation, remove # to activate #qsub -hold_jid "$myjob*" -V post_process_job # keep this line to ensure newline