Compiling / Linking with g++

Hi all,

I’m currently involved with a project at my school where we try to implement some simple 3d convolution techniques using CUDA. I’m kind of new to both Cuda and Linux which is the OS used for this project.

We have to use the schools implemented framework for the Makefiles which currently only supports the default compilers (meaning no NVCC). As I have very little experience using both Makefiles in general and g++. I have tried reading up on some good information and think I have the basics down but as time goes by we’re approaching our deadline.

That’s why I’m turning here for help from you a little more experienced guys. What I need to know is if it’s possible to “precompile” the files using cuda code with NVCC to either separate files in two files using host and device code (I know that’s possible and how it’s done. Problem is I don’t know how to get it back together using only g++) or creating obj files or library files that can later be linked together or used with g++ to make an executable (or a library file which might be the end product for use in other applications)?

Any information or examples of how it could be done (or not done) would be much appreciated.


Edit: I found the solution. Of course after hours in front of the computer screen reading documentations it’s when you finally ask for help you find the solution right away. And of course find out that’s it really quite simple :wacko:

My approach was to create an .so file and link to it when compiling my C++ code. What was your solution?

It would be very helpful if you would post your solution here. I realize you’ve answered your own question, but chances are someone is going to have a similar question at some point. If they search and find this thread, they would surely appreciate it.

Ah, yeah…sorry…I did it the same way as you did. First created shared library file and linked it when compiling with the schools makefile framework. I missed the --shared flag. Made it kinda simple :)