예제 #1
0
def execute_sum_on_gpu_via_CU(a, b):
    assert a.shape == b.shape
    cu = CU(target='gpu')
    result = np.zeros_like(a)
    d_result = cu.output(result)
    cu.enqueue(sum, ntid=result.size, args=(a, b, result))
    cu.wait()
    cu.close()
    return result
예제 #2
0
def execute_sum_on_gpu_via_CU(a, b):
    assert a.shape == b.shape
    cu = CU(target='gpu')
    result = np.zeros_like(a)
    d_result = cu.output(result)
    cu.enqueue(sum, ntid=result.size, args=(a, b, result))
    cu.wait()
    cu.close()
    return result
예제 #3
0
def main():
    target = sys.argv[1]
    cu = CU(target)
    width = 500 * 40
    height = 750 * 40
    with closing(cu):
        image = np.zeros((width, height), dtype=np.uint8)
        d_image = cu.output(image)
        s = timer()
        create_fractal(cu, -2.0, 1.0, -1.0, 1.0, d_image, 20)
        cu.wait()
        e = timer()
    print(e - s)
예제 #4
0
def main():
    target = sys.argv[1]
    cu = CU(target)
    width = 500 * 40
    height = 750 * 40
    with closing(cu):
        image = np.zeros((width, height), dtype=np.uint8)
        d_image = cu.output(image)
        s = timer()
        create_fractal(cu, -2.0, 1.0, -1.0, 1.0, d_image, 20)
        cu.wait()
        e = timer()
    print(e - s)
예제 #5
0
def main():
    try:
        target = sys.argv[1]
    except:
        target = 'cpu'
    cu = CU(target)
    width = 500 * 10
    height = 750 * 10
    with closing(cu):
        image = np.zeros((width, height), dtype=np.uint8)
        d_image = cu.output(image)
        s = timer()
        create_fractal(cu, -2.0, 1.0, -1.0, 1.0, d_image, 20)
        cu.wait()
        e = timer()
    print('time: %f' % (e - s, ))
    #    print(image)
    imshow(image)
    show()
예제 #6
0
def main():
    try:
        target = sys.argv[1]
    except:
        target = 'cpu'
    cu = CU(target)
    width = 500 * 10
    height = 750 * 10
    with closing(cu):
        image = np.zeros((width, height), dtype=np.uint8)
        d_image = cu.output(image)
        s = timer()
        create_fractal(cu, -2.0, 1.0, -1.0, 1.0, d_image, 20)
        cu.wait()
        e = timer()
    print('time: %f' % (e - s,))
#    print(image)
    imshow(image)
    show()