File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -1365,7 +1365,14 @@ namespace driver {
1365
1365
size_t NumTasks = TQ->getNumberOfParallelTasks ();
1366
1366
size_t NumFiles = PendingExecution.size ();
1367
1367
size_t SizeLimit = Comp.getBatchSizeLimit ().getValueOr (DefaultSizeLimit);
1368
- return std::max (NumTasks, NumFiles / SizeLimit);
1368
+
1369
+ // An explanation of why the partition calculation isn't simple division.
1370
+ // Using the default limit as an example, a module of 26 files must be
1371
+ // compiled in 2 batches. Simple division yields 26/25 = 1 batch, but a
1372
+ // single batch of 26 would exceed the limit of 25. To round up, the
1373
+ // calculation is: `(x - 1) / y + 1`.
1374
+ size_t NumPartitions = (NumFiles - 1 ) / SizeLimit + 1 ;
1375
+ return std::max (NumTasks, NumPartitions);
1369
1376
}
1370
1377
1371
1378
// / Select jobs that are batch-combinable from \c PendingExecution, combine
You can’t perform that action at this time.
0 commit comments