Skip to content
Snippets Groups Projects
Commit a01c2d51 authored by Mladen Ivkovic's avatar Mladen Ivkovic
Browse files

moved isTaskRT up to same function family, ran black over plot_task_dependencies.py

parent e55a4edd
No related branches found
No related tags found
1 merge request!1155RT injection task
...@@ -15,9 +15,12 @@ def parseOption(): ...@@ -15,9 +15,12 @@ def parseOption():
parser = OptionParser() parser = OptionParser()
parser.add_option( parser.add_option(
"-c", "--with-calls", dest="with_calls", "-c",
"--with-calls",
dest="with_calls",
help="Add the function calls in the graph", help="Add the function calls in the graph",
action="store_true") action="store_true",
)
opt, files = parser.parse_args() opt, files = parser.parse_args()
if len(files) != 1: if len(files) != 1:
...@@ -88,14 +91,12 @@ def appendSingleData(data0, datai): ...@@ -88,14 +91,12 @@ def appendSingleData(data0, datai):
# get data # get data
ta = datai["task_in"][i] ta = datai["task_in"][i]
tb = datai["task_out"][i] tb = datai["task_out"][i]
ind = np.logical_and(data0["task_in"] == ta, ind = np.logical_and(data0["task_in"] == ta, data0["task_out"] == tb)
data0["task_out"] == tb)
# check number of ta->tb # check number of ta->tb
N = np.sum(ind) N = np.sum(ind)
if N > 1: if N > 1:
raise Exception("Same dependency written multiple times %s->%s" % raise Exception("Same dependency written multiple times %s->%s" % (ta, tb))
(ta, tb))
# if not present in data0 # if not present in data0
if N == 0: if N == 0:
data0.append(row) data0.append(row)
...@@ -150,6 +151,7 @@ def taskIsBlackHoles(name): ...@@ -150,6 +151,7 @@ def taskIsBlackHoles(name):
return True return True
return False return False
def taskIsStars(name): def taskIsStars(name):
""" """
Does the task concern stars? Does the task concern stars?
...@@ -167,6 +169,7 @@ def taskIsStars(name): ...@@ -167,6 +169,7 @@ def taskIsStars(name):
return False return False
def taskIsHydro(name): def taskIsHydro(name):
""" """
Does the task concern the hydro? Does the task concern the hydro?
...@@ -197,7 +200,7 @@ def taskIsHydro(name): ...@@ -197,7 +200,7 @@ def taskIsHydro(name):
"ghost_out", "ghost_out",
"extra_ghost", "extra_ghost",
"cooling", "cooling",
"star_formation" "star_formation",
] ]
if name in task_name: if name in task_name:
return True return True
...@@ -221,6 +224,21 @@ def taskIsGravity(name): ...@@ -221,6 +224,21 @@ def taskIsGravity(name):
return False return False
def taskIsRT(name):
"""
Does the task concern Radiative Transfer?
Parameters
----------
name: str
Task name
"""
if "_rt" in name:
return True
return False
def getFunctionCalls(name): def getFunctionCalls(name):
txt = None txt = None
if name == "ghost": if name == "ghost":
...@@ -277,21 +295,6 @@ def getFunctionCalls(name): ...@@ -277,21 +295,6 @@ def getFunctionCalls(name):
return pre + txt + app return pre + txt + app
def taskIsRT(name):
"""
Does the task concern Radiative Transfer?
Parameters
----------
name: str
Task name
"""
if "_rt" in name:
return True
return False
def writeTask(f, name, implicit, mpi, with_calls): def writeTask(f, name, implicit, mpi, with_calls):
""" """
Write the special task (e.g. implicit and mpi) Write the special task (e.g. implicit and mpi)
...@@ -391,8 +394,7 @@ def writeHeader(f, data, git, opt): ...@@ -391,8 +394,7 @@ def writeHeader(f, data, git, opt):
continue continue
written.append(ta) written.append(ta)
writeTask(f, ta, data["implicit_in"][i], data["mpi_in"][i], writeTask(f, ta, data["implicit_in"][i], data["mpi_in"][i], opt.with_calls)
opt.with_calls)
# do task out # do task out
for i in range(N): for i in range(N):
...@@ -401,8 +403,7 @@ def writeHeader(f, data, git, opt): ...@@ -401,8 +403,7 @@ def writeHeader(f, data, git, opt):
continue continue
written.append(tb) written.append(tb)
writeTask(f, tb, data["implicit_out"][i], data["mpi_out"][i], writeTask(f, tb, data["implicit_out"][i], data["mpi_out"][i], opt.with_calls)
opt.with_calls)
f.write("\n") f.write("\n")
...@@ -505,8 +506,7 @@ def writeDependencies(f, data): ...@@ -505,8 +506,7 @@ def writeDependencies(f, data):
arrow = "" arrow = ""
if data["number_rank"][i] != max_rank: if data["number_rank"][i] != max_rank:
arrow = ",style=dashed" arrow = ",style=dashed"
f.write("\t %s->%s[label=%i%s]\n" % f.write("\t %s->%s[label=%i%s]\n" % (ta, tb, number_link, arrow))
(ta, tb, number_link, arrow))
def writeFooter(f): def writeFooter(f):
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment