From 9f16ab4be2114d6e05a190121dd91fbf3b99a627 Mon Sep 17 00:00:00 2001 From: "Peter W. Draper" <p.w.draper@durham.ac.uk> Date: Thu, 3 Oct 2019 18:13:25 +0100 Subject: [PATCH] Sort of works, does what I wanted but isn't accepted by swiftmpistepsim --- testdata/doubledata.py | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/testdata/doubledata.py b/testdata/doubledata.py index 6fac610..b544404 100755 --- a/testdata/doubledata.py +++ b/testdata/doubledata.py @@ -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) -- GitLab