Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- kernel void bubbleSort2(global int* A, global int* B, local int* scratch) {
- int id = get_global_id(0);
- int lid = get_local_id(0);
- int N = get_global_size(0);
- double temp;
- scratch[lid] = A[id];
- barrier(CLK_LOCAL_MEM_FENCE);
- for (int i = N-1; i > 0; i--)
- {
- for (int j = 0; j <= i-1; j++)
- {
- if (A[j] > A[j+1])
- {
- temp = A[j];
- A[j] = A[j+1];
- A[j+1] = temp;
- }
- barrier(CLK_LOCAL_MEM_FENCE);
- }
- }
- B[id] = A[id];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement