Cleanup in contech runtime
Modify middle layer to write out initial serial section

The middle layer had waited until all tasks were available before writing any
to disk, to ensure BFS / temporal ordering.  Given that all graphs start
will 1 or more tasks from Context 0 before the first create task, these tasks
are fully ordered just using BFS and can be written out.  This helps lower
the memory usage and speed up the middle layer.
Add TaskGraph call to get number of tasks in graph
Switch middle layer to use define for basic blocks in task threshold