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:
if line[0] == '#':
continue
words = line.split()
if words[activationcol] == 0:
if words[activationcol] == "0":
continue
if words[itypecol] == "22":
......@@ -123,20 +123,26 @@ print "# Read " + str(nsends) + " sends and " + str(nrecvs) + " recvs"
msends = [None] * nsends
for key in keysends:
if key in keyrecvs:
isend = keysends[key][0]
irecv = keyrecvs[key][0]
msends[isend] = irecv
if len(keysends[key]) == 1 and len(keyrecvs[key]) == 1:
isend = keysends[key][0]
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.
recvs = [recvs[i] for i in msends]
# Now we can split and retag.
nrecvs = [recvs[i] for i in msends]
# 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 = []
ctag = 0
for i in range(nsends):
swords = sends[i]
rwords = recvs[i]
size = str(float(swords[sizecol]) / 2.0)
size = str(int(float(swords[sizecol]) / 2.0))
swords[sizecol] = size
rwords[sizecol] = size
......@@ -149,10 +155,12 @@ for i in range(nsends):
ctag = ctag + 1
stag = str(ctag)
swords[tagcol] = stag
rwords[tagcol] = stag
splits.append(swords)
splits.append(rwords)
cswords = list(swords)
cswords[tagcol] = stag
crwords = list(rwords)
crwords[tagcol] = stag
splits.append(cswords)
splits.append(crwords)
# Sort by tic.
splits = sorted(splits, key=lambda x: int(x[sticcol]))
......@@ -163,4 +171,6 @@ with open(outfile, "w") as fp:
for line in splits:
fp.write(" ".join(line) + "\n")
print "# Finished"
sys.exit(0)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment