declare int constant in device and host memory


I have some integer constants, that I want to define for both host and device. However when I type:

__host__ __device__ int constant = 10;

I get

and constant is only initialized on device but on the host it’s still zero. Is there a way to do that? I don’t want to use #define.

Kind Regards

Oh, seems that I can just declare the variable const…