示例#1
0
def test_mandelbrot_fpga():
    mandelbrot = import_sample(Path("simple") / "mandelbrot.py")
    h, w, max_iterations = 64, 64, 1000
    out = dace.ndarray([h, w], dtype=dace.uint16)
    out[:] = dace.uint32(0)
    sdfg = mandelbrot.mandelbrot.to_sdfg()
    sdfg.apply_transformations(FPGATransformSDFG)
    sdfg(output=out, MAXITER=max_iterations, W=w, H=h)
    return sdfg
示例#2
0
def test_naive_matmul_fpga():
    matmul = import_sample(Path("optimization") / "matmul.py")
    sdfg = matmul.matmul.to_sdfg()
    sdfg.apply_transformations(FPGATransformSDFG)

    n, k, m = 64, 64, 64

    A = np.random.rand(m, k).astype(np.float64)
    B = np.random.rand(k, n).astype(np.float64)
    C = np.zeros((m, n), dtype=np.float64)

    sdfg(A=A, B=B, C=C, N=n, K=k, M=m)

    expected = A @ B
    diff = np.linalg.norm(C - expected) / (m * n)

    assert diff <= 1e-6

    return sdfg
示例#3
0
def test_systolic_matmul_fpga():
    matmul = import_sample(Path("fpga") / "matrix_multiplication_systolic.py")
    return matmul.run_matmul_systolic(128, 32, 64, 4, False)
示例#4
0
def test_spmv_fpga():
    spmv = import_sample(Path("fpga") / "spmv_fpga_stream.py")
    return spmv.run_spmv(64, 64, 640, False)
示例#5
0
def test_jacobi_fpga():
    jacobi = import_sample(Path("fpga") / "jacobi_fpga_systolic.py")
    return jacobi.run_jacobi(64, 512, 16, 4)
示例#6
0
def test_gemv_fpga():
    gemv = import_sample(Path("fpga") / "gemv_fpga.py")
    return gemv.run_gemv(1024, 1024, False)