Skip to content
Snippets Groups Projects
Commit 1d39ccd7 authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Minor fixes to Mandelbrot example.

parent 7866e181
No related branches found
No related tags found
No related merge requests found
...@@ -27,11 +27,11 @@ import pyopencl as cl ...@@ -27,11 +27,11 @@ import pyopencl as cl
# Speed notes are listed in the same place # Speed notes are listed in the same place
# set width and height of window, more pixels take longer to calculate # set width and height of window, more pixels take longer to calculate
w = 256 w = 512
h = 256 h = 512
def calc_fractal_opencl(q, maxiter): def calc_fractal_opencl(q, maxiter):
ctx = cl.Context(cl.get_platforms()[0].get_devices()) ctx = cl.create_some_context()
queue = cl.CommandQueue(ctx) queue = cl.CommandQueue(ctx)
output = np.empty(q.shape, dtype=np.uint16) output = np.empty(q.shape, dtype=np.uint16)
...@@ -62,10 +62,10 @@ def calc_fractal_opencl(q, maxiter): ...@@ -62,10 +62,10 @@ def calc_fractal_opencl(q, maxiter):
} }
""").build() """).build()
prg.mandelbrot(queue, output.shape, (64,), q_opencl, prg.mandelbrot(queue, output.shape, None, q_opencl,
output_opencl, np.uint16(maxiter)) output_opencl, np.uint16(maxiter))
cl.enqueue_read_buffer(queue, output_opencl, output).wait() cl.enqueue_copy(queue, output, output_opencl).wait()
return output return output
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment