Is there any way to initialize a global variable with a value that is passed on from the host?
The reason is that otherwise you need to pass the variable as an argument to every function which uses it, meaning that functions will have a huge amount of arguments. Also, it seems intuitive that it would slow down the program if the host has to pass on the variable each time a kernel uses it.
A simple example is:
host code:
y=1;
device code:
__constant int x=y;
__kernel void func()
{
int z;
z=x;
}