List top-level cells with tasks
This implements the idea behind #373 (closed) and should help with #366.
In this branch we:
- At rebuild time, construct a list of the top-level cells that have at least one task somewhere in their hierarchy.
- When unskipping tasks, launch the threadpool on this list rather than on the whole set of top-level cells.
- When collecting the ti_end_min, use the threadpool on this list.
One thing I am not very happy with is the last point. We don't have an elegant way of doing a reduction over the threadpool. The current version should be better than the old, scalar, version but we could reduce the number of locks by having a more advanced mechanism. Would require quite a bit of change to the threadpool infrastructure though.
Other possible improvements:
- Use the list of cells with tasks also when rebuilding.
- Use a similar list when splitting in the rebuild as we don't need to launch threads on empty top-level cells.
- Use a more advanced list (constructed each step during unskip) that contains only the active local cells to speed-up the collection of time-steps.