__kernel void searchInTheBox(__global uint* global_A, __global uint* global_B, uint nPoints, uint nQueries) { for (uint loopQueryId = 0; loopQueryId < nQueries; loopQueryId++) { global_A[0] = 0; uint maximum_depth = nPoints; for (uint depth = 0; depth <= maximum_depth; depth++) { __global uint* temp = global_A; global_A = global_B; global_B = temp; } } }