From 81d48561e63c66972f232951d297b98b80234b32 Mon Sep 17 00:00:00 2001 From: Stephen Mardson McQuay Date: Wed, 18 May 2011 12:59:57 -0600 Subject: [PATCH] improved the sheep --- bin/sheep.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/bin/sheep.py b/bin/sheep.py index 82ff33c..3b92307 100644 --- a/bin/sheep.py +++ b/bin/sheep.py @@ -13,12 +13,12 @@ import numpy as np import interp.bootstrap from interp.grid.gmsh import ggrid -from interp.tools import baker_exact_3D as exact +from interp.tools import * from interp.cluster import QueueManager, get_qs if __name__ == '__main__': - parser = OptionParser(usage = "usage: %s [options] ") + parser = OptionParser(usage = "usage: %s [options] ") parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, @@ -30,11 +30,22 @@ if __name__ == '__main__': (options, args) = parser.parse_args() - if len(args) != 2: + if len(args) != 4: parser.print_usage() sys.exit(1) - server, input_file = args + server, input_file, dimension, exact_type = args + dimension = int(dimension) + + if dimension == 2 and exact_type == 'baker': + exact = baker_exact_2D + elif dimension == 2 and exact_type == 'friendly': + exact = friendly_exact_2D + elif dimension == 3 and exact_type == 'baker': + exact = baker_exact_3D + elif dimension == 3 and exact_type == 'friendly': + exact = friendly_exact_3D + myname = "%s-%d" % (os.uname()[1], os.getpid()) if options.verbose: @@ -48,7 +59,7 @@ if __name__ == '__main__': if options.verbose: print "%s: starting parse input file" % myname - g = ggrid(input_file) + g = ggrid(input_file, dimension) g.q = np.array([exact(x) for x in g.verts]) if options.verbose: print "%s: done parsing input file" % myname @@ -63,7 +74,7 @@ if __name__ == '__main__': print "%s: waiting for master to tell me to start" % myname action = minionsq.get() if options.verbose: - print "%s: master said go!!" % myname + print "%s: got message from master: %s" % (myname, action) if action in ('teardown', 'slay'): break @@ -85,10 +96,9 @@ if __name__ == '__main__': cur_error = 0.0 cur_final = 0.0 cur_exact = 0.0 - duration = 0 + duration = 0 - resultsq.put(( - i, + resultsq.put((i, cur_qlin, cur_error, cur_final,