--array array mode (one of 'chdir' or 'xargs' or '')
--array-from file to read arrays from (default STDIN)
--array-per-job number of array items to handle in each job (default 1)
+ --array-all-in-one-job Run all of the array items in one job
--ppn processors per node to use
--mem memory to request
--dir Directory to run the script in (default current directory)
'array_from|array-from=s',
'array_per_job|array-per-job=i',
'array_slot_limit|array-slot-limit=i',
+ 'array_all_in_one_job|array-all-in-one-job!',
'ppn|processors-per-node=i',
'mem|memory=s',
'dir=s',
if ($options{array}) {
@array = read_array_options(\%options) if $options{array};
# the -t option gives the range of elements for an array job
- push @qsub_options,'-t','1-'. ceil(scalar @array / $options{array_per_job});
- if ($options{array_slot_limit}) {
- $qsub_options[$#qsub_options] .= '%'.$options{array_slot_limit};
+ if ($options{array_all_in_one_job}) {
+ $options{array_per_job} = scalar @array;
+ } else {
+ push @qsub_options,'-t','1-'. ceil(scalar @array / $options{array_per_job});
+ if ($options{array_slot_limit}) {
+ $qsub_options[$#qsub_options] .= '%'.$options{array_slot_limit};
+ }
}
}
call_qsub(\@qsub_options,write_qsub_script(\%options,\@ARGV,\@array));
$script .= <<EOF;
for i in \$(seq 1 $opt->{array_per_job}); do
# in some cases, the jobs aren't going to come out evenly. Handle that.
-JOBNUM=\$(( \$PBS_ARRAYID * $opt->{array_per_job} + \$i - $opt->{array_per_job} ))
+JOBNUM=\$(( \${PBS_ARRAYID:=1} * $opt->{array_per_job} + \$i - $opt->{array_per_job} ))
if [ \$JOBNUM -le $max_array ]; then
OPT=\$(sed -n -e "\$JOBNUM p"<<'_HERE_DOC_END_'
EOF
} else {
$script .= <<EOF;
-OPT=\$(sed -n -e "\$PBS_ARRAYID p"<<'_HERE_DOC_END_'
+OPT=\$(sed -n -e "\${PBS_ARRAYID:=1} p"<<'_HERE_DOC_END_'
EOF
}
$script .= <<EOF;