Part of lp.services.looptuner View In Hierarchy
To construct a self-tuning batched loop, define your loop body as a class implementing TunableLoop, and pass an instance to your LoopTuner.
Method | isDone | Is this loop finished? |
Method | __call__ | Perform an iteration of the loop. |
Method | cleanUp | Clean up any open resources. |
Once this returns True, the LoopTuner will no longer touch this object.
The chunk_size parameter says (in some way you define) how much work the LoopTuner believes you should try to do in this iteration in order to get as close as possible to your time goal.
Note that chunk_size is a float, so, for example, if you use it to slice a list, be careful to round it to an int first.