示例#1
0
def main():
    """
    Reduce all databases to oracle.
    """
    dbs = [migrate(_db.Database(path)) for path in
           fs.ls(experiment.DB_DEST, abspaths=True)
           if not re.search("oracle.db$", path)
           and re.search(".db$", path)]
    merge(fs.abspath(experiment.DB_DEST, "oracle.db"),
          dbs, experiment.ORACLE_PATH)
示例#2
0
def main():
    """
    Reduce all databases to oracle.
    """
    dbs = [
        migrate(_db.Database(path))
        for path in fs.ls(experiment.DB_DEST, abspaths=True)
        if not re.search("oracle.db$", path) and re.search(".db$", path)
    ]
    merge(fs.abspath(experiment.DB_DEST, "oracle.db"), dbs,
          experiment.ORACLE_PATH)
示例#3
0
def main():
    """
    Evaluate dataset and omnitune performance.
    """
    ml.start()
    db = migrate(_db.Database(experiment.ORACLE_PATH))

    # linear_models(db)
    classification(db)
    runtime_regression(db)
    speedup_regression(db)

    ml.stop()
示例#4
0
def merge(old_oracle, dbs, path):
    """
    Merge databases into one.

    Arguments:

        dbs (list of Database): Databases to merge.
        path (str): Path to merged database.

    Returns:

        Database: merged database instance.
    """
    print("Merging {n} databases:".format(n=len(dbs) + 1))
    print("   ", old_oracle)
    for db in dbs:
        print("   ", db)
    print()

    # Make a copy of the old oracle database to work from.
    io.info("Coping", old_oracle, "->", fs.basename(path))
    fs.cp(old_oracle, path)

    target = migrate(_db.Database(path=path))

    for db in dbs + [target]:
        try:
            db.num_rows("runtimes")
        except sqlite3.DatabaseError as e:
            io.error("Broken db:", db.path)
            io.fatal(e)

    num_runtimes = [db.num_rows("runtimes") for db in dbs]
    expected_total = target.num_rows("runtimes") + sum(num_runtimes)

    target.merge(dbs)

    total = target.num_rows("runtimes")

    if total != expected_total:
        io.fatal("Expected total", expected_total,
                 "!= actual total", total)

    io.info(("Merged {num_db} databases, {n} rows"
             .format(num_db=len(dbs), n=total)))

    return target
示例#5
0
def merge(old_oracle, dbs, path):
    """
    Merge databases into one.

    Arguments:

        dbs (list of Database): Databases to merge.
        path (str): Path to merged database.

    Returns:

        Database: merged database instance.
    """
    print("Merging {n} databases:".format(n=len(dbs) + 1))
    print("   ", old_oracle)
    for db in dbs:
        print("   ", db)
    print()

    # Make a copy of the old oracle database to work from.
    io.info("Coping", old_oracle, "->", fs.basename(path))
    fs.cp(old_oracle, path)

    target = migrate(_db.Database(path=path))

    for db in dbs + [target]:
        try:
            db.num_rows("runtimes")
        except sqlite3.DatabaseError as e:
            io.error("Broken db:", db.path)
            io.fatal(e)

    num_runtimes = [db.num_rows("runtimes") for db in dbs]
    expected_total = target.num_rows("runtimes") + sum(num_runtimes)

    target.merge(dbs)

    total = target.num_rows("runtimes")

    if total != expected_total:
        io.fatal("Expected total", expected_total, "!= actual total", total)

    io.info(("Merged {num_db} databases, {n} rows".format(num_db=len(dbs),
                                                          n=total)))

    return target
示例#6
0
def main():
    """
    Evaluate dataset and omnitune performance.
    """
    # Get the latest dataset from the oracle.
    db = migrate(_db.Database(experiment.ORACLE_PATH))

    backup_path = db.path + ".unprune"
    io.info("Writing backup to", backup_path)
    fs.cp(db.path, backup_path)

    # Strip scenarios for which there isn't enough unique workgroup
    # sizes.
    db.prune_min_params_per_scenario(25)
    # Strip scenarios so that there are at least a certain number of
    # safe parameters.
    db.prune_safe_params(3)