It seems that the NVCC compiler can not check if external device variables really exsits.
For example, the following single file only denots an external device variable named ADEV, but no definition file is supplied. But when I comile the single file test.cu.
The compiler can generate executable file named a.exe.
Example source: test.cu
extern device constant int ADEV;
global void test(void)
int B; B=ADEV;
int A; int ierr; A=1234; ierr=cudaMemcpyToSymbol("ADEV",&A,sizeof(int)); printf("cudaMemcpyToSymbol return ierr=%d \n",ierr); test<<<1,1>>>(); return 0;
In contrast, if it is on host side, this un-defined variables can be pointed out and can not generate the exe file.
extern int A;
A=1234; return 0;
Anyone can tell me why and how can I let the nvcc compiler tell me if one external variable has been defined.
Thank you in advance.