pep8/pyflakes on the bin folder

This commit is contained in:
Stephen M. McQuay 2011-09-27 21:54:04 -06:00
parent 1a4d635362
commit 0916023080
10 changed files with 506 additions and 633 deletions

View File

@ -10,13 +10,15 @@ from optparse import OptionParser
import progressbar import progressbar
import interp.bootstrap import interp.bootstrap
interp.bootstrap
from interp.grid.gmsh import ggrid from interp.grid.gmsh import ggrid
from interp.grid.delaunay import dgrid from interp.grid.delaunay import dgrid
from interp.tools import improved_answer from interp.tools import improved_answer
from interp.tools import baker_exact_2D, baker_exact_3D from interp.tools import baker_exact_2D, baker_exact_3D
from interp.tools import friendly_exact_2D, friendly_exact_3D from interp.tools import friendly_exact_2D, friendly_exact_3D
from interp.tools import exact_me
def get_right_exact_func(options): def get_right_exact_func(options):
f = None f = None
@ -24,7 +26,7 @@ def get_right_exact_func(options):
if options.baker: if options.baker:
f = baker_exact_3D f = baker_exact_3D
else: else:
f =friendly_exact_3D f = friendly_exact_3D
elif options.dimension == 2: elif options.dimension == 2:
if options.baker: if options.baker:
f = baker_exact_2D f = baker_exact_2D
@ -34,11 +36,8 @@ def get_right_exact_func(options):
if __name__ == '__main__': if __name__ == '__main__':
parser = OptionParser(usage = "%prog [options] <input file (gmsh) or random grid count (delaunay)> <number of attempts>") parser = OptionParser(usage="%prog [options] <input file (gmsh) or random"
" grid count (delaunay)> <number of attempts>")
parser.add_option("-v", "--verbose",
action="store_true", dest="verbose", default=False,
help="verbose flag")
parser.add_option("-b", "--baker", parser.add_option("-b", "--baker",
action="store_true", dest="baker", default=False, action="store_true", dest="baker", default=False,
@ -61,8 +60,8 @@ if __name__ == '__main__':
type="int", dest="extra", default=3, type="int", dest="extra", default=3,
help="number of extra points (default: %default)") help="number of extra points (default: %default)")
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
if len(args) != 2: if len(args) != 2:
parser.print_usage() parser.print_usage()
sys.exit(1) sys.exit(1)
@ -72,29 +71,31 @@ if __name__ == '__main__':
if options.meshtype == 'gmsh': if options.meshtype == 'gmsh':
g = ggrid(input_file, options.dimension) g = ggrid(input_file, options.dimension)
g.values = exact_me(g.points, get_right_exact_func(options))
elif options.meshtype == 'delaunay': elif options.meshtype == 'delaunay':
point_count = int(input_file) point_count = int(input_file)
v = np.random.random((point_count, options.dimension)) v = np.random.random((point_count, options.dimension))
g = dgrid(v) q = exact_me(v, get_right_exact_func(options))
g = dgrid(v, q)
else: else:
raise Exception("improper mesh type specified. options: %s\n%s" % (str(meshtype_options), options.meshtype)) raise Exception("improper mesh type specified. options: %s\n%s".format(
str(meshtype_options), options.meshtype))
g.q = np.array([get_right_exact_func(options)(x) for x in g.verts]) results = {True: 0, False: 0}
results = {True:0, False:0}
i = 0 i = 0
outside = 0 outside = 0
pbar = progressbar.ProgressBar().start() pbar = progressbar.ProgressBar().start()
start = time.time() start = time.time()
while i < count: while i < count:
try: try:
X = np.random.random((1,options.dimension))[0] X = np.random.rand(1, options.dimension)[0]
a = g.run_baker(X, order = options.order, extra_points = options.extra) a = g.interpolate(X, order=options.order,
extra_points=options.extra)
e = get_right_exact_func(options)(X) e = get_right_exact_func(options)(X)
results[improved_answer(a, e)] += 1 results[improved_answer(a, e)] += 1
update = i/float(count) * 100 update = i / float(count) * 100
pbar.update(update) pbar.update(update)
i += 1 i += 1
except Exception as e: except Exception as e:

View File

