Alright, I have a really troubling CUDA 5.0 question about how to link things properly. I'd be really grateful for any assistance!
Using the separable compilation features of CUDA 5.0, I generated a static library (*.a). This nicely links with other *.cu files when run through nvcc, I have done this many times.
I'd now like to take a *.cpp file and link it against the host code in this static library using g++ or whatever, but not nvcc. If I attempt this, I get compiler errors like
undefined reference to __cudaRegisterLinkedBinary
I'm using both -lcuda
and -lcudart
and, to my knowledge, have the libraries in the correct order (meaning -lmylib -lcuda -lcudart
). I don't think it is an issue with that. Maybe I'm wrong, but I feel I'm missing a step and that I need to do something else to my static library (device linking?) before I can use it with g++.
Have I missed something crucial? Is this even possible?
Bonus question: I want the end result to be a dynamic library. How can I achieve this?
nvcc
(ornvlink
) to link, notg++
.g++
doesn't know how to link together device objects. – Titanium