Esempio n. 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
Esempio n. 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
Esempio n. 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)
Esempio n. 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)
Esempio n. 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()
Esempio n. 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()