@ -1,58 +0,0 @@
#!/usr/bin/env python
import sys
import pickle
import pdb
from interp.grid.DD import rect_grid, random_grid
from interp.baker import run_baker
from interp.tools import baker_exact_2D as exact_func
qfile = '/tmp/grid_regular.txt'
if __name__ == '__main__':
try:
rx = int(sys.argv[1])
ry = int(sys.argv[2])
except (IndexError, ValueError) as e:
print "problem with argv: %s" % e
rx = 4
ry = 4 * rx
source_mesh = rect_grid(rx, ry)
# print source_mesh
X = [0.5, 0.5]
try:
print "trying to get simplex and nearest points using nearest points (kdtree)"
(R, S) = source_mesh.get_simplex_and_nearest_points(X, extra_points=4)
print "R for nearest-neighbor:\n", R
print "S for nearest-neighbor:\n", S
print "trying to run baker"
print run_baker(X, R, S)
except Exception as e:
print "caught error: %s" % e
print "trying to get simplex and nearest points using connectivity scheme"
(R, S) = source_mesh.get_points_conn(X)
print "R for connectivity:\n", R
print "S for connectivity:\n", S
print run_baker(X, R, S)
print "repeating the above just using the grid object:"
r = source_mesh.run_baker(X)
exact = exact_func(X)
print r
print 'exact', exact
print 'qlin' , r['qlin']
print 'error', r['error']
print 'final', r['final']
if abs(r['final'] - exact) <= abs(r['qlin'] - exact):
print "win"
else:
print "failure"
open(qfile, 'w').write(source_mesh.for_qhull())

View File

