The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
getCriticalPath Namespace Reference

Functions

 get_critical_path (path_to_trace_file)
 
 main ()
 

Variables

str __author__ = "Illya Shapoval"
 (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations # # This software is distributed under the terms of the Apache version 2 licence, # copied verbatim in the file "LICENSE".
 
 message
 
 category
 

Function Documentation

◆ get_critical_path()

getCriticalPath.get_critical_path ( path_to_trace_file)
Find critical path, print algorithms on it and its length.

Definition at line 27 of file getCriticalPath.py.

27def get_critical_path(path_to_trace_file):
28 """Find critical path, print algorithms on it and its length."""
29
30 assert tuple(map(int, nx.__version__.split("."))) >= (
31 2,
32 0,
33 ), "This script requires Networkx version 2.0 or higher"
34
35 trace = nx.read_graphml(path_to_trace_file)
36
37 for inNode, outNode, edge_attrs in trace.in_edges(data=True):
38 edge_attrs["Runtime"] = nx.get_node_attributes(trace, "Run Time (us)")[outNode]
39
40 cpath = nx.algorithms.dag.dag_longest_path(trace, weight="Runtime")
41
42 print("Algorithms on the critical path (%i): " % len(cpath))
43
44 print(" {:<40} Runtime (us)".format("Name"))
45 print(" -----------------------------------------------------")
46 for node_id in cpath:
47 print(
48 " {:<40}: {}".format(
49 trace.nodes[node_id].get("Name"),
50 trace.nodes[node_id].get("Run Time (us)"),
51 )
52 )
53
54 print(
55 "\nTotal critical path time: ",
56 nx.algorithms.dag.dag_longest_path_length(trace, weight="Runtime"),
57 "us",
58 )
59
60
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition MsgStream.cpp:93

◆ main()

getCriticalPath.main ( )

Definition at line 61 of file getCriticalPath.py.

61def main():
62 parser = argparse.ArgumentParser(
63 description="Determine critical path for a precedence trace generated by the Avalanche Scheduler."
64 )
65 parser.add_argument(
66 "path_to_trace_file", help="Path to GRAPHML precedence trace file.", type=str
67 )
68 args = parser.parse_args()
69
70 get_critical_path(args.path_to_trace_file)
71
72
int main()

Variable Documentation

◆ __author__

str getCriticalPath.__author__ = "Illya Shapoval"
private

(c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations # # This software is distributed under the terms of the Apache version 2 licence, # copied verbatim in the file "LICENSE".

# # In applying this licence, CERN does not waive the privileges and immunities # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. #

Definition at line 14 of file getCriticalPath.py.

◆ category

getCriticalPath.category

Definition at line 22 of file getCriticalPath.py.

◆ message

getCriticalPath.message

Definition at line 22 of file getCriticalPath.py.