__host__ __device__ variable


I have noticed that when a global variable is declared host device (e.g. host device float a = 1.0;), it cannot be accessed in the host code. However, if you declare the variable as const (e.g. const float a = 1.0;), it can be accessed in both host and device.

What is happening here?