Beispiel #1
0
def run_test():
    size = 130
    weight_array = WeightArray(
        np.ones((3, 3), dtype=np.float) / 9
    )
    component = StencilComponent(
        "input",
        weight_array
    )
    red = DomainUnion([
        RectangularDomain((
            (1, -1, 2),
            (1, -1, 2)
        )),
        RectangularDomain((
            (2, 0, 2),
            (2, 0, 2)
        ))
    ])
    stencil = Stencil(
        component,
        "output",
        red
    )
    ccompiler = OpenMPCompiler()
    kern = ccompiler.compile(stencil)
    arr = np.arange(size**2, dtype=np.float).reshape((size, size))
    out = np.zeros_like(arr)
    kern(out, arr)
    print(out)
Beispiel #2
0
def run_test():
    weight_array = WeightArray(np.ones((3, 3, 3), dtype=np.float) / 27)
    component = StencilComponent("input", weight_array)
    stencil = Stencil(component, "output", [(1, -1, 1)] * 3)
    ccompiler = OpenMPCompiler()
    kern = ccompiler.compile(stencil)
    arr = np.arange(66**3, dtype=np.float).reshape((66, 66, 66))
    out = np.zeros_like(arr)
    kern(out, arr)
Beispiel #3
0
def run_test():
    size = 130
    weight_array = WeightArray(np.ones((3, 3), dtype=np.float) / 9)
    component = StencilComponent("input", weight_array)
    red = DomainUnion([
        RectangularDomain(((1, -1, 2), (1, -1, 2))),
        RectangularDomain(((2, 0, 2), (2, 0, 2)))
    ])
    stencil = Stencil(component, "output", red)
    ccompiler = OpenMPCompiler()
    kern = ccompiler.compile(stencil)
    arr = np.arange(size**2, dtype=np.float).reshape((size, size))
    out = np.zeros_like(arr)
    kern(out, arr)
    print(out)
Beispiel #4
0
def run_test():
    weight_array = WeightArray(
        np.ones((3, 3, 3), dtype=np.float) / 27
    )
    component = StencilComponent(
        "input",
        weight_array
    )
    stencil = Stencil(
        component,
        "output",
        [(1, -1, 1)]*3
    )
    ccompiler = OpenMPCompiler()
    kern = ccompiler.compile(stencil)
    arr = np.arange(66**3, dtype=np.float).reshape((66, 66, 66))
    out = np.zeros_like(arr)
    kern(out, arr)