Skip to content
Snippets Groups Projects
Commit e275cf4d authored by Peter W. Draper's avatar Peter W. Draper
Browse files

One more attempt at colour selection

parent 27a98593
Branches
Tags
2 merge requests!136Master,!70Include parallel sort tasks in task dump and add support for MPI dumps
...@@ -58,49 +58,37 @@ params = {"axes.labelsize": 10, ...@@ -58,49 +58,37 @@ params = {"axes.labelsize": 10,
} }
pl.rcParams.update(params) pl.rcParams.update(params)
types = {"0": "none", # Tasks and subtypes. Indexed as in tasks.h.
"1": "sort", types = ["none", "sort", "self", "pair", "sub", "ghost", "kick1", "kick2",
"2": "self", "send", "recv", "grav_pp", "grav_mm", "grav_up", "grav_down",
"3": "pair", "psort", "split_cell", "rewait", "count"]
"4": "sub",
"5": "ghost", taskcolours = {"none": "black",
"6": "kick1", "sort": "lightblue",
"7": "kick2", "self": "greenyellow",
"8": "send", "pair": "navy",
"9": "recv", "sub": "hotpink",
"10": "grav_pp", "ghost": "cyan",
"11": "grav_mm", "kick1": "maroon",
"12": "grav_up", "kick2": "green",
"13": "grav_down", "send": "yellow",
"14": "psort", "recv": "magenta",
"15": "split_cell", "grav_pp": "mediumorchid",
"16": "rewait", "grav_mm": "mediumturquoise",
"17": "count"} "grav_up": "mediumvioletred",
"grav_down": "mediumnightblue",
subtypes = {"0": "none", "psort": "steelblue",
"1": "density", "split_cell": "seagreen",
"2": "force", "rewait": "olive",
"3": "grav", "count": "powerblue"}
"4": "count"}
subtypes = ["none", "density", "force", "grav", "count"]
# Assign colours for all types. subtypecolours = {"none": "black",
#colours = ["blue","green","red","cyan","magenta","yellow","black"] "density": "red",
#colours = colours + list(matplotlib.colors.cnames) "force": "blue",
colours = list(matplotlib.colors.cnames) "grav": "indigo",
"count": "purple"}
index = 0
subtypecolours = {}
for key in subtypes:
subtypecolours[subtypes[key]] = colours[index]
print subtypes[key], " = ", colours[index]
index = index + 1
taskcolours = {}
for key in types:
taskcolours[types[key]] = colours[index]
print types[key], " = ", colours[index]
index = index + 1
# Read input. # Read input.
data = pl.loadtxt( infile ) data = pl.loadtxt( infile )
...@@ -110,6 +98,7 @@ print "Number of ranks:", nranks ...@@ -110,6 +98,7 @@ print "Number of ranks:", nranks
if rank < 0 or rank >= nranks: if rank < 0 or rank >= nranks:
print "Cannot read rank: ", rank, ", out of range" print "Cannot read rank: ", rank, ", out of range"
sys.exit(1) sys.exit(1)
print "Processing rank:", rank
nthread = int(max(data[:,1])) + 1 nthread = int(max(data[:,1])) + 1
print "Number of threads:", nthread print "Number of threads:", nthread
...@@ -135,14 +124,16 @@ num_lines = pl.size(sdata) / 10 ...@@ -135,14 +124,16 @@ num_lines = pl.size(sdata) / 10
for line in range(num_lines): for line in range(num_lines):
thread = int(sdata[line,1]) thread = int(sdata[line,1])
tasks[thread].append({}) tasks[thread].append({})
tasks[thread][-1]["type"] = types[str(int(sdata[line,2]))] tasks[thread][-1]["type"] = types[int(sdata[line,2])]
tasks[thread][-1]["subtype"] = subtypes[str(int(sdata[line,3]))] tasks[thread][-1]["subtype"] = subtypes[int(sdata[line,3])]
tic = int(sdata[line,5]) / CPU_CLOCK * 1000 tic = int(sdata[line,5]) / CPU_CLOCK * 1000
toc = int(sdata[line,6]) / CPU_CLOCK * 1000 toc = int(sdata[line,6]) / CPU_CLOCK * 1000
tasks[thread][-1]["tic"] = tic tasks[thread][-1]["tic"] = tic
tasks[thread][-1]["toc"] = toc tasks[thread][-1]["toc"] = toc
tasks[thread][-1]["t"] = (toc + tic)/ 2 tasks[thread][-1]["t"] = (toc + tic)/ 2
print "Collection done..."
combtasks = {} combtasks = {}
combtasks[-1] = [] combtasks[-1] = []
for i in range(nthread): for i in range(nthread):
...@@ -169,6 +160,8 @@ for thread in range(nthread): ...@@ -169,6 +160,8 @@ for thread in range(nthread):
else: else:
combtasks[thread][-1]["toc"] = task["toc"] combtasks[thread][-1]["toc"] = task["toc"]
print "Combination done..."
typesseen = [] typesseen = []
for i in range(nthread): for i in range(nthread):
for task in combtasks[i]: for task in combtasks[i]:
...@@ -193,3 +186,6 @@ pl.yticks(pl.array(range(nthread)) + 0.5, pl.array(range(nthread))) ...@@ -193,3 +186,6 @@ pl.yticks(pl.array(range(nthread)) + 0.5, pl.array(range(nthread)))
pl.show() pl.show()
pl.savefig(outpng) pl.savefig(outpng)
print "Graphics done, output written to", outpng
sys.exit(0)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment