ptxas error : File uses too much global constant data

Hi Everyone,
I hope you could help with this, I searched all over the internet and could find anything related to this error:
1>CUDACOMPILE : ptxas error : File uses too much global constant data (0x40cc4 bytes, 0x10000 max)
I am using VS2017 compiling with compute_61,sm_61

Another version of this code does compile and i think the main difference is that i am using a lot of simple defines like this:

#define taus_na12 (1022.879636954285)

Anyone has an idea how to deal with this error?

GPUs have multiple constant banks. One of these banks provides the programmer visible __constant__ memory, which is limited to 64 KB across all currently supported GPUs (see CUDA Programming Guide). Another bank is used for passing kernel arguments, yet another for literal constants from the source code or created by the compiler. When you build with -Xptxas -v, the compiler should report the usage of each constant bank (cmem[X]). Example:

ptxas info    : 10 bytes gmem, 65536 bytes cmem[3]
ptxas info    : Used 13 registers, 328 bytes cmem[0], 216 bytes cmem[2]

The bank assignments and the sizes of the non-programmer-visible ones vary from architecture to architecture. Best I can tell, for sm_61 kernel arguments use bank 0, literal constants use bank 2, and programmer visible __constant__ memory uses bank 3. Based on your description, it seems you are running out of space in bank 2. This is unusual, I cannot recall having encountered this issue in a dozen years of CUDA programming.

The obvious thing to try is to stick your data into __constant__ memory, i.e. bank 3. If that is not possible, check whether you can compress the data in any way. For example by storing some data as ‘float’ instead of ‘double’ or using narrower integer types. If that is not feasible, store the data in global or shared memory as appropriate.

Thanks for this njuffa.
when i run to see the ptxas output i get these lines that has cmem:
1>ptxas info : 0 bytes gmem, 265412 bytes cmem[3]
1>ptxas info : Used 90 registers, 652 bytes cmem[0]

Hence I am just using too much constant memory i guess is that true? ill try to fix that…

If the target architecture here is sm_61, it would appear you are using too much __constant__ memory.