compilinmg multiple .cu files with different maxrregcount

Hello everybody.

I have a problem with my CUDA application. I have implemented some kernels and I must use a different maxrregcount for each one. Those kernels are on different files. Is there a way to compile them separately as .o or .cpp and then compile them with other .cpp files or link them with other .o files? I already tried using nvcc -cuda option but once i try compiling those files they (quite obviously) give multiple declarations errors. Is really compilation in .cubin and the use of cuda driver APIs the only workaround? >.<

You can use nvcc -c to compile a .cu file to an object file which can be linked with the linker on your platform. There are a few caveats, because there is no device linker in the current build system. So textures and constant memory variables have to be declared in the same .cu file as all the kernels and device functions that use them.

Thanks for replying.

I tried to compile the wrappers for my kernels and my main separately in .o files and I linked them with ld as you said. It still gives me multiple definitions errors. Luckily i managed to find a maxrregcount value giving good results with all of my kernels so I can compile them in a single file again. I think I know wy I cannot link my .o files… :wacko: They all must include the cuda_runtime.h header file I cannot link them later this way. Isn’t there a way to set the -maxrregcount flag for each file I compile?