--nodes nodes to use
--array array mode (one of 'chdir' or 'xargs' or '')
--array-from file to read arrays from (default STDIN)
--nodes nodes to use
--array array mode (one of 'chdir' or 'xargs' or '')
--array-from file to read arrays from (default STDIN)
'ppn|processors-per-node=i',
'mem|memory=s',
'dir=s',
'debug|d+','help|h|?','man|m');
'ppn|processors-per-node=i',
'mem|memory=s',
'dir=s',
'debug|d+','help|h|?','man|m');
-pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
+# pod2usage(join("\n",@USAGE_ERRORS)) if @USAGE_ERRORS;
+print STDERR join("\n",@USAGE_ERRORS) and exit 1 if @USAGE_ERRORS;
# OK. Generate the options to qsub which we'll be using
my @qsub_options = generate_qsub_options(\%options);
# OK. Generate the options to qsub which we'll be using
my @qsub_options = generate_qsub_options(\%options);
@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-'. scalar @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-'. scalar @array;
}
call_qsub(\@qsub_options,write_qsub_script(\%options,\@ARGV,\@array));
}
}
call_qsub(\@qsub_options,write_qsub_script(\%options,\@ARGV,\@array));
}
}
push @qo,'-l',join(',',@l) if @l;
}
push @qo,'-l',join(',',@l) if @l;
- die "--array is currently not implemented";
+ my $array_opt = join("\n",@{$array});
+ $script .= <<EOF;
+OPT=\$(sed -n -e "\$PBS_ARRAYID p"<<'_HERE_DOC_END_'
+$array_opt
+_HERE_DOC_END_
+)
+EOF
+ if ($opt->{array} eq 'chdir') {
+ $script .= <<EOF;
+cd "\$OPT";
+exec $command;
+EOF
+ } else {
+ $script .= <<EOF;
+exec $command "\$OPT";
+EOF
+ }