I am trying to reorganize a CUDA program I wrote into a better modularized structure. I separated the C from the CUDA bits, and compile each unit with their respective compilers, liking them in the end. Now I am trying to separate the CUDA kernels and the CUDA host code (the non-kernel part of the cuda call, such as cudaMalloc, cudaGetDeviceCount etc) in this unit .
Shall I compile the host code with nvcc as an cu file, or I can compile it with gcc as a C file?
I tried compiling the host code as a c file, but it always complains ‘cudaDeviceProp’ undeclared which I am pretty sure I’ve included the necessary header files.
thank you in advance for any suggestions.