Skip to content

Instantly share code, notes, and snippets.

@ginkgo
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ginkgo/9a552a07075c2cec726a to your computer and use it in GitHub Desktop.
Save ginkgo/9a552a07075c2cec726a to your computer and use it in GitHub Desktop.
void kernel krnl1(__global int* A)
{
// Create a local variable and use it
local int l;
if (get_local_id(0)==0) {
l = A[get_global_id(0)];
}
barrier(CLK_LOCAL_MEM_FENCE);
A[get_global_id(0)] = l;
}
void kernel call(__global int* A)
{
void (^block)(void) = ^{krnl1(A);};
clk_event_t done;
enqueue_kernel(get_default_queue(),
CLK_ENQUEUE_FLAGS_NO_WAIT,
ndrange_1D(1024,64), 0, NULL, &done,
block);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment