Ejemplo n.º 1
0
def main():
    import argparse

    parser = argparse.ArgumentParser(description='Report a timing fit score')

    parser.add_argument('--verbose', action='store_true', help='')
    parser.add_argument('--corner', required=True, default="slow_max", help='')
    parser.add_argument(
        '--bounds-csv',
        required=True,
        help='Previous solve result starting point')
    parser.add_argument('fns_in', nargs='+', help='timing3.csv input files')
    args = parser.parse_args()
    # Store options in dict to ease passing through functions
    bench = Benchmark()

    fns_in = args.fns_in
    if not fns_in:
        fns_in = glob.glob('specimen_*/timing3.csv')

    try:
        run(
            fns_in=fns_in,
            corner=args.corner,
            bounds_csv=args.bounds_csv,
            verbose=args.verbose)
    finally:
        print('Exiting after %s' % bench)
Ejemplo n.º 2
0
def main():
    import argparse

    parser = argparse.ArgumentParser(
        description='Create a .csv with a single process corner')

    parser.add_argument('--verbose', type=int, help='')
    parser.add_argument('--auto-name',
                        action='store_true',
                        help='timing4i.csv => timing4c.csv')
    parser.add_argument('--out', default=None, help='Output csv')
    parser.add_argument('--corner', help='Output csv')
    parser.add_argument('fns_in', nargs='+', help='timing4i.csv input files')
    args = parser.parse_args()
    bench = Benchmark()

    fnout = args.out
    if fnout is None:
        if args.auto_name:
            assert len(args.fns_in) == 1
            fnin = args.fns_in[0]
            fnout = fnin.replace('timing4i.csv', 'timing4c.csv')
            assert fnout != fnin, 'Expect timing4i.csv in'
        else:
            fnout = '/dev/stdout'
    print("Writing to %s" % fnout)
    fout = open(fnout, 'w')

    fns_in = args.fns_in
    if not fns_in:
        fns_in = glob.glob('specimen_*/timing4i.csv')

    run(fout=fout, fns_in=fns_in, corner=args.corner, verbose=args.verbose)
Ejemplo n.º 3
0
def main():
    import argparse

    parser = argparse.ArgumentParser(
        description='Substitute .csv to ungroup correlated variables')

    parser.add_argument('--verbose', action='store_true', help='')
    #parser.add_argument('--sort', action='store_true', help='')
    parser.add_argument('--sub-csv', help='')
    parser.add_argument('--sub-json',
                        required=True,
                        help='Group substitutions to make fully ranked')
    parser.add_argument('--corner', default=None, help='')
    parser.add_argument('--out', default=None, help='output timing delay .csv')
    parser.add_argument(
        'fns_in',
        nargs='+',
        help='input timing delay .csv (NOTE: must be single column)')
    args = parser.parse_args()
    # Store options in dict to ease passing through functions
    bench = Benchmark()

    sub_json = load_sub(args.sub_json)

    try:
        run(
            args.fns_in,
            args.out,
            sub_json=sub_json,
            #sort=args.sort,
            verbose=args.verbose,
            corner=args.corner)
    finally:
        print('Exiting after %s' % bench)
Ejemplo n.º 4
0
def main():
    import argparse

    parser = argparse.ArgumentParser(
        description=
        'Compute reduced row echelon (RREF) to form sub.json (variable groups)'
    )

    parser.add_argument('--verbose', action='store_true', help='')
    parser.add_argument('--simplify', action='store_true', help='')
    parser.add_argument('--corner', default="slow_max", help='')
    parser.add_argument(
        '--speed-json',
        default='build_speed/speed.json',
        help='Provides speed index to name translation')
    parser.add_argument('--out', help='Output sub.json substitution result')
    parser.add_argument('fns_in', nargs='*', help='timing3.csv input files')
    args = parser.parse_args()
    bench = Benchmark()

    fns_in = args.fns_in
    if not fns_in:
        fns_in = glob.glob('specimen_*/timing3.csv')

    try:
        run(
            fnout=args.out,
            fn_ins=fns_in,
            simplify=args.simplify,
            corner=args.corner,
            verbose=args.verbose)
    finally:
        print('Exiting after %s' % bench)
Ejemplo n.º 5
0
def main():
    import argparse

    parser = argparse.ArgumentParser(
        description='Substitute .csv to group correlated variables')

    parser.add_argument('--verbose', action='store_true', help='')
    parser.add_argument('--strict', action='store_true', help='')
    parser.add_argument('--sub-csv', help='')
    parser.add_argument(
        '--sub-json',
        required=True,
        help='Group substitutions to make fully ranked')
    parser.add_argument('--out', help='Output sub.json substitution result')
    parser.add_argument('fns_in', nargs='+', help='timing3.csv input files')
    args = parser.parse_args()
    # Store options in dict to ease passing through functions
    bench = Benchmark()

    fns_in = args.fns_in
    if not fns_in:
        fns_in = glob.glob('specimen_*/timing3.csv')

    sub_json = load_sub(args.sub_json)

    try:
        run(
            fns_in,
            args.out,
            sub_json=sub_json,
            strict=args.strict,
            verbose=args.verbose)
    finally:
        print('Exiting after %s' % bench)
