How can I declare a device variable that is global to all the threads in OpenCL? I'm porting some code from CUDA to OpenCL. In my CUDA implementation I have something like
...
...
__device__ int d_var;
...
...
void foo() {
int h_var = 0
cudaMemcpyToSymbol(d_var, h_var, sizeof(int));
do{
//launch kernel, inside kernel d_var is modified
cudaMemcpyFromSymbol(h_var, d_var, sizeof(int));
}while(h_var != 0);
}
I've been reading through OpenCL example codes but cannot figure out how to do this. Any advise would be great !