Adding your Task to the Dependency Plotting Tool¶
How to create a task dependency graph is described in Analysis Tools.
By default, it should pick up and plot the new task. However, you might want to
customize the plotting a bit, e.g. if you’re introducing a new ‘family’ of tasks
or you’d like them plotted as a cluster instead of individually. In both cases, we
need to modify the
Colouring in the Task Nodes¶
First, decide on a colour. If you want to use the same colour as already existing
task types, find its key in the
task_colours dict, which is defined at the
top of the file. If you want to add a new colour, add it to the
dict with a new key.
Then the script needs to identify the task types with which it is working.
To do so, it will check the task names, which are generated following the scheme
taskname is defined in
subtasknbame is defined in
tools/plot_task_dependencies.py, you’ll have to write a function that recognizes your
task by its name, like is done for example for gravity:
def task_is_gravity(name): """ Does the task concern the gravity? Parameters ---------- name: str Task name """ if "gpart" in name: return True if "grav" in name: return True return False
You’ll need to add the check to the function
if taskIsGravity(name): colour = task_colours["gravity"]
Feel free to pick out a nice color for it :)
In certain cases it makes sense to group some tasks together, for example the self
and pair tasks when computing hydro densities, gradients, or forces. To do this,
you’ll need to modify the function
src/task.c. The group
is determined by the task subtype, e.g.
case task_subtype_grav: strcpy(cluster, "Gravity"); break;
But since the task type itself is also passed to the function, you could use that as well if you really really need to. And that’s it!