Thomas Pelle Jakobsen <[EMAIL PROTECTED]> writes:

> # HG changeset patch
> # User Thomas Pelle Jakobsen <[EMAIL PROTECTED]>
> # Date 1226015362 -3600
> # Node ID aa8ba57c7833f0d68792db7c36782e3ba9fbc194
> # Parent  dd640eac89c544273c9e1a7230af6b44c975bf01
> Added example benchmark suite.
>
> diff -r dd640eac89c5 -r aa8ba57c7833 apps/benchmark/example.py
> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
> +++ b/apps/benchmark/example.py       Fri Nov 07 00:49:22 2008 +0100
> @@ -0,0 +1,104 @@
> +#!/usr/bin/python
> +#
> +# Copyright 2007, 2008 VIFF Development Team.
> +#
> +# This file is part of VIFF, the Virtual Ideal Functionality Framework.
> +#
> +# VIFF is free software: you can redistribute it and/or modify it
> +# under the terms of the GNU Lesser General Public License (LGPL) as
> +# published by the Free Software Foundation, either version 3 of the
> +# License, or (at your option) any later version.
> +#
> +# VIFF is distributed in the hope that it will be useful, but WITHOUT
> +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
> +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
> +# Public License for more details.
> +#
> +# You should have received a copy of the GNU Lesser General Public
> +# License along with VIFF. If not, see <http://www.gnu.org/licenses/>.
> +
> +from database import Database
> +from suite import Suite
> +from examples.ComparisonToft05 import ComparisonToft05
> +from examples.LocalMult import LocalMult

Modules are welcome to contain more than one class and should be named
in lowercase.

> +import sys
> +
> +if __name__ == "__main__":
> +    database = Database(host="localhost",
> +                        db="viff_benchmark",
> +                        user="root",

Ahem... root?

> +                        passwd=sys.argv[1])

We should eventually put the password somewhere else since the command
line arguments are visible to all applications on the machine.

> +    
> +    """
> +    These statements reset the database and define the needed attributes
> +    and hosts. They should only be executed once for a certain benchmark
> +    database.
> +    
> +    TODO: Move the predefined attributes, e.g. n, threshold, etc. to
> +    constructors of Benchmark and VIFFBenchmark. Ideally, user should only
> +    need to add the attributes that are specific for his benchmarks.
> +    
> +    TODO: Make sure that adding an already existing host causes no harm.   
> +    """
> +    database.reset()
> +    database.add_host("camel17.daimi.au.dk")
> +    database.add_host("camel18.daimi.au.dk")
> +    database.add_host("camel19.daimi.au.dk")
> +    database.add_host("camel21.daimi.au.dk")
> +    database.add_host("camel22.daimi.au.dk")

I guess these host names should be read from a file...

> +    database.add_attribute(name="execution_time", label="microseconds")
> +    database.add_attribute(name="runs")
> +    database.add_attribute(name="benchmark_id") # Redundant, but still need 
> it.

Why do we need it? I guess the comment should be expanded to explain it.

> +    database.add_attribute(name="db_user", 
> type=Database.AttributeType.String)
> +    database.add_attribute(name="db_passwd", 
> type=Database.AttributeType.String)
> +    database.add_attribute(name="db_name", 
> type=Database.AttributeType.String)
> +    database.add_attribute(name="db_host", 
> type=Database.AttributeType.String)
> +    database.add_attribute(name="db_port")
> +    database.add_attribute(name="n")
> +    database.add_attribute(name="threshold")
> +    database.add_attribute(name="modulus", 
> type=Database.AttributeType.String)
> +    database.add_attribute(name="use_ssl", enum=['False', 'True'], 
> +                                 type=Database.AttributeType.Enumeration)
> +
> +    
> +    
> +    s = Suite(#hg_repository="http://hg.viff.dk/viff";,
> +              revision="383e6bfb4863", 
> +              database=database,
> +              user="mas",
> +              viff_dir="$HOME/opt",
> +              work_dir="/users/mas/temp/viff-benchmark",
> +              hosts=[("camel17.daimi.au.dk", 9734), 
> +                     ("camel18.daimi.au.dk", 9843),
> +                     ("camel19.daimi.au.dk", 9962),
> +                     ("camel21.daimi.au.dk", 9963),
> +                     ("camel22.daimi.au.dk", 9964)])

We have to put this kind of configuration options in a .ini file or
similar. Or maybe a YAML file -- I like that format and it is extremely
simple to work with:

  http://pyyaml.org/wiki/PyYAML


-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.

Attachment: pgpxmSLF39aQq.pgp
Description: PGP signature

_______________________________________________
viff-patches mailing list
[email protected]
http://lists.viff.dk/listinfo.cgi/viff-patches-viff.dk

Reply via email to