mkeller
changeset 1117:e2759515f57f
Use schedule_callback() instead of addCallback() where necessary.
Furthermore, adjust program counter values for preprocessing of multiplication.
Furthermore, adjust program counter values for preprocessing of multiplication.
| author | Marcel Keller <mkeller@cs.au.dk> |
|---|---|
| date | Thu Mar 05 21:02:57 2009 +0100 (3 years ago) |
| parents | d522f9b14b49 |
| children | 3ed76dce61d6 |
| files | apps/benchmark.py |
line diff
1.1 --- a/apps/benchmark.py Thu Feb 26 19:35:08 2009 +0100 1.2 +++ b/apps/benchmark.py Thu Mar 05 21:02:57 2009 +0100 1.3 @@ -162,7 +162,7 @@ 1.4 print "Synchronizing preprocessing" 1.5 sys.stdout.flush() 1.6 sync = self.rt.synchronize() 1.7 - sync.addCallback(self.preprocess) 1.8 + self.rt.schedule_callback(sync, self.preprocess) 1.9 1.10 def preprocess(self, _): 1.11 program_desc = {} 1.12 @@ -174,7 +174,7 @@ 1.13 # run with no preprocessing. So they are quite brittle. 1.14 if self.operation == operator.mul: 1.15 key = ("generate_triples", (Zp,)) 1.16 - desc = [(i, 1, 0) for i in range(3 + 2*count, 3 + 3*count)] 1.17 + desc = [(i, 1, 0) for i in range(2, 2 + count)] 1.18 program_desc.setdefault(key, []).extend(desc) 1.19 elif isinstance(self.rt, ComparisonToft05Mixin): 1.20 key = ("generate_triples", (GF256,)) 1.21 @@ -197,7 +197,7 @@ 1.22 record_start("preprocessing") 1.23 preproc = self.rt.preprocess(program_desc) 1.24 preproc.addCallback(record_stop, "preprocessing") 1.25 - preproc.addCallback(self.begin) 1.26 + self.rt.schedule_callback(preproc, self.begin) 1.27 else: 1.28 print "Need no preprocessing" 1.29 self.begin(None) 1.30 @@ -216,13 +216,13 @@ 1.31 self.a_shares.append(self.rt.input([inputter], Zp, a)) 1.32 self.b_shares.append(self.rt.input([inputter], Zp, b)) 1.33 shares_ready = gather_shares(self.a_shares + self.b_shares) 1.34 - shares_ready.addCallback(self.sync_test) 1.35 + self.rt.schedule_callback(shares_ready, self.sync_test) 1.36 1.37 def sync_test(self, _): 1.38 print "Synchronizing test start." 1.39 sys.stdout.flush() 1.40 sync = self.rt.synchronize() 1.41 - sync.addCallback(self.countdown, 3) 1.42 + self.rt.schedule_callback(sync, self.countdown, 3) 1.43 1.44 def countdown(self, _, seconds): 1.45 if seconds > 0: 1.46 @@ -262,7 +262,7 @@ 1.47 1.48 done = gather_shares(c_shares) 1.49 done.addCallback(record_stop, "parallel test") 1.50 - done.addCallback(self.finished) 1.51 + self.rt.schedule_callback(done, self.finished) 1.52 1.53 # A benchmark where the operations are executed one after each other. 1.54 class SequentialBenchmark(Benchmark): 1.55 @@ -276,7 +276,7 @@ 1.56 a = self.a_shares.pop() 1.57 b = self.b_shares.pop() 1.58 c = self.operation(a, b) 1.59 - c.addCallback(self.single_operation) 1.60 + self.rt.schedule_callback(c, self.single_operation) 1.61 else: 1.62 record_stop(None, "sequential test") 1.63 self.finished(None)
