Ok so it was my rounding all along! :-)
Specifically it's this line which was iffy -
Code:
partition_size = (int)((global_bounds->upper - global_bounds->lower)/total_thr)+1;
By choosing to do the arithmetic in float's, then truncate to an int at the very last minute is the way to go -
Code:
partition_size = ((float)(global_bounds->upper - global_bounds->lower)/(float)total_cpus)+0.5;
The subtle ones are always the best! :-)
-c