In CUDA, when I delcare an array in constant memory like below
__device__ __constant__ float A[n];
does the size n need to be a constant?
I guess is yes, because the compiler needs to know if the size n exceeds the constant memory size or not. Is that right?
 
                        
Yes, it needs to be constant. The reason for this is that it is a static allocation, so the compiler needs to know the size at compile-time.
And, yes, the compiler does check the size against what is available.