Ejemplo n.º 1
0
def test_method(matrix, data, nproc=1):
    write_input(data)

    if not data.local_solver.startswith('vb'):
        exe = './dd-mtx-dse.ex'
    else:
        exe = './Bdd-mtx-dse.ex'

    #~ if nprocs = None:
        #~ nprocs = [1]
    #~ for n in nprocs:
    n = nproc

    fname = get_fname(matrix, data, n)
    c = Command('mpiexec -n ' + str(n) + ' ' + exe)
    ret = c.run(600)

    #~ shutil.copy('output.txt', fname)
    f = open('output.txt', 'r')
    l = f.readlines()
    f.close()
    f = open(fname, 'w')
    f.write(''.join(l[-13:]))
    f.close()
    new_data = parse_file(fname)

    if ret != 0:
        new_data.isgood = False

    pp = matrix.split('/')[4].split('.')[0] + ' with '+ method + ' and ' + str(data.droptol)+ ' and '+ str(int(data.nlev))+ ', t='+ str(new_data.total_time) + ', mem=' + str(new_data.memory) + ', tau='+ str(data.tau)+', ret=' + str(ret) +'\n'
    write_debug(pp)

    return new_data
Ejemplo n.º 2
0
def test_method(matrix, data, nproc=1):
    write_input(data)

    if not data.local_solver.startswith('vb'):
        exe = './dd-mtx-dse.ex'
    else:
        exe = './Bdd-mtx-dse.ex'

    #~ if nprocs = None:
    #~ nprocs = [1]
    #~ for n in nprocs:
    n = nproc

    fname = get_fname(matrix, data, n)
    c = Command('mpiexec -n ' + str(n) + ' ' + exe)
    ret = c.run(600)

    #~ shutil.copy('output.txt', fname)
    f = open('output.txt', 'r')
    l = f.readlines()
    f.close()
    f = open(fname, 'w')
    f.write(''.join(l[-13:]))
    f.close()
    new_data = parse_file(fname)

    if ret != 0:
        new_data.isgood = False

    pp = matrix.split('/')[4].split(
        '.')[0] + ' with ' + method + ' and ' + str(
            data.droptol) + ' and ' + str(int(data.nlev)) + ', t=' + str(
                new_data.total_time) + ', mem=' + str(
                    new_data.memory) + ', tau=' + str(
                        data.tau) + ', ret=' + str(ret) + '\n'
    write_debug(pp)

    return new_data
Ejemplo n.º 3
0
    #f.write('')
    #f.close()
    for m in matrices:
        f = open('matfileReal', 'w')
        f.write(m+'\n##')
        f.close()

        fdict = {}
        fvdict = {}
        data = InputData()

        for method in ['vbarms']:
            data.local_solver = method
            fname = get_fname(m, data, nproc)
            if os.path.isfile(fname) and not overwrite:
                fv = parse_file(fname)
                continue

            for tau in (0.6, 0.7, 0.8, 0.9, 1.0):
                data.tau = tau

                data.droptol = 1
                fa = test_method(m, data)
                fdict[fa] = copy.copy(data)

                data.droptol = 1e-8
                fb = test_method(m, data)
                fdict[fb] = copy.copy(data)

                testing = fa.isgood or fb.isgood
                while testing:
Ejemplo n.º 4
0
    #f.write('')
    #f.close()
    for m in matrices:
        f = open('matfileReal', 'w')
        f.write(m + '\n##')
        f.close()

        fdict = {}
        fvdict = {}
        data = InputData()

        for method in ['vbarms']:
            data.local_solver = method
            fname = get_fname(m, data, nproc)
            if os.path.isfile(fname) and not overwrite:
                fv = parse_file(fname)
                continue

            for tau in (0.6, 0.7, 0.8, 0.9, 1.0):
                data.tau = tau

                data.droptol = 1
                fa = test_method(m, data)
                fdict[fa] = copy.copy(data)

                data.droptol = 1e-8
                fb = test_method(m, data)
                fdict[fb] = copy.copy(data)

                testing = fa.isgood or fb.isgood
                while testing: