Example #1
0
succeeded = 0

for size, file in files:
    if file.endswith('.scm'):
        base, ext = os.path.splitext(file)
        path = os.path.join('tests', file)
        print 'compiling', path
        fail = file.startswith('f')
        c = context.context()
        c.verbose = False
        c.typetype = True
        if base in optimize:
            c.optimize = True
        try:
            compile.compile_file(open(path, 'rb'), path, c)
        except:
            if not fail:
                #raise
                failed.append((base, "compile failed"))
            else:
                succeeded += 1
        else:
            if fail:
                failed.append((base, 'compile did not fail like expected'))
                #raise ValueError ("oops - expected compilation to fail")
            if base not in special:
                out = run_test(base)
                exp_path = PJ('tests', base + '.exp')
                if os.path.isfile(exp_path):
                    exp = open(exp_path).read()
succeeded = 0

for size, file in files:
    if file.endswith ('.scm'):
        base, ext = os.path.splitext (file)
        path = os.path.join ('tests', file)
        print 'compiling', path
        fail = file.startswith ('f')
        c = context.context()
        c.verbose = False
        c.typetype = True
        if base in optimize:
            c.optimize = True
        try:
            compile.compile_file (open (path, 'rb'), path, c)
        except:
            if not fail:
                #raise
                failed.append ((base, "compile failed"))
            else:
                succeeded += 1
        else:
            if fail:
                failed.append ((base, 'compile did not fail like expected'))
                #raise ValueError ("oops - expected compilation to fail")
            if base not in special:
                out = run_test (base)
                exp_path = PJ ('tests', base + '.exp')
                if os.path.isfile (exp_path):
                    exp = open (exp_path).read()
Example #3
0
    data_l = []
    for i in range(8,24+1):
        size = 2**i
        iters = (2**28)//size
        if iters > 0:
            out_info = subprocess.check_output(arg_l+[str(size),str(iters)])
            value = float(out_info.decode(encoding='UTF-8').strip())
        else:
            value = 1.0
        data_l.append(value)
    return data_l
        
def data_to_str(data):
    return ','.join([str(d) for d in data])
    
compile_file("up_locs.cpp")
compile_file("asm_up_locs.cpp")
compile_file("vecasm_up_locs.cpp")

data = [
    file_data(["python3","update_locations.py"])
    file_data(["./up_locs"]),
    file_data(["./asm_up_locs"]),
    file_data(["./vecasm_up_locs"]),
    file_data(["python3","npup_locs.py"])
]
for n in range(len(data)):
    gname = "graphdata"+str(n) + ".csv"
    with open(gname,"wb") as gfile:
        for i in range(n+1):
            gfile.write((data_to_str(data[i])+"\n").encode(encoding='UTF-8'))