Skip to content
Snippets Groups Projects
Commit 0a0b1867 authored by Mladen Ivkovic's avatar Mladen Ivkovic Committed by Peter W. Draper
Browse files

Taskplot cleanup

parent c184f132
No related branches found
No related tags found
5 merge requests!2165Merge master,!2119Mhd canvas,!2112Prep for remix merge,!2109Catching the zoom branch up with master,!2080Taskplot cleanup
......@@ -176,7 +176,7 @@ A short summary of the scripts in ``tools/task_plots/``:
whole step and per thread and the minimum and maximum times spent per task type.
- ``iplot_tasks.py``:
An interactive task plot, showing what thread was doing what task and for
how long for a step. **Needs python2 and the tkinter module**.
how long for a step. **Needs the tkinter module**.
- ``plot_tasks.py``:
Creates a task plot image, showing what thread was doing what task and for how long.
- ``plot_threadpool.py``:
......
......@@ -49,7 +49,7 @@ import sys
import argparse
# import hardcoded data
from swift_hardcoded_data import TASKTYPES, SUBTYPES
from swift_hardcoded_data import TASKTYPES, SUBTYPES, TASKCOLOURS, SUBCOLOURS
# Handle the command line.
parser = argparse.ArgumentParser(description="Plot task graphs")
......@@ -127,145 +127,6 @@ PLOT_PARAMS = {
}
pl.rcParams.update(PLOT_PARAMS)
# Task/subtypes of interest.
FULLTYPES = [
"self/limiter",
"self/force",
"self/gradient",
"self/density",
"self/grav",
"sub_self/limiter",
"sub_self/force",
"sub_self/gradient",
"sub_self/density",
"pair/limiter",
"pair/force",
"pair/gradient",
"pair/density",
"pair/grav",
"sub_pair/limiter",
"sub_pair/force",
"sub_pair/gradient",
"sub_pair/density",
"recv/xv",
"send/xv",
"recv/rho",
"send/rho",
"recv/tend_part",
"send/tend_part",
"recv/tend_gpart",
"send/tend_gpart",
"recv/tend_spart",
"send/tend_spart",
"recv/tend_bpart",
"send/tend_bpart",
"recv/gpart",
"send/gpart",
"recv/spart",
"send/spart",
"send/sf_counts",
"recv/sf_counts",
"recv/bpart",
"send/bpart",
"recv/limiter",
"send/limiter",
"pack/limiter",
"unpack/limiter",
"self/stars_density",
"pair/stars_density",
"sub_self/stars_density",
"sub_pair/stars_density",
"self/stars_prep1",
"pair/stars_prep1",
"sub_self/stars_prep1",
"sub_pair/stars_prep1",
"self/stars_prep2",
"pair/stars_prep2",
"sub_self/stars_prep2",
"sub_pair/stars_prep2",
"self/stars_feedback",
"pair/stars_feedback",
"sub_self/stars_feedback",
"sub_pair/stars_feedback",
"self/bh_density",
"pair/bh_density",
"sub_self/bh_density",
"sub_pair/bh_density",
"self/bh_swallow",
"pair/bh_swallow",
"sub_self/bh_swallow",
"sub_pair/bh_swallow",
"self/do_swallow",
"pair/do_swallow",
"sub_self/do_swallow",
"sub_pair/do_swallow",
"self/bh_feedback",
"pair/bh_feedback",
"sub_self/bh_feedback",
"sub_pair/bh_feedback",
]
# A number of colours for the various types. Recycled when there are
# more task types than colours...
colours = [
"cyan",
"lightgray",
"darkblue",
"yellow",
"tan",
"dodgerblue",
"sienna",
"aquamarine",
"bisque",
"blue",
"green",
"lightgreen",
"brown",
"purple",
"moccasin",
"olivedrab",
"chartreuse",
"olive",
"darkgreen",
"green",
"mediumseagreen",
"mediumaquamarine",
"darkslategrey",
"mediumturquoise",
"black",
"cadetblue",
"skyblue",
"red",
"slategray",
"gold",
"slateblue",
"blueviolet",
"mediumorchid",
"firebrick",
"magenta",
"hotpink",
"pink",
"orange",
"lightgreen",
]
maxcolours = len(colours)
# Set colours of task/subtype.
TASKCOLOURS = {}
ncolours = 0
for task in TASKTYPES:
TASKCOLOURS[task] = colours[ncolours]
ncolours = (ncolours + 1) % maxcolours
SUBCOLOURS = {}
for task in FULLTYPES:
SUBCOLOURS[task] = colours[ncolours]
ncolours = (ncolours + 1) % maxcolours
for task in SUBTYPES:
SUBCOLOURS[task] = colours[ncolours]
ncolours = (ncolours + 1) % maxcolours
# For fiddling with colours...
if args.verbose:
print("#Selected colours:")
......
......@@ -50,7 +50,7 @@ import sys
import argparse
# import hardcoded data
from swift_hardcoded_data import TASKTYPES, SUBTYPES
from swift_hardcoded_data import TASKTYPES, SUBTYPES, TASKCOLOURS, SUBCOLOURS
# Handle the command line.
parser = argparse.ArgumentParser(description="Plot task graphs")
......@@ -150,144 +150,6 @@ PLOT_PARAMS = {
}
pl.rcParams.update(PLOT_PARAMS)
# Task/subtypes of interest.
FULLTYPES = [
"self/limiter",
"self/force",
"self/gradient",
"self/density",
"self/grav",
"sub_self/limiter",
"sub_self/force",
"sub_self/gradient",
"sub_self/density",
"pair/limiter",
"pair/force",
"pair/gradient",
"pair/density",
"pair/grav",
"sub_pair/limiter",
"sub_pair/force",
"sub_pair/gradient",
"sub_pair/density",
"recv/xv",
"send/xv",
"recv/rho",
"send/rho",
"recv/tend_part",
"send/tend_part",
"recv/tend_gpart",
"send/tend_gpart",
"recv/tend_spart",
"send/tend_spart",
"recv/tend_bpart",
"send/tend_bpart",
"recv/gpart",
"send/gpart",
"recv/spart",
"send/spart",
"send/sf_counts",
"recv/sf_counts",
"recv/bpart",
"send/bpart",
"recv/limiter",
"send/limiter",
"pack/limiter",
"unpack/limiter",
"self/stars_density",
"pair/stars_density",
"sub_self/stars_density",
"sub_pair/stars_density",
"self/stars_prep1",
"pair/stars_prep1",
"sub_self/stars_prep1",
"sub_pair/stars_prep1",
"self/stars_prep2",
"pair/stars_prep2",
"sub_self/stars_prep2",
"sub_pair/stars_prep2",
"self/stars_feedback",
"pair/stars_feedback",
"sub_self/stars_feedback",
"sub_pair/stars_feedback",
"self/bh_density",
"pair/bh_density",
"sub_self/bh_density",
"sub_pair/bh_density",
"self/bh_swallow",
"pair/bh_swallow",
"sub_self/bh_swallow",
"sub_pair/bh_swallow",
"self/do_swallow",
"pair/do_swallow",
"sub_self/do_swallow",
"sub_pair/do_swallow",
"self/bh_feedback",
"pair/bh_feedback",
"sub_self/bh_feedback",
"sub_pair/bh_feedback",
]
# A number of colours for the various types. Recycled when there are
# more task types than colours...
colours = [
"cyan",
"lightgray",
"darkblue",
"yellow",
"tan",
"dodgerblue",
"sienna",
"aquamarine",
"bisque",
"blue",
"green",
"lightgreen",
"brown",
"purple",
"moccasin",
"olivedrab",
"chartreuse",
"olive",
"darkgreen",
"green",
"mediumseagreen",
"mediumaquamarine",
"darkslategrey",
"mediumturquoise",
"black",
"cadetblue",
"skyblue",
"red",
"slategray",
"gold",
"slateblue",
"blueviolet",
"mediumorchid",
"firebrick",
"magenta",
"hotpink",
"pink",
"orange",
"lightgreen",
]
maxcolours = len(colours)
# Set colours of task/subtype.
TASKCOLOURS = {}
ncolours = 0
for task in TASKTYPES:
TASKCOLOURS[task] = colours[ncolours]
ncolours = (ncolours + 1) % maxcolours
SUBCOLOURS = {}
for task in FULLTYPES:
SUBCOLOURS[task] = colours[ncolours]
ncolours = (ncolours + 1) % maxcolours
for task in SUBTYPES:
SUBCOLOURS[task] = colours[ncolours]
ncolours = (ncolours + 1) % maxcolours
# For fiddling with colours...
if args.verbose:
......@@ -518,4 +380,5 @@ for rank in ranks:
pl.close()
print("Graphics done, output written to", outpng)
sys.exit(0)
#!/usr/bin/env python3
# ------------------------------------------------------------
# This file contains data that is hardcoded into swift
# that needs to be reproduced exactly in order for analysis
# outputs to make any sense.
# The data is used in other scripts in this directory, this
# script is intended for imports only.
# ------------------------------------------------------------
# -----------------------------------------------------------------------------
# This file contains data that is hardcoded into swift that needs to be
# reproduced exactly in order for analysis outputs to make any sense. The data
# is used in other scripts in this directory, this script is intended for
# imports only.
# Additionally, we add some setup work:
# - check if a file "task_labels_task_types.txt" exists. If it does, verify that
# the hardcoded data in this file corresponds to the output written by SWIFT
# in that file.
# - set up a list of useful task type/subtype combinations. Note that this list
# needs to be verified manually for completeness.
# - assing colours to all task types, subtypes, and combinations thereof.
# -----------------------------------------------------------------------------
# Tasks and subtypes. Indexed as in tasks.h.
TASKTYPES = [
......@@ -74,6 +80,7 @@ TASKTYPES = [
"fof_attach_pair",
"neutrino_weight",
"sink_in",
"sink_density_ghost",
"sink_ghost1",
"sink_ghost2",
"sink_out",
......@@ -84,6 +91,9 @@ TASKTYPES = [
"rt_ghost2",
"rt_transport_out",
"rt_tchem",
"rt_advance_cell_time",
"rt_sort",
"rt_collect_times",
# "count",
]
......@@ -124,6 +134,170 @@ SUBTYPES = [
# "count",
]
# Task/subtypes of interest.
FULLTYPES = [
"self/limiter",
"self/force",
"self/gradient",
"self/density",
"self/grav",
"sub_self/limiter",
"sub_self/force",
"sub_self/gradient",
"sub_self/density",
"pair/limiter",
"pair/force",
"pair/gradient",
"pair/density",
"pair/grav",
"sub_pair/limiter",
"sub_pair/force",
"sub_pair/gradient",
"sub_pair/density",
"recv/xv",
"send/xv",
"recv/rho",
"send/rho",
"recv/tend_part",
"send/tend_part",
"recv/tend_gpart",
"send/tend_gpart",
"recv/tend_spart",
"send/tend_spart",
"recv/tend_bpart",
"send/tend_bpart",
"recv/gpart",
"send/gpart",
"recv/spart",
"send/spart",
"send/sf_counts",
"recv/sf_counts",
"recv/bpart",
"send/bpart",
"recv/limiter",
"send/limiter",
"pack/limiter",
"unpack/limiter",
"self/stars_density",
"pair/stars_density",
"sub_self/stars_density",
"sub_pair/stars_density",
"self/stars_prep1",
"pair/stars_prep1",
"sub_self/stars_prep1",
"sub_pair/stars_prep1",
"self/stars_prep2",
"pair/stars_prep2",
"sub_self/stars_prep2",
"sub_pair/stars_prep2",
"self/stars_feedback",
"pair/stars_feedback",
"sub_self/stars_feedback",
"sub_pair/stars_feedback",
"self/bh_density",
"pair/bh_density",
"sub_self/bh_density",
"sub_pair/bh_density",
"self/bh_swallow",
"pair/bh_swallow",
"sub_self/bh_swallow",
"sub_pair/bh_swallow",
"self/do_swallow",
"pair/do_swallow",
"sub_self/do_swallow",
"sub_pair/do_swallow",
"self/bh_feedback",
"pair/bh_feedback",
"sub_self/bh_feedback",
"sub_pair/bh_feedback",
"self/rt_gradient",
"pair/rt_gradient",
"sub_self/rt_gradient",
"sub_pair/rt_gradient",
"self/rt_transport",
"pair/rt_transport",
"sub_self/rt_transport",
"sub_pair/rt_transport",
"self/sink_density",
"pair/sink_density",
"sub_self/sink_density",
"sub_pair/sink_density",
"self/sink_swallow",
"pair/sink_swallow",
"sub_self/sink_swallow",
"sub_pair/sink_swallow",
"self/sink_do_swallow",
"pair/sink_do_swallow",
"sub_self/sink_do_swallow",
"sub_pair/sink_do_swallow",
"self/sink_do_gas_swallow",
"pair/sink_do_gas_swallow",
"sub_self/sink_do_gas_swallow",
"sub_pair/sink_do_gas_swallow",
]
# A number of colours for the various types. Recycled when there are
# more task types than colours...
colours = [
"cyan",
"lightgray",
"darkblue",
"yellow",
"tan",
"dodgerblue",
"sienna",
"aquamarine",
"bisque",
"blue",
"green",
"lightgreen",
"brown",
"purple",
"moccasin",
"olivedrab",
"chartreuse",
"olive",
"darkgreen",
"green",
"mediumseagreen",
"mediumaquamarine",
"darkslategrey",
"mediumturquoise",
"black",
"cadetblue",
"skyblue",
"red",
"slategray",
"gold",
"slateblue",
"blueviolet",
"mediumorchid",
"firebrick",
"magenta",
"hotpink",
"pink",
"orange",
"lightgreen",
]
maxcolours = len(colours)
# Set colours of task/subtype.
TASKCOLOURS = {}
ncolours = 0
for task in TASKTYPES:
TASKCOLOURS[task] = colours[ncolours]
ncolours = (ncolours + 1) % maxcolours
SUBCOLOURS = {}
for task in FULLTYPES:
SUBCOLOURS[task] = colours[ncolours]
ncolours = (ncolours + 1) % maxcolours
for task in SUBTYPES:
SUBCOLOURS[task] = colours[ncolours]
ncolours = (ncolours + 1) % maxcolours
# check if label files are found that have (possibly different) labels
# output by SWIFT itself
import os
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment