VMS/2__runs_and_data

changeset 9:7234c77c1d01

fix parsing fn for NtoN
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Thu, 22 Dec 2011 14:57:30 +0100
parents 6652d0313656
children 4f2043c26553
files .hgignore scripts/ucc_and_loop_graph_treatment/parse_ucc.py
diffstat 2 files changed, 30 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/.hgignore	Tue Dec 20 10:23:52 2011 +0100
     1.2 +++ b/.hgignore	Thu Dec 22 14:57:30 2011 +0100
     1.3 @@ -1,1 +1,4 @@
     1.4 -history
     1.5 \ No newline at end of file
     1.6 +syntax:glob
     1.7 +history
     1.8 +counters
     1.9 +*~
     2.1 --- a/scripts/ucc_and_loop_graph_treatment/parse_ucc.py	Tue Dec 20 10:23:52 2011 +0100
     2.2 +++ b/scripts/ucc_and_loop_graph_treatment/parse_ucc.py	Thu Dec 22 14:57:30 2011 +0100
     2.3 @@ -24,7 +24,31 @@
     2.4  			if row[0] == "NtoN":
     2.5  				if not d.has_key("NtoN"):
     2.6  					d["NtoN"] = []
     2.7 -				d["NtoN"].append((row[2:2+row[1]],row[2+row[1]:2+2*row[1]]))
     2.8 -		except Exception:
     2.9 +				n = int(row[1])
    2.10 +				senders = zip(map(int,row[2:2+2*n:2]),map(int,row[3:2+2*n:2]))
    2.11 +				receivers = zip(map(int,row[2*n+2:4*n+2:2]),map(int,row[2*n+3:4*n+2:2]))
    2.12 +				#print "Senders:",senders, "=",len(senders)
    2.13 +				#print "Receivers:",receivers, "=",len(receivers)
    2.14 +				d["NtoN"].append((senders,receivers))
    2.15 +		except Exception as e:
    2.16 +			print e
    2.17  			continue
    2.18  	return d
    2.19 +
    2.20 +def main():
    2.21 +	if len(sys.argv)<1:
    2.22 +		sys.exit()
    2.23 +	uccfile = open(sys.argv[1])
    2.24 +	d = read_from_file(uccfile)
    2.25 +	print "Parsed UCC from file", sys.argv[1], "and found:"
    2.26 +	if d.has_key("unit"):
    2.27 +		print len(d["unit"]), "Units"
    2.28 +	if d.has_key("ctlDep"):
    2.29 +		print len(d["ctlDep"]), "Control Dependencies"
    2.30 +	if d.has_key("commDep"):
    2.31 +		print len(d["commDep"]), "Communication Dependencies"
    2.32 +	if d.has_key("NtoN"):
    2.33 +		print len(d["NtoN"]), "N to N communicating groups"
    2.34 +
    2.35 +if __name__ == "__main__":
    2.36 +    main()