mix single+double precission & share constant cach how to request

Hi folks,

I’m need to do some calculations in double precision, but most can be done in single precision. It appears that if some lines of code in a function use double precision then nvcc causes the whole function to run using just one processor in the multiprocessor. So I’ve separated device functions that need double precision into one file, so they can be compiled with -arch sm_13, but most of the device functions use solely single precision, so they are placed in another file that is not compiled with -arch sm_13. This allows me to use double precision only when I need it and still get the superior performance of single precision when that’s good enough. So far, so good.

Now, I’m trying to figure out how to have data in the constant cache shared between the functions in both files. I read that constant variables are only at file scope and that I’m not allowed to declare constant variables as extern. I tried just declaring two constant arrays with the same name in each file, but that did not resulting in data sharing. How can I let the functions in a separate file (necessary to isolate double precision arithmetic to those functions) know about the data in the constant cache? Is there a correct way to pass a pointer to an array in the constant cache?