Mercurial > cgi-bin > hgwebdir.cgi > VMS > 2__runs_and_data
changeset 26:3adfef46f3a7
VSs viz done
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Fri, 31 Aug 2012 18:21:25 +0200 |
| parents | 078abaff1bc3 |
| children | 2ef6476f3628 |
| files | .hgignore scripts/ucc_and_loop_graph_treatment/column_view.py scripts/ucc_and_loop_graph_treatment/parse_loop_graph.py |
| diffstat | 3 files changed, 18 insertions(+), 52 deletions(-) [+] |
line diff
1.1 --- a/.hgignore Tue Aug 28 13:34:25 2012 +0200 1.2 +++ b/.hgignore Fri Aug 31 18:21:25 2012 +0200 1.3 @@ -4,3 +4,4 @@ 1.4 counters 1.5 xoanon_counters 1.6 *~ 1.7 +*.pyc
2.1 --- a/scripts/ucc_and_loop_graph_treatment/column_view.py Tue Aug 28 13:34:25 2012 +0200 2.2 +++ b/scripts/ucc_and_loop_graph_treatment/column_view.py Fri Aug 31 18:21:25 2012 +0200 2.3 @@ -139,7 +139,7 @@ 2.4 f='gray' 2.5 r = sf.Rect(x1,y1* vertical_scale_factor,x2,y2* vertical_scale_factor,fill='gray') 2.6 r2 = sf.Rect(x1,(y1+graph.node[node]['work_offset'])* vertical_scale_factor,x2,(y1+graph.node[node]['work_offset']+graph.node[node]['Work_end']-graph.node[node]['Work_start'])* vertical_scale_factor,fill=f, stroke_opacity=0) 2.7 - s = sf.Text((x1+x2)/2 , (y1+y2)* vertical_scale_factor/2 ,str(node),text_anchor="middle",font_size=20) #str(node)+"\r\n{0}".format(graph.node[node]['cache_misses'] * (graph.node[node]['Work_end_instrs'] - graph.node[node]['Work_start_instrs'])) 2.8 + s = sf.Text((x1+x2)/2 , (y1+y2)* vertical_scale_factor/2 ,str(node),text_anchor="middle",font_size=10) #str(node)+"\r\n{0}".format(graph.node[node]['cache_misses'] * (graph.node[node]['Work_end_instrs'] - graph.node[node]['Work_start_instrs'])) 2.9 if graph.node[node].has_key('AssignerInvocation_start') and graph.node[node].has_key('Assigner_start'): 2.10 h = graph.node[node]['Assigner_start'] - graph.node[node]['AssignerInvocation_start'] 2.11 r1 = sf.Rect(x1,y1* vertical_scale_factor,x2,(y1+h)* vertical_scale_factor,fill='green',fill_opacity="70%") 2.12 @@ -171,7 +171,7 @@ 2.13 core2 = graph.node[b]['core'] 2.14 x2 = core2 * num_cols * __column_width + offset * __column_width + 0.5 * __node_width 2.15 y2 = (positioning[b] - graph.node[b]['weight']) * vertical_scale_factor 2.16 - return sf.Line(x1,y1,x2,y2,style="stroke:rgb({0},{1},{2});stroke-width:2".format(int(color[0]*255),int(color[1]*255),int(color[2]*255))) 2.17 + return sf.Line(x1,y1,x2,y2,style="stroke:rgb({0},{1},{2});stroke-width:1".format(int(color[0]*255),int(color[1]*255),int(color[2]*255))) 2.18 2.19 2.20
3.1 --- a/scripts/ucc_and_loop_graph_treatment/parse_loop_graph.py Tue Aug 28 13:34:25 2012 +0200 3.2 +++ b/scripts/ucc_and_loop_graph_treatment/parse_loop_graph.py Fri Aug 31 18:21:25 2012 +0200 3.3 @@ -24,16 +24,8 @@ 3.4 def build_cg(loopfile,counterfile): 3.5 d = read_from_file(loopfile) 3.6 print "Parsed file", loopfile.name, "and found:" 3.7 - if d.has_key("unit"): 3.8 - print len(d["unit"]), "Units" 3.9 - if d.has_key("ctlDep"): 3.10 - print len(d["ctlDep"]), "Control Dependencies" 3.11 - if d.has_key("commDep"): 3.12 - print len(d["commDep"]), "Communication Dependencies" 3.13 - if d.has_key("dynDep"): 3.14 - print len(d["dynDep"]), "Dynamically chosen Dependencies" 3.15 - if d.has_key("hwDep"): 3.16 - print len(d["hwDep"]), "Hardware constraints" 3.17 + for key in d.iterkeys(): 3.18 + print len(d[key]), key+"s" 3.19 g = loopgraph_from_dict(d) 3.20 add_attributes_to_nodes_from_file(g,counterfile) 3.21 #print nx.simple_cycles(g) 3.22 @@ -42,21 +34,21 @@ 3.23 #if not cont.startswith(('y','Y')): 3.24 # sys.exit() 3.25 lend,predd = annotate_critical_path(g, 'start', 'end') 3.26 - print "Critical path length:",lend['end'] 3.27 + print "Critical path length: ",lend['end'] 3.28 critical_path = get_path(predd,'end') 3.29 if critical_path == None: 3.30 print "No path found!" 3.31 nx.draw(g) 3.32 else: 3.33 #print "Critical path:",critical_path 3.34 - print "Expected execution time:",path_length(g,critical_path),"cycles" 3.35 + #print "Expected execution time:",path_length(g,critical_path),"cycles" 3.36 try: 3.37 actual_time = g.node['start']['tscendtime'] - g.node['start']['tscstarttime'] 3.38 print "Actual execution time:", actual_time, "cycles" 3.39 dif = actual_time - lend['end'] 3.40 print "(Difference:", dif, "- Relative Error:", 100*float(dif)/float(lend['end']),"%)" 3.41 - print g.node['start']['starttimes'] 3.42 - print g.node['start']['tscstarttimes'] 3.43 + #print g.node['start']['starttimes'] 3.44 + #print g.node['start']['tscstarttimes'] 3.45 column_view.save_computed_column_view(g,g.node['start']['numcores'],lend['end'],lend,[d["commDep"], d["dataDep"], d["ctlDep"]],"{0}.svg".format(sys.argv[1])) 3.46 #column_view.save_comparative_column_view(g,g.node['start']['numcores'],max(actual_time,lend['end']),lend) 3.47 #column_view.save_tsc_scale(g,g.node['start']['numcores'],lend['end']) 3.48 @@ -96,30 +88,10 @@ 3.49 if not d.has_key("unit"): # not key in d: 3.50 d["unit"] = [] 3.51 d["unit"].append( ( int(row[1]),int(row[2]) ) ) 3.52 - if row[0] == "ctlDep": 3.53 - if not d.has_key("ctlDep"): 3.54 - d["ctlDep"] = [] 3.55 - d["ctlDep"].append( ( (int(row[1]),int(row[2])) , (int(row[3]),int(row[4])) ) ) 3.56 - if row[0] == "commDep": 3.57 - if not d.has_key("commDep"): 3.58 - d["commDep"] = [] 3.59 - d["commDep"].append(( (int(row[1]),int(row[2])) , (int(row[3]),int(row[4])) )) 3.60 - if row[0] == "dataDep": 3.61 - if not d.has_key("dataDep"): 3.62 - d["dataDep"] = [] 3.63 - d["dataDep"].append(( (int(row[1]),int(row[2])) , (int(row[3]),int(row[4])) )) 3.64 - if row[0] == "dynDep": 3.65 - if not d.has_key("dynDep"): 3.66 - d["dynDep"] = [] 3.67 - d["dynDep"].append(( (int(row[1]),int(row[2])) , (int(row[3]),int(row[4])) )) 3.68 - if row[0] == "singDep": 3.69 - if not d.has_key("singDep"): 3.70 - d["singDep"] = [] 3.71 - d["singDep"].append(( (int(row[1]),int(row[2])) , (int(row[3]),int(row[4])) )) 3.72 - if row[0] == "hwDep": 3.73 - if not d.has_key("hwDep"): 3.74 - d["hwDep"] = [] 3.75 - d["hwDep"].append(( (int(row[1]),int(row[2])) , (int(row[3]),int(row[4])) )) 3.76 + else: 3.77 + if not d.has_key(row[0]): 3.78 + d[row[0]] = [] 3.79 + d[row[0]].append( ( (int(row[1]),int(row[2])) , (int(row[3]),int(row[4])) ) ) 3.80 except Exception as e: 3.81 print e 3.82 continue 3.83 @@ -129,18 +101,11 @@ 3.84 g = nx.DiGraph() 3.85 g.add_node("start") 3.86 g.add_node("end") 3.87 - if d.has_key("unit"): 3.88 - g.add_nodes_from(d["unit"]) 3.89 - if d.has_key("ctlDep"): 3.90 - g.add_edges_from(d["ctlDep"]) 3.91 - if d.has_key("commDep"): 3.92 - g.add_edges_from(d["commDep"]) 3.93 - if d.has_key("dynDep"): 3.94 - g.add_edges_from(d["dynDep"]) 3.95 - if d.has_key("singDep"): 3.96 - g.add_edges_from(d["singDep"]) 3.97 - if d.has_key("hwDep"): 3.98 - g.add_edges_from(d["hwDep"]) 3.99 + for key in d.iterkeys(): 3.100 + if key=="unit": 3.101 + g.add_nodes_from(d["unit"]) 3.102 + else: 3.103 + g.add_edges_from(d[key]) 3.104 for node in g: 3.105 if node != "start" and node != "end": 3.106 if len(g.predecessors(node)) == 0:
