Index: /tags/ipp-20150115/ippScripts/scripts/sc_prepare_run.pl
===================================================================
--- /tags/ipp-20150115/ippScripts/scripts/sc_prepare_run.pl	(revision 37918)
+++ /tags/ipp-20150115/ippScripts/scripts/sc_prepare_run.pl	(revision 37919)
@@ -218,8 +218,11 @@
 
 # Construct the moab command last, so we can use the job_index counter to estimate resources.  Somehow.
+if (($stage eq "stack")||($stage eq "staticsky")) {
+    $threads = $job_subscription{$stage};  # Put this here instead of after the calculation to prevent underutilization
+}
 my $proc_need = $job_index * $threads;       # how many total processors do we need?
 my $node_need = $proc_need / $proc_per_node; # this equals how many nodes?
 my $time_need = $job_index * $job_cost{$stage};      # How many seconds will this take?
-
+print STDERR "## $job_index $threads $proc_need $node_need $time_need\n";
 my $fill_factor = 0.8;  # This is the factor of how much of the time allocation we'd like to fill
 my ($time_req,$node_req);
@@ -227,4 +230,5 @@
     $time_req = $min_time;
     $node_req = $min_nodes;
+    print STDERR "CASE 1\n";
 }
 elsif ($node_need * $job_cost{$stage} > $fill_factor * $max_nodes * $max_time) {
@@ -235,9 +239,13 @@
 else {
     $time_req = int(($node_need * $job_cost{$stage}) / ($fill_factor * $max_nodes)) + 1;
+    if ($time_req < $job_cost{$stage}) {
+	$time_req = $job_cost{$stage} + 1;
+    }
     $node_req = int(($node_need * $job_cost{$stage}) / ($fill_factor * $time_req)) + 1;
-}
-
+    print STDERR "CASE 3\n";
+}
+print STDERR "## $job_index $threads $proc_need $node_need $time_need $time_req $node_req\n";
 # Most jobs only take 1 core, but ensure that we split them appropriately
-$node_req *= $job_subscription{$stage};
+# $node_req *= $job_subscription{$stage};
 
 if (($stage eq "stack")||($stage eq "staticsky")) {
