This commit is contained in:
Stephen McQuay 2011-05-18 13:00:12 -06:00
commit 2c98902f0d
2 changed files with 10 additions and 6 deletions

View File

@ -21,7 +21,7 @@ log = logging.getLogger("interp")
from interp.cluster import QueueManager, get_qs
if __name__ == '__main__':
parser = OptionParser(usage = "%prog [options] <server> <destination vertexes file (pickle)>")
parser = OptionParser(usage = "%prog [options] <server> <destination vertexes file (pickle)> <results pickle>")
parser.add_option("-v", "--verbose",
action="store_true", dest="verbose", default=False,
@ -36,11 +36,11 @@ if __name__ == '__main__':
help="specify how many participants we should wait for (default: %default)")
(options, args) = parser.parse_args()
if len(args) != 2:
if len(args) != 3:
parser.print_usage()
sys.exit(1)
server, dest_verts = args
server, dest_verts, results_p_name = args
dest_verts = pickle.load(open(dest_verts, 'r'))
@ -89,7 +89,7 @@ if __name__ == '__main__':
for X in d:
cur_job = (i, order, extra, X)
results[i] = [ order, extra, X]
# tasksq.put(cur_job)
tasksq.put(cur_job)
i+=1
pbar.update(i)
submit_end = time.time()
@ -114,7 +114,7 @@ if __name__ == '__main__':
receive_end = time.time()
pbar.finish()
pickle.dump(results, open("results.p"))
pickle.dump(results, open(results_p_name, 'w'))
submit = submit_end - submit_start
receive = receive_end - receive_start

View File

@ -65,7 +65,11 @@ def improved_answer(answer, exact):
else:
log.debug(":( damaged result")
return False
def improved(qlin, err, final, exact):
if np.abs(final - exact) <= np.abs(qlin - exact):
return True
else:
return False
def percent_improvement(answer, exact):
return np.abs(answer['error']) / exact