Ejemplo n.º 6
0
def main():
    import argparse

    parser = argparse.ArgumentParser(
        description='Check if sub.json would make a linear equation solvable')

    parser.add_argument('--verbose', action='store_true', help='')
    parser.add_argument('--sub-json', help='')
    parser.add_argument('fns_in', nargs='*', help='timing4i.csv input files')
    args = parser.parse_args()
    # Store options in dict to ease passing through functions
    bench = Benchmark()

    fns_in = args.fns_in
    if not fns_in:
        fns_in = glob.glob('specimen_*/timing4i.csv')

    sub_json = None
    if args.sub_json:
        sub_json = load_sub(args.sub_json)

    try:
        run(sub_json=sub_json, fns_in=fns_in, verbose=args.verbose)
    finally:
        print('Exiting after %s' % bench)
Ejemplo n.º 7
0
def run(rows=35,
        cols=200,
        verbose=False,
        encoding='np',
        sparse=False,
        normalize_last=True):
    random.seed(0)
    if sparse:
        mnp = create_matrix_sparse(rows, cols)
    else:
        mnp = create_matrix(rows, cols)
    #print(mnp[0])

    if encoding == 'fraction':
        msym = sympy.Matrix(fracm(mnp))
    elif encoding == 'np':
        msym = sympy.Matrix(mnp)
    elif encoding == 'sympy':
        msym = sympy.Matrix(symratm(mnp))
    # this actually produces float results
    elif encoding == 'int':
        msym = sympy.Matrix(intm(mnp))
    else:
        assert 0, 'bad encoding: %s' % encoding
    print(type(msym[0]), str(msym[0]))

    if verbose:
        print('names')
        print(names)
        print('Matrix')
        sympy.pprint(msym)

    print('%s matrix, %u rows x %u cols, sparse: %s, normlast: %s' %
          (encoding, len(mnp), len(mnp[0]), sparse, normalize_last))
    bench = Benchmark()
    try:
        rref, pivots = msym.rref(normalize_last=normalize_last)
    finally:
        print('rref exiting after %s' % bench)
    print(type(rref[0]), str(rref[0]))

    if verbose:
        print('Pivots')
        sympy.pprint(pivots)
        print('rref')
        sympy.pprint(rref)
Ejemplo n.º 8
0
def main():
    import argparse

    parser = argparse.ArgumentParser(
        description=
        'Convert obscure timing4.txt into timing4s.csv (site delay variable occurances)'
    )

    parser.add_argument('--verbose', type=int, help='')
    # made a bulk conversion easier...keep?
    parser.add_argument('--auto-name',
                        action='store_true',
                        help='timing4.txt => timing4i.csv')
    parser.add_argument('--speed-json',
                        default='build_speed/speed.json',
                        help='Provides speed index to name translation')
    parser.add_argument('--out', default=None, help='Output timing4i.csv file')
    parser.add_argument('fns_in', nargs='+', help='Input timing4.txt files')
    args = parser.parse_args()
    bench = Benchmark()

    fnout = args.out
    if fnout is None:
        if args.auto_name:
            assert len(args.fns_in) == 1
            fnin = args.fns_in[0]
            fnout = fnin.replace('.txt', 's.csv')
            assert fnout != fnin, 'Expect .txt in'
        else:
            # practically there are too many stray prints to make this work as expected
            assert 0, 'File name required'
            fnout = '/dev/stdout'
    print("Writing to %s" % fnout)
    fout = open(fnout, 'w')

    fns_in = args.fns_in
    if not fns_in:
        fns_in = glob.glob('specimen_*/timing4.txt')

    run(speed_json_f=open(args.speed_json, 'r'),
        fout=fout,
        fns_in=fns_in,
        verbose=args.verbose)
Ejemplo n.º 9
0
def main():
    import argparse

    parser = argparse.ArgumentParser(
        description=
        'Convert substitution groups into .csv to allow incremental rref results'
    )

    parser.add_argument('--verbose', action='store_true', help='')
    parser.add_argument('--out', help='Output csv')
    parser.add_argument('fns_in', nargs='+', help='sub.json input files')
    args = parser.parse_args()
    bench = Benchmark()

    fns_in = args.fns_in

    try:
        run(fnout=args.out, fn_ins=args.fns_in, verbose=args.verbose)
    finally:
        print('Exiting after %s' % bench)
Ejemplo n.º 10
0
def main():
    import argparse

    parser = argparse.ArgumentParser(
        description=
        'Solve timing solution using least squares objective function')

    parser.add_argument('--verbose', action='store_true', help='')
    parser.add_argument(
        '--massage',
        action='store_true',
        help='Derive additional constraints to improve solution')
    parser.add_argument(
        '--sub-json', help='Group substitutions to make fully ranked')
    parser.add_argument('--corner', required=True, default="slow_max", help='')
    parser.add_argument(
        '--out', default=None, help='output timing delay .json')
    parser.add_argument('fns_in', nargs='+', help='timing4i.csv input files')
    args = parser.parse_args()
    # Store options in dict to ease passing through functions
    bench = Benchmark()

    fns_in = args.fns_in
    if not fns_in:
        fns_in = glob.glob('specimen_*/timing4i.csv')

    sub_json = None
    if args.sub_json:
        sub_json = load_sub(args.sub_json)

    try:
        timfuz_solve.run(
            run_corner=run_corner,
            sub_json=sub_json,
            fns_in=fns_in,
            corner=args.corner,
            massage=args.massage,
            outfn=args.out,
            verbose=args.verbose)
    finally:
        print('Exiting after %s' % bench)