Last active
August 29, 2015 14:12
-
-
Save ginkgo/9a552a07075c2cec726a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void krnl1_fn(__global int* A, | |
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 krnl1(global int* A) | |
{ | |
// Create a local variable and use it | |
local int l; | |
krnl1_fn(A, &l); | |
} | |
void kernel call(__global int* A) | |
{ | |
void (^block)(void) = | |
^{ | |
local int l; | |
krnl1_fn(A, &l); | |
}; | |
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