c.cu --设备端代码 include <a.h> constant float stencil[3];
另外,我看到cuda-c-programming-guide里面:
When compiling in the whole program compilation mode (see the nvcc user manual for a description of this mode), device, shared, and __constant__variables cannot be defined as external using the extern keyword. The only exception is for dynamically allocated shared variables as described in shared.
When compiling in the separate compilation mode (see the nvcc user manual for a description of this mode), device, shared, and constant variables can be defined as external using the extern keyword. nvlink will generate an error when it cannot find a definition for an external variable (unless it is a dynamically allocated shared variable).