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
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)
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()
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()