The Gaudi Framework  master (37c0b60a)
getCriticalPath Namespace Reference

Functions

def get_critical_path (path_to_trace_file)
 
def main ()
 

Variables

 __author__
 (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". More...
 
 message
 
 category
 

Function Documentation

◆ get_critical_path()

def 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.

27 def 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 

◆ main()

def getCriticalPath.main ( )

Definition at line 61 of file getCriticalPath.py.

61 def 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 

Variable Documentation

◆ __author__

getCriticalPath.__author__
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.

getCriticalPath.main
def main()
Definition: getCriticalPath.py:61
GaudiPartProp.decorators.get
get
decorate the vector of properties
Definition: decorators.py:283
Containers::map
struct GAUDI_API map
Parametrisation class for map-like implementation.
Definition: KeyedObjectManager.h:35
getCriticalPath.get_critical_path
def get_critical_path(path_to_trace_file)
Definition: getCriticalPath.py:27
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119