# HG changeset patch # User Nina Engelhardt # Date 1324562250 -3600 # Node ID 7234c77c1d01153e090556e8b5c51479a659c140 # Parent 6652d031365624c240fab6cc5ae95d3667509735 fix parsing fn for NtoN diff -r 6652d0313656 -r 7234c77c1d01 .hgignore --- a/.hgignore Tue Dec 20 10:23:52 2011 +0100 +++ b/.hgignore Thu Dec 22 14:57:30 2011 +0100 @@ -1,1 +1,4 @@ -history \ No newline at end of file +syntax:glob +history +counters +*~ diff -r 6652d0313656 -r 7234c77c1d01 scripts/ucc_and_loop_graph_treatment/parse_ucc.py --- a/scripts/ucc_and_loop_graph_treatment/parse_ucc.py Tue Dec 20 10:23:52 2011 +0100 +++ b/scripts/ucc_and_loop_graph_treatment/parse_ucc.py Thu Dec 22 14:57:30 2011 +0100 @@ -24,7 +24,31 @@ if row[0] == "NtoN": if not d.has_key("NtoN"): d["NtoN"] = [] - d["NtoN"].append((row[2:2+row[1]],row[2+row[1]:2+2*row[1]])) - except Exception: + n = int(row[1]) + senders = zip(map(int,row[2:2+2*n:2]),map(int,row[3:2+2*n:2])) + receivers = zip(map(int,row[2*n+2:4*n+2:2]),map(int,row[2*n+3:4*n+2:2])) + #print "Senders:",senders, "=",len(senders) + #print "Receivers:",receivers, "=",len(receivers) + d["NtoN"].append((senders,receivers)) + except Exception as e: + print e continue return d + +def main(): + if len(sys.argv)<1: + sys.exit() + uccfile = open(sys.argv[1]) + d = read_from_file(uccfile) + print "Parsed UCC from file", sys.argv[1], "and found:" + if d.has_key("unit"): + print len(d["unit"]), "Units" + if d.has_key("ctlDep"): + print len(d["ctlDep"]), "Control Dependencies" + if d.has_key("commDep"): + print len(d["commDep"]), "Communication Dependencies" + if d.has_key("NtoN"): + print len(d["NtoN"]), "N to N communicating groups" + +if __name__ == "__main__": + main()