28.07.2013 Views

Making OpenCL? Simple with Haskell - AMD Developer Central

Making OpenCL? Simple with Haskell - AMD Developer Central

Making OpenCL? Simple with Haskell - AMD Developer Central

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

PROGRAMMING KERNELS: WHAT IS A KERNEL<br />

A data-parallel function executed by each work-item<br />

kernel void square(global float* input,<br />

global float* output)<br />

{<br />

int i = get_global_id(0);<br />

output[i] = input[i] * input[i];<br />

}<br />

Input<br />

Output<br />

26 | <strong>Making</strong> <strong>OpenCL</strong> <strong>Simple</strong> | January, 2011 | Public<br />

get_global_id(0) = 7<br />

6 1 1 0 9 2 4 1 1 9 7 6 8 2 2 5<br />

36 1 1 0 81 4 16 1 1 81 49 36 64 4 4 25

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!