Commit 21db2b12 authored by Taddeüs Kroes's avatar Taddeüs Kroes

ModSim ass4 taddeus: some final changes to MPI python scripts.

parent 7f895397
......@@ -7,4 +7,4 @@ seq: seq.o
par: par.o
clean:
rm -vf *.o seq par
rm -vf *.o seq par out*.txt
#!/usr/bin/env python
from sys import argv, exit
def combine(numfiles):
files = range(int(numfiles))
lines = [open('out%d.txt' % i).readlines() for i in files]
return [' '.join([lines[j][i][:-1] for j in files]) for i in
range(len(lines[0]))]
if len(argv) < 2:
print 'Usage: python %s TASKS' % argv[0]
exit()
if __name__ == '__main__':
if len(argv) < 2:
print 'Usage: python %s TASKS' % argv[0]
exit()
files = range(int(argv[1]))
lines = [open('out%d.txt' % i).readlines() for i in files]
lines = [' '.join([lines[j][i][:-1] for j in files]) for i in
range(len(lines[0]))]
print '\n'.join(combine(argv[1]))
print '\n'.join(lines)
......@@ -2,20 +2,16 @@
from sys import stdin, argv, exit
from pylab import figure, plot, axis, draw, ion, clf
from time import sleep
from combine import combine
if len(argv) < 3:
print 'Usage: python %s TASKS TIME_STEP [ DELAY ]' % argv[0]
if len(argv) < 2:
print 'Usage: python %s TIME_STEP [ DELAY ]' % argv[0]
exit()
# tasks = 0 means sequential, above means parallel and having to combine the
# different output files
lines = combine(int(argv[1])) if int(argv[1]) else stdin.readlines()
stride = int(argv[2])
delay = .1 if len(argv) < 4 else float(argv[3])
stride = int(argv[1])
delay = .1 if len(argv) < 3 else float(argv[2])
# Collect data
lines = stdin.readlines()
y = []
x = map(float, lines[0].split(' '))
for line in lines[1::stride]:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment