viff

changeset 670:1d832471464f

Mention Issue 30.
author Martin Geisler <mg@daimi.au.dk>
date Thu, 17 Apr 2008 13:55:45 +0200
parents 80b39789448f
children c61e075c67b6 64bedcf0060f f22be84127b8
files NEWS apps/benchmark.py
diffstat 2 files changed, 16 insertions(+), 11 deletions(-) [+]
line diff
     1.1 --- a/NEWS	Thu Apr 17 13:54:15 2008 +0200
     1.2 +++ b/NEWS	Thu Apr 17 13:55:45 2008 +0200
     1.3 @@ -46,6 +46,10 @@
     1.4  
     1.5  * The coercion done by the xor method was also fixed.
     1.6  
     1.7 +* Issue 30: Local multiplication if one operand is a constant. The
     1.8 +  runtime will now avoid an expensive resharing step when multiplying
     1.9 +  shares with constants.
    1.10 +
    1.11  * Issue 22: Allow sending data several times in one method. Previously
    1.12    one could only send once to a given players in a given method since
    1.13    all communication used the same program counter. The data is now
     2.1 --- a/apps/benchmark.py	Thu Apr 17 13:54:15 2008 +0200
     2.2 +++ b/apps/benchmark.py	Thu Apr 17 13:55:45 2008 +0200
     2.3 @@ -71,18 +71,18 @@
     2.4  start = 0
     2.5  
     2.6  
     2.7 -def record_start():
     2.8 +def record_start(what):
     2.9      global start
    2.10      start = time.time()
    2.11      print "*" * 64
    2.12 -    print "Started"
    2.13 +    print "Started", what
    2.14  
    2.15  
    2.16 -def record_stop(_):
    2.17 +def record_stop(_, what):
    2.18      stop = time.time()
    2.19      print
    2.20      print "Total time used: %.3f sec" % (stop-start)
    2.21 -    print "Time per operation: %.3f ms" % (1000*float(stop-start) / count)
    2.22 +    print "Time per %s operation: %.3f ms" % (what, 1000*float(stop-start) / count)
    2.23      print "*" * 6
    2.24  
    2.25  
    2.26 @@ -132,7 +132,9 @@
    2.27                  ("generate_triples", (Zp,)):
    2.28                      [(i, 1, 0) for i in range(3 + 2*count, 3 + 3*count)]
    2.29                  }
    2.30 +            record_start("preprocessing")
    2.31              preproc = rt.preprocess(program_desc)
    2.32 +            preproc.addCallback(record_stop, "preprocessing")
    2.33              preproc.addCallback(self.begin)
    2.34          else:
    2.35              print "Need no preprocessing"
    2.36 @@ -166,13 +168,14 @@
    2.37  
    2.38      def finished(self, _):
    2.39          print "Finished, synchronizing shutdown."
    2.40 +        sys.stdout.flush()
    2.41  
    2.42          if self.rt._needed_data:
    2.43              print "Missing pre-processed data:"
    2.44              pprint(self.rt._needed_data)
    2.45  
    2.46          sync = self.rt.synchronize()
    2.47 -        sync.addCallback(self.shutdown)
    2.48 +        sync.addCallback(lambda _: reactor.callLater(5, self.shutdown, None))
    2.49  
    2.50      def shutdown(self, _):
    2.51          print "Shutdown."
    2.52 @@ -184,24 +187,22 @@
    2.53  class ParallelBenchmark(Benchmark):
    2.54  
    2.55      def run_test(self, _):
    2.56 -        print "Starting parallel test."
    2.57          c_shares = []
    2.58 -        record_start()
    2.59 +        record_start("parallel test")
    2.60          while self.a_shares and self.b_shares:
    2.61              a = self.a_shares.pop()
    2.62              b = self.b_shares.pop()
    2.63              c_shares.append(self.operation(a, b))
    2.64  
    2.65          done = gather_shares(c_shares)
    2.66 -        done.addCallback(record_stop)
    2.67 +        done.addCallback(record_stop, "parallel test")
    2.68          done.addCallback(self.finished)
    2.69  
    2.70  # A benchmark where the operations are executed one after each other.
    2.71  class SequentialBenchmark(Benchmark):
    2.72  
    2.73      def run_test(self, _):
    2.74 -        print "Starting sequential test."
    2.75 -        record_start()
    2.76 +        record_start("sequential test")
    2.77          self.single_operation(None)
    2.78  
    2.79      def single_operation(self, _):
    2.80 @@ -211,7 +212,7 @@
    2.81              c = self.operation(a, b)
    2.82              c.addCallback(self.single_operation)
    2.83          else:
    2.84 -            record_stop(None)
    2.85 +            record_stop(None, "sequential test")
    2.86              self.finished(None)
    2.87  
    2.88  if options.operation == "mul":