1 #!/bin/ksh
2 #
3 # default argument settings
4 #
5 nodes=4
6 class=dev
7 adaptor=hps_ip
8 arg="-euilib ip"
9 pool=2
10 root=`(cd ../..;pwd)`
11 here=`pwd`
12 chemsh=/h/psh/chemsh
13 exe=$chemsh/bin/chemsh.x.no_tk
14 dir=/scratch/$USER
15 port=7000
16 #
17 use="[ -n nodes ] [-q|c class ] [-a adaptor] [-p pool] [-e executable] [-d directory] job "
18 #
19 # process command line options
20 #
21 while getopts :q:c:p:P:n:a:e:d: opt ; do
22 case $opt in
23 q) class=$OPTARG;;
24 c) class=$OPTARG;;
25 n) nodes=$OPTARG;;
26 p) pool=$OPTARG;;
27 P) port=$OPTARG;;
28 a) adaptor=$OPTARG;;
29 e) exe=$OPTARG;;
30 d) dir=$OPTARG;;
31 ?) echo usage: $0 $use;;
32 esac
33 done
34 #
35 # remaining arg should be the job name
36 #
37 let nshift=OPTIND-1
38 shift $nshift
39 if test $# -ne 1 ; then
40 echo usage: $0 $use
41 exit
42 fi
43 jobname=$1
44 inputfile=$1
45 #
46 # If the user has .chm, .chem or .chemsh as extension, strip them
47 # off
48 #
49 trailer=`echo $jobname | awk -F. '{print $NF}'`
50 if test $trailer = chem; then
51 jobname=`echo $jobname | sed 's/\.chem//' `
52 elif test $trailer = chemsh; then
53 jobname=`echo $jobname | sed 's/\.chemsh//' `
54 elif test $trailer = chm; then
55 jobname=`echo $jobname | sed 's/\.chm//' `
56 fi
57 #
58 # make pool and euilib consistent with adaptor
59 #
60 case $adaptor in
61 hps_user)
62 arg="-euilib us"
63 if [[ $pool = 2 ]]
64 then
65 pool=1
66 fi
67 if [[ $class = dev ]]
68 then
69 class=short
70 fi;;
71 hps_ip)
72 ;;
73 *) echo invalid adaptor $adaptor - must hps_user or hps_ip
74 esac
75 #
76 # list settings
77 #
78 echo 'job = ' $jobname
79 echo 'adaptor = ' $adaptor
80 echo 'exe = ' $exe $arg
81 echo 'class = ' $class
82 echo 'pool = ' $pool
83 echo 'nodes = ' $nodes
84 echo 'direc = ' $here
85 #echo 'scratch = ' $dir
86 #
87 # produce loadleveller script
88 #
89 echo '#@ min_processors = ' $nodes > ${jobname}.script
90 echo '#@ max_processors = ' $nodes >> ${jobname}.script
91 echo '#@ output = ' $here/${jobname}.out >> ${jobname}.script
92 echo '#@ error = ' $here/${jobname}.err >> ${jobname}.script
93 echo '#@ job_type = parallel' >> ${jobname}.script
94 echo '#@ requirements = (Adapter == "'$adaptor'") && (Pool == '$pool')' >> ${jobname}.script
95 #echo '#@ arguments = '$exe $arg >> ${jobname}.script
96 #echo '#@ input = ' $here/$inputfile >> ${jobname}.script
97 echo '#@ initialdir = '$here >> ${jobname}.script
98 echo '#@ class = ' $class >> ${jobname}.script
99 echo '#@ environment = MP_CSS_INTERRUPT=yes' >> ${jobname}.script
100 echo '#@ queue' >> ${jobname}.script
101 echo export TCLLIBPATH=$chemsh/tcl >> ${jobname}.script
102 echo /usr/bin/poe $exe $arg $inputfile >> ${jobname}.script
103 #
104 # submit to the queue
105 #
106 llsubmit ${jobname}.script

