source: trunk/selma/runjob

Last change on this file was 11, checked in by simon, 12 years ago

Two scripts for Selma.
delq: for deleting a batch of jobs.
runjob: for submitting a batch of jobs

  • Property svn:executable set to *
File size: 1.5 KB
Line 
1#!/bin/bash
2
3# This script starts jobs were the executable needs two numbers: an
4# index and the total number of jobs, i.e 'a.out 0 2', 'a.out 1 2',...
5# The script should be easy to change if other types of argument lists
6# are needed. The requested time per job and job name can also be
7# specified. Jobs will be named 'jobname0', 'jobname1', ...
8
9# usage: runjob -f exec -n nruns -t time -N name
10
11# There also default values for TIME, NRUNS, and NAME (see below)
12
13
14WORK_DIR=`pwd`
15
16# default values
17DEFNRUNS=10
18DEFTIME=100
19DEFNAME=job
20EXEC=""
21
22# error message if the script is called in the wrong way
23function usage {
24    echo
25    echo "usage: `basename $0` -f exec  -n nruns  -t time  -N name"
26    echo
27    echo "Default values: nruns = $DEFNRUNS"
28    echo "                time  = $DEFTIME"
29    echo "                name  = $DEFNAME"
30    echo
31    exit
32}
33
34# handle options to the script
35while getopts "f:n:t:N:" Option
36do
37  case $Option in
38      f) EXEC=$OPTARG ;; 
39      n) NRUNS=$OPTARG ;;
40      t) TIME=$OPTARG ;;
41      N) NAME=$OPTARG ;;
42      *) usage;;  # default
43  esac
44done
45
46# there has to be an executable
47if [ -z $EXEC ] ; then
48    echo "Error: No exectuble specified"
49    usage
50fi
51
52# assign default values if values are not given
53if [ -z $NRUNS ] ; then
54    NRUNS=$DEFNRUNS;
55fi
56if [ -z $TIME ] ; then
57    TIME=$DEFTIME;
58fi
59if [ -z $NAME ] ; then
60    NAME=$DEFNAME;
61fi
62
63# start jobs
64for ((i=0; i < $NRUNS; i++)) 
65do
66        echo "cd $WORK_DIR; $EXEC $i $NRUNS" | qsub -l walltime=$TIME:00:00 -N $NAME$i; 
67done
68
Note: See TracBrowser for help on using the repository browser.