viff

changeset 1012:464008ada9c2

Let -f enable benchmarking with fake field elements.
author Martin Geisler <mg@daimi.au.dk>
date Thu, 06 Nov 2008 14:25:27 +0100
parents 80ba4bffd726
children ff55a7388ce6
files apps/benchmark.py
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/apps/benchmark.py	Thu Nov 06 14:25:19 2008 +0100
     1.2 +++ b/apps/benchmark.py	Thu Nov 06 14:25:27 2008 +0100
     1.3 @@ -61,7 +61,7 @@
     1.4  
     1.5  from twisted.internet import reactor
     1.6  
     1.7 -from viff.field import GF, GF256
     1.8 +from viff.field import GF, GF256, FakeFieldElement
     1.9  from viff.runtime import BasicRuntime, create_runtime, gather_shares, \
    1.10      make_runtime_class
    1.11  from viff.passive import PassiveRuntime
    1.12 @@ -117,10 +117,12 @@
    1.13                    help="execute operations in parallel")
    1.14  parser.add_option("-s", "--sequential", action="store_false", dest="parallel",
    1.15                    help="execute operations in sequence")
    1.16 +parser.add_option("-f", "--fake", action="store_true",
    1.17 +                  help="skip local computations using fake field elements")
    1.18  
    1.19  parser.set_defaults(modulus=2**65, threshold=1, count=10,
    1.20                      active=False, twoplayer=False, prss=True,
    1.21 -                    operation=operations[0], parallel=True)
    1.22 +                    operation=operations[0], parallel=True, fake=False)
    1.23  
    1.24  # Add standard VIFF options.
    1.25  BasicRuntime.add_options(parser)
    1.26 @@ -135,7 +137,10 @@
    1.27  if not 1 <= options.threshold <= len(players):
    1.28      parser.error("threshold out of range")
    1.29  
    1.30 -Zp = GF(find_prime(options.modulus))
    1.31 +if options.fake:
    1.32 +    Zp = FakeFieldElement
    1.33 +else:
    1.34 +    Zp = GF(find_prime(options.modulus))
    1.35  count = options.count
    1.36  print "I am player %d, will %s %d numbers" % (id, options.operation, count)
    1.37