#!/bin/csh # # Purpose: Running this script launches multiple serial jobs in batch. # Usage: scc1% submitmjobs ntasks batch_script "SGE options" # Runtime input parameters to submitmjobs: # ntime -- number of iterations per job # ntasks -- the number of tasks submitted to batch queue # batch_script -- such as run_matlab_job, run_standalone_job for MATLAB apps # it can also be used for other applications # The OPTIONAL input must be valid SGE batch parameters. # Examples: # scc1% submitmjobs 1 run_standalone_job "-pe omp 4" # scc1% submitmjobs 1 run_matlab_pct_job "-pe omp 4" # scc1% submitmjobs 2 run_matlab_job # # In the above, running submitmjobs launches 1 run_standalone_job or run_matlab_pct_job # Each of the two examples uses 4 cores with omp. # Each of the ntasks is assigned a unique index, task, ranged # between 1 and ntasks. It is up to you to use these parameters to dictate what you want # to do. You can add additional loops or parameters if need be. # # 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 ntasks run_standalone_job "SGE options" exit endif @ ntasks = $1 set batch_script = $2 set options = "$3" # Name your batch job; otherwise default to script name set myjob = myJob foreach task (`/usr/bin/seq $ntasks`) setenv MATLAB_TASK $task # pass MATLAB_TASK to $batch_script # e.g., run_matlab_job, run_standalone_job, run_matlab_pct_job qsub -N $myjob$task $options -V $batch_script end