merge
This commit is contained in:
commit
2c98902f0d
@ -21,7 +21,7 @@ log = logging.getLogger("interp")
|
|||||||
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)>")
|
parser = OptionParser(usage = "%prog [options] <server> <destination vertexes file (pickle)> <results pickle>")
|
||||||
|
|
||||||
parser.add_option("-v", "--verbose",
|
parser.add_option("-v", "--verbose",
|
||||||
action="store_true", dest="verbose", default=False,
|
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)")
|
help="specify how many participants we should wait for (default: %default)")
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
if len(args) != 2:
|
if len(args) != 3:
|
||||||
parser.print_usage()
|
parser.print_usage()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
server, dest_verts = args
|
server, dest_verts, results_p_name = args
|
||||||
|
|
||||||
dest_verts = pickle.load(open(dest_verts, 'r'))
|
dest_verts = pickle.load(open(dest_verts, 'r'))
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ if __name__ == '__main__':
|
|||||||
for X in d:
|
for X in d:
|
||||||
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()
|
||||||
@ -114,7 +114,7 @@ if __name__ == '__main__':
|
|||||||
receive_end = time.time()
|
receive_end = time.time()
|
||||||
pbar.finish()
|
pbar.finish()
|
||||||
|
|
||||||
pickle.dump(results, open("results.p"))
|
pickle.dump(results, open(results_p_name, 'w'))
|
||||||
|
|
||||||
submit = submit_end - submit_start
|
submit = submit_end - submit_start
|
||||||
receive = receive_end - receive_start
|
receive = receive_end - receive_start
|
||||||
|
@ -65,7 +65,11 @@ def improved_answer(answer, exact):
|
|||||||
else:
|
else:
|
||||||
log.debug(":( damaged result")
|
log.debug(":( damaged result")
|
||||||
return False
|
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):
|
def percent_improvement(answer, exact):
|
||||||
return np.abs(answer['error']) / exact
|
return np.abs(answer['error']) / exact
|
||||||
|
Loading…
Reference in New Issue
Block a user