@ -1,13 +1,13 @@
#!/usr/bin/env python #!/usr/bin/env python
import sys
import time import time
from interp.cluster import QueueManager, get_qs from interp.cluster import QueueManager, get_qs
from optparse import OptionParser from optparse import OptionParser
if __name__ == '__main__': if __name__ == '__main__':
parser = OptionParser(usage = "usage: %s [options] <status|watch|add|fresult #|slay|clear|clearall|clearresults>") parser = OptionParser(usage="usage: %s [options] <status|watch|add|"
"result #|slay|clear|clearall|clearresults>")
parser.add_option('-p', '--port', parser.add_option('-p', '--port',
type="int", dest="port", default=6666, type="int", dest="port", default=6666,
@ -27,7 +27,7 @@ if __name__ == '__main__':
m = QueueManager(address=('', options.port), authkey=options.authkey) m = QueueManager(address=('', options.port), authkey=options.authkey)
m.connect() m.connect()
tq,rq,mq,sq = get_qs(m) tq, rq, mq, sq = get_qs(m)
if cmd.startswith("st"): if cmd.startswith("st"):
print "interp queue status:" print "interp queue status:"
@ -72,16 +72,22 @@ if __name__ == '__main__':
print i, "killing", mq.get() print i, "killing", mq.get()
sq.put("slay") sq.put("slay")
if cmd == 'clear': if cmd == 'clear':
for i in xrange(tq.qsize()): print tq.get() for i in xrange(tq.qsize()):
for i in xrange(rq.qsize()): print rq.get() print tq.get()
for i in xrange(rq.qsize()):
print rq.get()
if cmd == 'clearall': if cmd == 'clearall':
for i in xrange(tq.qsize()): print tq.get() for i in xrange(tq.qsize()):
for i in xrange(rq.qsize()): print rq.get() print tq.get()
for i in xrange(mq.qsize()): print mq.get() for i in xrange(rq.qsize()):
for i in xrange(sq.qsize()): print sq.get() print rq.get()
for i in xrange(mq.qsize()):
print mq.get()
for i in xrange(sq.qsize()):
print sq.get()
if cmd == 'clearresults': if cmd == 'clearresults':
for i in xrange(rq.qsize()): print rq.get() for i in xrange(rq.qsize()):
print rq.get()

View File

@ -15,18 +15,20 @@ import numpy as np
from interp.cluster import QueueManager, get_qs from interp.cluster import QueueManager, get_qs
from progressbar import * from progressbar import ProgressBar, Percentage, Bar, ETA
if __name__ == '__main__': if __name__ == '__main__':
parser = OptionParser(usage = "usage: %s [options] <server> <interp count>") parser = OptionParser(usage="usage: %s [options] <server> <interp count>")
parser.add_option("-l", "--last-time", parser.add_option("-l", "--last-time",
action="store_true", dest="last", default=False, action="store_true", dest="last", default=False,
help="when finished, send shutdown signal to connected nodes (default: %default)") help="when finished, send shutdown signal to connected nodes"
"(default: %default)")
parser.add_option('-n', '--node-count', parser.add_option('-n', '--node-count',
type="int", dest="participants", default=None, type="int", dest="participants", default=None,
help="specify how many participants we should wait for (default: %default)") help="specify how many participants we should wait for"
"(default: %default)")
parser.add_option('-p', '--port', parser.add_option('-p', '--port',
type="int", dest="port", default=6666, type="int", dest="port", default=6666,
@ -41,7 +43,8 @@ if __name__ == '__main__':
help="number of extra points (default: %default)") help="number of extra points (default: %default)")
parser.add_option('-s', '--shelve', parser.add_option('-s', '--shelve',
type="str", dest="shelvename", default=os.path.expanduser('~/interp.shelve'), type="str", dest="shelvename",
default=os.path.expanduser('~/interp.shelve'),
help="shelve output file (default: %default)") help="shelve output file (default: %default)")
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
@ -76,7 +79,7 @@ if __name__ == '__main__':
for i in xrange(participants): for i in xrange(participants):
worker = masterq.get() worker = masterq.get()
workers.append(worker) workers.append(worker)
print "%d of %d: %s is ready" % (i+1, participants, worker) print "%d of %d: %s is ready" % (i + 1, participants, worker)
if len(set(workers)) != len(workers): if len(set(workers)) != len(workers):
for i in workers: for i in workers:
@ -86,28 +89,28 @@ if __name__ == '__main__':
results = [] results = []
widgets = ['submit jobs: ', Percentage(), ' ', Bar(), ' ', ETA()] widgets = ['submit jobs: ', Percentage(), ' ', Bar(), ' ', ETA()]
pbar = ProgressBar(widgets = widgets, maxval = count) pbar = ProgressBar(widgets=widgets, maxval=count)
pbar.start() pbar.start()
submit_start = time.time() submit_start = time.time()
for i in xrange(count): for i in xrange(count):
X = np.random.random((1,3))[0] X = np.random.random((1, 3))[0]
tasksq.put((i, options.order, options.extra, X)) tasksq.put((i, options.order, options.extra, X))
pbar.update(i+1) pbar.update(i + 1)
submit_end = time.time() submit_end = time.time()
pbar.finish() pbar.finish()
for i in xrange(participants): for i in xrange(participants):
print "sending worker %d start message" % (i+1,) print "sending worker %d start message" % (i + 1,)
minionsq.put("start") minionsq.put("start")
receive_start = time.time() receive_start = time.time()
widgets = ['interpolate: ', Percentage(), ' ', Bar(), ' ', ETA()] widgets = ['interpolate: ', Percentage(), ' ', Bar(), ' ', ETA()]
pbar = ProgressBar(widgets = widgets, maxval = count) pbar = ProgressBar(widgets=widgets, maxval=count)
pbar.start() pbar.start()
for i in xrange(count): for i in xrange(count):
cur_result = resultsq.get() cur_result = resultsq.get()
results.append(cur_result) results.append(cur_result)
pbar.update(i+1) pbar.update(i + 1)
receive_end = time.time() receive_end = time.time()
pbar.finish() pbar.finish()
@ -121,12 +124,12 @@ if __name__ == '__main__':
# post processing # post processing
stats = {} stats = {}
stats['submit' ] = float(submit) stats['submit'] = float(submit)
stats['receive' ] = float(receive) stats['receive'] = float(receive)
stats['count' ] = count stats['count'] = count
stats['participants'] = participants stats['participants'] = participants
stats['extra' ] = options.extra stats['extra'] = options.extra
stats['order' ] = options.order stats['order'] = options.order
print "%s" % stats print "%s" % stats
log.error("stats: %s", stats) log.error("stats: %s", stats)
@ -136,12 +139,12 @@ if __name__ == '__main__':
tasks_accomplished_by[i[1]] += 1 tasks_accomplished_by[i[1]] += 1
stats['tasks'] = tasks_accomplished_by stats['tasks'] = tasks_accomplished_by
# npresults = np.array([(i[0],i[2],i[3],i[4], i[5]) for i in results]) npresults = np.array([(i[0], i[2], i[3], i[4], i[5]) for i in results])
n = str(time.time()) n = str(time.time())
s = shelve.open(options.shelvename) s = shelve.open(options.shelvename)
s[n] = { s[n] = {
'stats' : stats, 'stats': stats,
# 'results' : npresults, 'results': npresults,
} }
s.close() s.close()

View File

@ -1,9 +0,0 @@
import sys
from interp.grid.gmsh import *
import time
s = time.time()
g = ggrid(sys.argv[1])
e = time.time()
print "time to parse mesh:", e-s

View File

@ -2,22 +2,16 @@
import sys import sys
import os import os
import time
from multiprocessing.managers import BaseManager
from optparse import OptionParser from optparse import OptionParser
import datetime
import numpy as np import numpy as np
from interp.grid.gmsh import ggrid from interp.grid.gmsh import ggrid
from interp.tools import baker_exact_3D as exact from interp.tools import baker_exact_3D as exact
from interp.cluster import QueueManager, get_qs from interp.cluster import QueueManager, get_qs
if __name__ == '__main__': if __name__ == '__main__':
parser = OptionParser(usage = "usage: %s [options] <server> <gmsh file>") parser = OptionParser(usage="usage: %s [options] <server> <gmsh file>")
parser.add_option("-v", "--verbose", parser.add_option("-v", "--verbose",
action="store_true", dest="verbose", default=False, action="store_true", dest="verbose", default=False,
@ -39,7 +33,6 @@ if __name__ == '__main__':
if options.verbose: if options.verbose:
print "%s: started" % myname print "%s: started" % myname
m = QueueManager(address=(server, options.port), authkey='asdf') m = QueueManager(address=(server, options.port), authkey='asdf')
m.connect() m.connect()
@ -52,7 +45,6 @@ if __name__ == '__main__':
if options.verbose: if options.verbose:
print "%s: done parsing input file" % myname print "%s: done parsing input file" % myname
while True: while True:
if options.verbose: if options.verbose:
print "%s: letting master know that I am ready" % myname print "%s: letting master know that I am ready" % myname
@ -70,8 +62,8 @@ if __name__ == '__main__':
while not tasksq.empty(): while not tasksq.empty():
i, o, e, X = tasksq.get() i, o, e, X = tasksq.get()
try: try:
a = g.run_baker(X, order = o, extra_points = e) a = g.run_baker(X, order=o, extra_points=e)
resultsq.put((i, myname, a['qlin'], a['error'], a['final'], exact(X))) resultsq.put((i, myname, a.qlin, a.error, a.final, exact(X)))
except Exception as e: except Exception as e:
print X, e print X, e
resultsq.put((i, myname, 0.0, 0.0, 0.0, 0.0)) resultsq.put((i, myname, 0.0, 0.0, 0.0, 0.0))

View File

@ -1,58 +0,0 @@
import sys
import pickle
import time
from progressbar import *
from interp.grid.DD import *
from interp.tools import *
from interp import bootstrap
EXTRA_POINTS = 64
RES_START = 10
RES_END = 100
RES_DELTA = 10
ORDER_START = 1
ORDER_END = 8
dest_verts, output_filename = sys.argv[1:]
dest_verts = pickle.load(open(dest_verts, 'r'))
output_file = open(output_filename, 'w')
count = len(dest_verts) * len(xrange(RES_START,RES_END + 1, RES_DELTA)) * len(xrange(ORDER_START, ORDER_END + 1))
widgets = ['submit jobs: ', Percentage(), ' ', Bar(), ' ', ETA()]
pbar = ProgressBar(widgets = widgets, maxval = count)
pbar.start()
i=0
for resolution in xrange(RES_START,RES_END + 1, RES_DELTA):
r = rect_grid(resolution, resolution)
for v in xrange(len(r.verts)):
r.q[v] = baker_exact_2D(r.verts[v])
output_file.write("%f" % (1.0 / resolution))
for order in xrange(ORDER_START, ORDER_END + 1):
errors = []
start = time.time()
for X in dest_verts:
a = r.run_baker(X, order, EXTRA_POINTS)
cur_exact = baker_exact_2D(X)
e = a['final'] - cur_exact
errors.append(e)
i+=1
pbar.update(i)
end = time.time()
rmserror = rms(errors)
output_file.write(" %e" % rmserror)
output_file.write("\n")
output_file.flush()
pbar.finish()

View File

@ -4,7 +4,7 @@ from interp.cluster import QueueManager
from optparse import OptionParser from optparse import OptionParser
if __name__ == '__main__': if __name__ == '__main__':
parser = OptionParser(usage = "usage: %s [options] <server> <interp count>") parser = OptionParser(usage="usage: %s [options] <server> <interp count>")
parser.add_option('-p', '--port', parser.add_option('-p', '--port',
type="int", dest="port", default=6666, type="int", dest="port", default=6666,

View File

@ -3,21 +3,18 @@
import sys import sys
import os import os
import time import time
from multiprocessing.managers import BaseManager
from optparse import OptionParser from optparse import OptionParser
import numpy as np import numpy as np
import interp.bootstrap
from interp.grid.gmsh import ggrid from interp.grid.gmsh import ggrid
from interp.tools import * from interp.tools import (baker_exact_2D, baker_exact_3D,
friendly_exact_2D, friendly_exact_3D)
from interp.cluster import QueueManager, get_qs from interp.cluster import QueueManager, get_qs
if __name__ == '__main__': if __name__ == '__main__':
parser = OptionParser(usage = "usage: %s [options] <server> <gmsh file> <dimension> <baker|friendly>") parser = OptionParser(usage="usage: %s [options] <server>"
" <gmsh file> <dimension> <baker|friendly>")
parser.add_option("-v", "--verbose", parser.add_option("-v", "--verbose",
action="store_true", dest="verbose", default=False, action="store_true", dest="verbose", default=False,
@ -45,12 +42,10 @@ if __name__ == '__main__':
elif dimension == 3 and exact_type == 'friendly': elif dimension == 3 and exact_type == 'friendly':
exact = friendly_exact_3D exact = friendly_exact_3D
myname = "%s-%d" % (os.uname()[1], os.getpid()) myname = "%s-%d" % (os.uname()[1], os.getpid())
if options.verbose: if options.verbose:
print "%s: started" % myname print "%s: started" % myname
m = QueueManager(address=(server, options.port), authkey='asdf') m = QueueManager(address=(server, options.port), authkey='asdf')
m.connect() m.connect()
@ -63,7 +58,6 @@ if __name__ == '__main__':
if options.verbose: if options.verbose:
print "%s: done parsing input file" % myname print "%s: done parsing input file" % myname
while True: while True:
if options.verbose: if options.verbose:
print "%s: letting master know that I am ready" % myname print "%s: letting master know that I am ready" % myname
@ -83,13 +77,13 @@ if __name__ == '__main__':
i, order, extra, X = tasksq.get() i, order, extra, X = tasksq.get()
try: try:
s = time.time() s = time.time()
a = g.run_baker(X, order = order, extra_points = extra) a = g.run_baker(X, order=order, extra_points=extra)
cur_qlin = a['qlin' ] cur_qlin = a.qlin
cur_error = a['error'] cur_error = a.error
cur_final = a['final'] cur_final = a.final
cur_exact = exact(X) cur_exact = exact(X)
e = time.time() e = time.time()
duration = e-s duration = e - s
except Exception as e: except Exception as e:
print >>sys.stderr, X, e print >>sys.stderr, X, e
cur_qlin = 0.0 cur_qlin = 0.0

View File

@ -1,19 +1,18 @@
#!/usr/bin/env python #!/usr/bin/env python
import sys
import time
from progressbar import *
from optparse import OptionParser from optparse import OptionParser
import pickle import pickle
import sys
import time
import numpy as np from progressbar import ProgressBar, ETA, Percentage, Bar
from interp.cluster import QueueManager, get_qs from interp.cluster import QueueManager, get_qs
if __name__ == '__main__': if __name__ == '__main__':
parser = OptionParser(usage = "%prog [options] <server> <destination vertexes file (pickle)> <results output file> <dimension>") parser = OptionParser(usage="%prog [options] <server>"
" <destination vertexes file (pickle)>"
" <results output file> <dimension>")
parser.add_option("-v", "--verbose", parser.add_option("-v", "--verbose",
action="store_true", dest="verbose", default=False, action="store_true", dest="verbose", default=False,
@ -25,7 +24,8 @@ if __name__ == '__main__':
parser.add_option('-n', '--node-count', parser.add_option('-n', '--node-count',
type="int", dest="participants", default=None, type="int", dest="participants", default=None,
help="specify how many participants we should wait for (default: %default)") help="specify how many participants we should"
" wait for (default: %default)")
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
if len(args) != 4: if len(args) != 4:
@ -37,9 +37,8 @@ if __name__ == '__main__':
dest_verts = pickle.load(open(dest_verts, 'r')) dest_verts = pickle.load(open(dest_verts, 'r'))
orders = [2,3,4,5] orders = [2, 3, 4, 5]
extras = [4,6,8,12, 16,20,32,48, 64,96,128,192, 256] extras = [4, 6, 8, 12, 16, 20, 32, 48, 64, 96, 128, 192, 256]
count = len(orders) * len(extras) * len(dest_verts) count = len(orders) * len(extras) * len(dest_verts)
@ -57,7 +56,7 @@ if __name__ == '__main__':
while not masterq.empty(): while not masterq.empty():
participants += 1 participants += 1
worker = masterq.get() worker = masterq.get()
print "%s (%d)" % (worker,participants) print "%s (%d)" % (worker, participants)
if participants == 0: if participants == 0:
print "nobody found" print "nobody found"
sys.exit(1) sys.exit(1)
@ -66,12 +65,12 @@ if __name__ == '__main__':
print "wait on %d participants" % participants print "wait on %d participants" % participants
for i in xrange(participants): for i in xrange(participants):
worker = masterq.get() worker = masterq.get()
print "%s (%d/%d)" % (worker, i+1, participants) print "%s (%d/%d)" % (worker, i + 1, participants)
print "Submitting %d pieces of workload" % count print "Submitting %d pieces of workload" % count
widgets = ['submit jobs: ', Percentage(), ' ', Bar(), ' ', ETA()] widgets = ['submit jobs: ', Percentage(), ' ', Bar(), ' ', ETA()]
pbar = ProgressBar(widgets = widgets, maxval = count) pbar = ProgressBar(widgets=widgets, maxval=count)
pbar.start() pbar.start()
submit_start = time.time() submit_start = time.time()
@ -80,29 +79,30 @@ if __name__ == '__main__':
for extra in extras: for extra in extras:
for X in dest_verts: for X in dest_verts:
cur_job = (i, order, extra, X) cur_job = (i, order, extra, X)
results[i] = [ order, extra, X] results[i] = [order, extra, X]
tasksq.put(cur_job) tasksq.put(cur_job)
i+=1 i += 1
pbar.update(i) pbar.update(i)
submit_end = time.time() submit_end = time.time()
pbar.finish() pbar.finish()
print "it took %0.2f seconds to submit the workload" % (submit_end - submit_start,) print("it took %0.2f seconds to submit"
" the workload" % (submit_end - submit_start,))
print "len(results)", len(results) print "len(results)", len(results)
for i in xrange(participants): for i in xrange(participants):
print "sending worker %d start message" % (i+1,) print "sending worker %d start message" % (i + 1,)
minionsq.put("start") minionsq.put("start")
receive_start = time.time() receive_start = time.time()
widgets = ['interpolate: ', Percentage(), ' ', Bar(), ' ', ETA()] widgets = ['interpolate: ', Percentage(), ' ', Bar(), ' ', ETA()]
pbar = ProgressBar(widgets = widgets, maxval = count) pbar = ProgressBar(widgets=widgets, maxval=count)
pbar.start() pbar.start()
for i in xrange(count): for i in xrange(count):
rid, qlin, err, final, exact, duration = resultsq.get() rid, qlin, err, final, exact, duration = resultsq.get()
results[rid].extend((qlin, err, final, exact, duration)) results[rid].extend((qlin, err, final, exact, duration))
pbar.update(i+1) pbar.update(i + 1)
receive_end = time.time() receive_end = time.time()
pbar.finish() pbar.finish()
@ -110,9 +110,11 @@ if __name__ == '__main__':
o = open(results_p_name, 'w') o = open(results_p_name, 'w')
for i in results: for i in results:
if dimension == 2: if dimension == 2:
o.write("%d %d %e %e %e %e %e %e %e\n" % (i[0], i[1], i[2][0], i[2][1], i[3], i[4], i[5], i[6], i[7])) o.write("%d %d %e %e %e %e %e %e %e\n" % (i[0], i[1], i[2][0],
i[2][1], i[3], i[4], i[5], i[6], i[7]))
elif dimension == 3: elif dimension == 3:
o.write("%d %d %e %e %e %e %e %e %e %e\n" % (i[0], i[1], i[2][0], i[2][1], i[2][2], i[3], i[4], i[5], i[6], i[7])) o.write("%d %d %e %e %e %e %e %e %e %e\n" % (i[0], i[1], i[2][0],
i[2][1], i[2][2], i[3], i[4], i[5], i[6], i[7]))
submit = submit_end - submit_start submit = submit_end - submit_start
receive = receive_end - receive_start receive = receive_end - receive_start
@ -123,9 +125,9 @@ if __name__ == '__main__':
# post processing # post processing
stats = {} stats = {}
stats['submit' ] = float(submit) stats['submit'] = float(submit)
stats['receive' ] = float(receive) stats['receive'] = float(receive)
stats['count' ] = count stats['count'] = count
stats['participants'] = participants stats['participants'] = participants
print "%s" % stats print "%s" % stats