PEXUtils.kl

Functions

GetBatchSizeAndCountForParallel

GetBatchSizeAndCountForParallel ( in Size numIndices, in Size workloadMultiplier, in Size minBatchSize, io Size numBatches, io Size batchSize )

This function can be used to compute a batchsize for a given number of tasks.

/*
** Example: GetBatchSizeAndCountForParallel
*/

require Util;
  
operator entry() {

  Size numTasks = 100;
  Size minBatchSize = 4;
  Size numBatches, batchSize;
  GetBatchSizeAndCountForParallel(numTasks, minBatchSize, 12, numBatches, batchSize);
  report('numBatches: '+numBatches);
  report('batchSize: '+batchSize);
  
}

/*
** Output:

numBatches: 8
batchSize: 13

*/