@@ -52,10 +52,12 @@ mkdir -p batch-scripts/
52
52
# Slurm: if sinfo is present, assume slurm works.
53
53
# SGE: if SGE_ROOT exists in the environment, assume SGE works.
54
54
# LSF: if LSF_ENVDIR exists in the environment, assume LSF works.
55
+ # PBS: if pbsnodes present, assume PBS works
55
56
#
56
57
slurm=$( which sinfo 2> /dev/null)
57
58
sge=$SGE_ROOT
58
59
lsf=$LSF_ENVDIR
60
+ pbs=$( which pbsnodes 2> /dev/null)
59
61
60
62
# #########
61
63
#
@@ -141,17 +143,39 @@ elif [ "x$lsf" != "x" ] ; then
141
143
else
142
144
mem=$( dc -e " 3 k ${mem_gb} 1048576 * p" )
143
145
fi
146
+ mem_per_thread=$( dc -e " 0 k ${mem} ${n_cpus} / p" )
144
147
145
- jobid=$( bsub -R " span[hosts=1] rusage[mem=${mem} ]" -n ${n_cpus} -oo batch-scripts/${jobid} .${rule_n} .${jobidx} .out " $@ " | grep -oE " Job <[0-9]+>" | awk ' {print $2}' | tr -d ' <>' )
148
+ jobid=$( bsub -R \" span[hosts= 1] rusage[mem= ${mem_per_thread} ]\" -n ${n_cpus} -oo batch-scripts/${jobid} .${rule_n} .${jobidx} .out " $@ " | sed -E ' s/.*<([0-9]+)>.*/\1/' )
149
+ if [ " x$jobid " = " x" ]; then
150
+ exit 1
151
+ fi
152
+
153
+ echo > batch-scripts/${jobid} .${rule_n} .${jobidx} .submit \
154
+ bsub -R \" span[hosts= 1] rusage[mem= ${mem_per_thread} ]\" -n ${n_cpus} -oo batch-scripts/${jobid} .${rule_n} .${jobidx} .out " $@ "
155
+
156
+ # Submit to PBS.
157
+ # Other options:
158
+ # -A account
159
+ # -q queue
160
+ # -N job name
161
+ # -e err-out
162
+ # -o out-out
163
+ #
164
+ elif [ " x$pbs " != " x" ] ; then
165
+ jobid=$( qsub -j oe -l select=1:ncpus=${n_cpus} :mem=${mem_gb} gb:walltime=${time_h} :00:00 -o batch-scripts/${jobid} .${rule_n} .${jobidx} .out " $@ " | cut -d. -f1)
166
+ if [ " x$jobid " = " x" ]; then
167
+ exit 1
168
+ fi
146
169
147
170
echo > batch-scripts/${jobid} .${rule_n} .${jobidx} .submit \
148
- bsub -R " span[hosts=1] rusage[mem =${mem} ] " -n ${n_cpus} -oo batch-scripts/${jobid} .${rule_n} .${jobidx} .out " $@ "
171
+ qsub -j oe -l select=1:ncpus =${n_cpus} : mem= ${mem_gb} gb:walltime= ${time_h} :00:00 -o batch-scripts/${jobid} .${rule_n} .${jobidx} .out " $@ "
149
172
150
173
# #########
151
174
#
152
175
# Otherwise, fail.
153
176
#
154
177
else
178
+ echo " Error: unknown grid, only Slurm, SGE, LSF, and PBS are supported. Please check your environment or use --local instead"
155
179
exit 1
156
180
fi
157
181
0 commit comments