Use __constant__s in __host__ __device__ functions?

I’m doing some work which involves setting common values for a bunch of threads in constant structures. In unit tests, I’ve declared a few functions as host device so that I can test them externally without the overhead of copying data to cuda and running a kernel just to test, say, a float3_norm function (it’s more complex than that, but you get the idea).

However, I run into difficulties when I have to reference the constant structure, because (I think?) that’s only visible from the device side… with the end result that if I declare something as host device that references constant memory, the host and device versions will differ in behaviour.


__constant__ int Burfl;

__host__ __device__ int get_Burfl( void )


  return Burfl;  // Trouble, right?


Is there any way to get the same effect in both cases? Obviously I could make separate versions which copy the data from the Burfl symbol to host, but it’s a basic enough idiom I was wondering if there was an easier way.