Making OpenCL? Simple with Haskell - AMD Developer Central

Making OpenCL? Simple with Haskell - AMD Developer Central Making OpenCL? Simple with Haskell - AMD Developer Central

developer.amd.com
from developer.amd.com More from this publisher
28.07.2013 Views

USING HASKELL OUR GOAL IS TO WRITE THIS import Language.OpenCL.Module hstr = "Hello world\n“ hlen = length hstr + 1 prog = initCL [$cl| __constant char hw[] = $hstr; __kernel void hello(__global char * out) { size_t tid = get_global_id(0); out[tid] = hw[tid]; } |] main :: IO () main = withNew prog $ using (bufferWithFlags hwlen [WriteOnly]) $ \b -> do [k]

USING HASKELL OUR GOAL IS TO WRITE THIS import Language.OpenCL.Module hstr = "Hello world\n“ hlen = length hstr + 1 prog = initCL [$cl| __constant char hw[] = $hstr; __kernel void hello(__global char * out) { size_t tid = get_global_id(0); out[tid] = hw[tid]; } |] main :: IO () main = withNew Monad prog $ transformers using (bufferWithFlags hwlen [WriteOnly]) $ \b -> do [k]

USING HASKELL OUR GOAL IS TO WRITE THIS<br />

import Language.<strong>OpenCL</strong>.Module<br />

hstr = "Hello world\n“<br />

hlen = length hstr + 1<br />

prog = initCL [$cl|<br />

__constant char hw[] = $hstr;<br />

__kernel void hello(__global char * out) {<br />

size_t tid = get_global_id(0);<br />

out[tid] = hw[tid];<br />

}<br />

|]<br />

main :: IO ()<br />

main = <strong>with</strong>New prog $<br />

using (bufferWithFlags hwlen [WriteOnly]) $ \b -><br />

do [k]

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

Saved successfully!

Ooh no, something went wrong!