Skip to content
Snippets Groups Projects
Commit 9f16ab4b authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Sort of works, does what I wanted but isn't accepted by swiftmpistepsim

parent 63cf8177
No related branches found
No related tags found
1 merge request!7Add a scale factor for messages
...@@ -88,7 +88,7 @@ with open(infile, "r") as fp: ...@@ -88,7 +88,7 @@ with open(infile, "r") as fp:
if line[0] == '#': if line[0] == '#':
continue continue
words = line.split() words = line.split()
if words[activationcol] == 0: if words[activationcol] == "0":
continue continue
if words[itypecol] == "22": if words[itypecol] == "22":
...@@ -123,20 +123,26 @@ print "# Read " + str(nsends) + " sends and " + str(nrecvs) + " recvs" ...@@ -123,20 +123,26 @@ print "# Read " + str(nsends) + " sends and " + str(nrecvs) + " recvs"
msends = [None] * nsends msends = [None] * nsends
for key in keysends: for key in keysends:
if key in keyrecvs: if key in keyrecvs:
isend = keysends[key][0] if len(keysends[key]) == 1 and len(keyrecvs[key]) == 1:
irecv = keyrecvs[key][0] isend = keysends[key][0]
msends[isend] = irecv irecv = keyrecvs[key][0]
msends[isend] = irecv
else:
print "# ERROR: found ", len(keysends[key]), "/", len(keyrecvs[key]), " matches for key: ", key, " should be 1/1"
else:
print "# ERROR: missing recv key: ", key
# Reorder recvs to same order as sends. # Reorder recvs to same order as sends.
recvs = [recvs[i] for i in msends] nrecvs = [recvs[i] for i in msends]
# Now we can split and retag. # Now we can split and retag. XXX if you run out of tags need to
# split by rank and then maybe itype and use tag count with these.
splits = [] splits = []
ctag = 0 ctag = 0
for i in range(nsends): for i in range(nsends):
swords = sends[i] swords = sends[i]
rwords = recvs[i] rwords = recvs[i]
size = str(float(swords[sizecol]) / 2.0) size = str(int(float(swords[sizecol]) / 2.0))
swords[sizecol] = size swords[sizecol] = size
rwords[sizecol] = size rwords[sizecol] = size
...@@ -149,10 +155,12 @@ for i in range(nsends): ...@@ -149,10 +155,12 @@ for i in range(nsends):
ctag = ctag + 1 ctag = ctag + 1
stag = str(ctag) stag = str(ctag)
swords[tagcol] = stag cswords = list(swords)
rwords[tagcol] = stag cswords[tagcol] = stag
splits.append(swords) crwords = list(rwords)
splits.append(rwords) crwords[tagcol] = stag
splits.append(cswords)
splits.append(crwords)
# Sort by tic. # Sort by tic.
splits = sorted(splits, key=lambda x: int(x[sticcol])) splits = sorted(splits, key=lambda x: int(x[sticcol]))
...@@ -163,4 +171,6 @@ with open(outfile, "w") as fp: ...@@ -163,4 +171,6 @@ with open(outfile, "w") as fp:
for line in splits: for line in splits:
fp.write(" ".join(line) + "\n") fp.write(" ".join(line) + "\n")
print "# Finished"
sys.exit(0) sys.exit(0)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment