I’m new to OpenCL and I’m trying to implement a simple function in OpenCL. The function is supposed to be called from a kernel function.
void swap(int *a, int *b)
{
int *temp = a;
b = a;
a = temp;
}
However upon calling it, the swap doesn’t work.
Is there a way to pass parameters by reference?
The way you have written the function, it is not doing anything. You are just assigning the pointers around. You need to have this:
Reference parameters are not allowed, as far as I recall.