|
Peano
|
Functions | |
| List["peano4.api.solversteps.Step"] | translate (Graph graph, str identifier, "peano4.api.Project" peano_project, Optional[List[Tuple[Task, Task]]] non_fusable_task_pairs=None) |
| Task graph compiler which fuses tasks into as few mesh traversals as possible. | |
| bool | _have_conflicting_data (List[Task] tasks, List[Task] further_tasks, bool include_cell_data=False, bool respect_entity_order=False) |
| Check whether two sets of tasks can not share one mesh traversal due to their face or vertex data, or can not run in parallel. | |
| str | _task_name (Task task) |
| Turn every whitespace-separated word into its own name segment, capitalising only its first letter - a blind .title() would also lower-case the rest of the word, which mangles existing camel case and acronyms (e.g. | |
| "Task.DataAccess" | _merge_data_access (List["Task.DataAccess"] accesses) |
| Merge the qualifiers several fused tasks attach to one submodel into one. | |
| "peano4.api.solversteps.Step" | _create_step (List[List[Task]] nodes, str identifier) |
| Create one step from a group of fused nodes. | |
| bool | _is_parallel_node (List[Task] node) |
| A node is parallel if it holds more than one task and each task holds exactly one action set. | |
|
protected |
Create one step from a group of fused nodes.
peano4.api.taskgraph.compiler.FuseSteps.translate()
Every node is a list of tasks: either a single task, or several tasks from one layer of the task graph which can run in parallel.
Whenever a parallel node directly follows another parallel node, we insert a peano4.api.solversteps.SynchroniseActionSets.SynchroniseActionSets, so the two nodes yield two task groups rather than one.
Definition at line 426 of file FuseSteps.py.
References peano4.api.taskgraph.compiler.FuseSteps._is_parallel_node(), peano4.api.taskgraph.compiler.FuseSteps._merge_data_access(), and peano4.api.taskgraph.compiler.FuseSteps._task_name().
Referenced by peano4.api.taskgraph.compiler.FuseSteps.translate().


|
protected |
Check whether two sets of tasks can not share one mesh traversal due to their face or vertex data, or can not run in parallel.
True if one of the tasks writes a face or vertex submodel (WRITE or READ_AND_WRITE) which one of the further_tasks reads or writes (READ_AND_DISCARD, WRITE or READ_AND_WRITE), or vice versa. TEMPORARY uses are ignored. peano4.api.taskgraph.compiler.FuseSteps.translate()
| include_cell_data | bool If False, cell data is ignored. This is the check whether tasks can share one mesh traversal. If True, conflicting cell data counts, too. This is the check whether tasks can run in parallel. |
| respect_entity_order | bool If True, tasks precede further_tasks within one traversal, and a conflict on a face (vertex) submodel is ignored if the involved task of tasks is a FACE (VERTEX) task: Such a task has finished with a face (vertex) before any subsequent task sees it. This is the exception of constraint 2 in peano4.api.taskgraph.compiler.FuseSteps.translate(). If False, tasks and further_tasks are treated symmetrically. |
Definition at line 321 of file FuseSteps.py.
Referenced by peano4.api.taskgraph.compiler.FuseSteps.translate().

|
protected |
A node is parallel if it holds more than one task and each task holds exactly one action set.
peano4.api.taskgraph.compiler.FuseSteps.translate()
Definition at line 477 of file FuseSteps.py.
Referenced by peano4.api.taskgraph.compiler.FuseSteps._create_step(), and peano4.api.taskgraph.compiler.FuseSteps.translate().

|
protected |
Merge the qualifiers several fused tasks attach to one submodel into one.
TEMPORARY uses are ignored. The fused step has to load the submodel if the first remaining use reads it (READ_AND_DISCARD or READ_AND_WRITE), and it has to store the submodel if the last remaining use writes it (WRITE or READ_AND_WRITE):
| load | store | merged qualifier |
|---|---|---|
| yes | yes | READ_AND_WRITE |
| yes | no | READ_AND_DISCARD |
| no | yes | WRITE |
| no | no | TEMPORARY |
A submodel produced by one fused task and consumed by a later one (WRITE followed by READ_AND_DISCARD) hence becomes TEMPORARY. For a single access, the merged qualifier equals the access itself.
Definition at line 390 of file FuseSteps.py.
Referenced by peano4.api.taskgraph.compiler.FuseSteps._create_step().

|
protected |
Turn every whitespace-separated word into its own name segment, capitalising only its first letter - a blind .title() would also lower-case the rest of the word, which mangles existing camel case and acronyms (e.g.
"EulerFVSmooth" would become "Eulerfvsmooth").
Definition at line 378 of file FuseSteps.py.
Referenced by peano4.api.taskgraph.compiler.FuseSteps._create_step().

| List["peano4.api.solversteps.Step"] peano4.api.taskgraph.compiler.FuseSteps.translate | ( | Graph | graph, |
| str | identifier, | ||
| "peano4.api.Project" | peano_project, | ||
| Optional[List[Tuple[Task, Task]]] | non_fusable_task_pairs = None |
||
| ) |
Task graph compiler which fuses tasks into as few mesh traversals as possible.
You can use this task graph compiler in your ExaHyPE 2 project through
Where peano4.api.taskgraph.compiler.Sequential.translate() maps every task onto a mesh traversal (Observer) of its own, this compiler packs several tasks into one traversal whenever this is safe.
Two tasks end up in the same traversal if and only if all of the following constraints hold:
The illustrations below are generated by src/peano4/api/taskgraph/compiler/fuse-steps-illustrations.py. Each shows the input task graph on top and the compiled sequence of traversals underneath.
A chain of tasks working on a vertex, a face, a cell, a vertex and a cell. The vertex, face and cell tasks are fused into one traversal. The second vertex task has to start a new traversal, which also takes the subsequent cell task.
Two independent vertex tasks form one layer and hence one parallel node. They are fused with the two independent cell tasks of the subsequent layer. Action sets which may run in parallel share a number and are told apart by letters, e.g. 1.a and 1.b.
The time step of an ExaHyPE 2 Finite Volume solver: the reconstruction reads the face data that the projection eventually writes. Therefore, the projection cannot be fused with the reconstruction and the update, and starts a traversal of its own.
A FACE task sets boundary data on the faces, which the subsequent reconstruction reads. As the face task is done with a face before either adjacent cell is entered, all three tasks share one traversal even though the first two share face data.
A fused step's name concatenates the names of its tasks, prefixed with identifier. Its action sets are the tasks' action sets one after the other, so the evaluation order of the tasks is preserved. We do not use peano4.api.solversteps.Step.add_action_set() for this, as it reorders the action sets according to their descend_invocation_order: a reconstruction with a higher descend_invocation_order would then overtake the update of the subsequent task. The descend_invocation_order is applied (stably) only among the action sets of one task.
The generated observer spawns consecutive action sets which are labelled as parallel as one task group (peano4.api.solversteps.SynchroniseActionSets.get_task_groups()). If two parallel nodes follow each other directly within a step, their groups would merge. We therefore insert a peano4.api.solversteps.SynchroniseActionSets.SynchroniseActionSets between them - peano4.api.taskgraph.compiler.FuseSteps._create_step().
A submodel used by several tasks of a fused step is declared once on the step. Its qualifier is merged from the tasks' qualifiers: TEMPORARY uses are ignored, the step loads the submodel if the first remaining use reads it, and stores it if the last remaining use writes it - peano4.api.taskgraph.compiler.FuseSteps._merge_data_access().
propagate_use_statements() is not invoked here. It is a postprocessing step called outside of the translation.
| graph | peano4.api.taskgraph.Graph The task graph to compile. Assumed to be acyclic. |
| identifier | str Identifies which of the surrounding project's algorithmic phases this graph belongs to (e.g. "SetupSimulation", "TimeStep", "Plot") and prefixes every generated Observer's name. |
| peano_project | peano4.api.Project Not used by this compiler. peano4.api.taskgraph.compiler |
| non_fusable_task_pairs | [(peano4.api.taskgraph.Task, peano4.api.taskgraph.Task)] Pairs of tasks of graph which must not end up in the same traversal. The order within a pair does not matter. Defaults to none. |
Definition at line 13 of file FuseSteps.py.
References peano4.api.taskgraph.compiler.FuseSteps._create_step(), peano4.api.taskgraph.compiler.FuseSteps._have_conflicting_data(), and peano4.api.taskgraph.compiler.FuseSteps._is_parallel_node().
