|
Peano
|
Functions | |
| List["peano4.api.solversteps.Step"] | translate (Graph graph, str identifier, "peano4.api.Project" peano_project) |
| Simplest possible task graph compiler. | |
| List["peano4.api.solversteps.Step"] peano4.api.taskgraph.compiler.Sequential.translate | ( | Graph | graph, |
| str | identifier, | ||
| "peano4.api.Project" | peano_project | ||
| ) |
Simplest possible task graph compiler.
Linearises the task graph into one mesh traversal (Observer) per task, in an order that respects every dependency: a task's Observer always comes after the Observers of all tasks it depends on. This throws away any parallelism the task graph might encode - it is the "no fusion, no reordering" baseline compiler that smarter compilers can be measured against.
A straightforward, direct mapping: graph.ordered_tasks() linearises the graph's tasks into a valid topological order (a task always comes after every task it depends on -
Note that this function no longer derives any further use_cell()/ use_face()/use_vertex() declarations itself - that is the job of peano4.api.taskgraph.compiler.PropagateUseStatements.propagate_use_statements(), which has to run before translate() (it reasons about tasks, not the Steps translate() produces here, and about the composability of several graphs at once, which a single graph's own translate() call cannot see). By the time translate() runs, every task already carries every use_cell()/use_face()/use_vertex() declaration it will ever need.
A peano4.api.Logger().new_section() call brackets the translation, and peano4.api.taskgraph.compiler.ReportCompiledStepSequence.report_compiled_step_sequence() reports its outcome right after - a textual listing of the resulting sequence and its action sets under LoggerVerbosity.TEXT, or a flow chart in the same style as Graph.visualise() under LoggerVerbosity.VISUALISATION.
| graph | peano4.api.taskgraph.Graph The task graph to linearise. Assumed to be acyclic - translate() does not check for cycles and will recurse indefinitely on one. |
| identifier | str Identifies which of the surrounding project's algorithmic phases this graph belongs to (e.g. "SetupSimulation", "TimeStep", "Plot"). Every generated Observer's name is prefixed with this identifier, joined by an underscore, so Observers coming from different phases never clash even if their tasks happen to share a name. |
| peano_project | peano4.api.Project Not used by this compiler. peano4.api.taskgraph.compiler |
Definition at line 13 of file Sequential.py.