Building CUDA library

Anyone could share experiences on how to build a new CUDA library properly (instead of just implementing a separate .cu and .cuh file)?

Because there is currently no such things as a CUDA linker, you can’t build a “CUDA library” in the conventional sense. What can be done is to make a host side library of host wrapper functions, where each wrapper function can contain calls to device side code and definitions (like textures, constant memory variables, etc) used only within the scope of the file in which it is compiled. This is how things like CUBLAS and the CUDA FFT library are done.

yup what I want to do is to develop something in a way similar to CUBLAS (and would be able to call CUBLAS functions as well).
I am familar with simple CUDA programming, but is kind of newbie for building ‘libraries’. Wonder if someone could guide me from scratch.

How you do it is going to depend on what platform you are on, because the way the backend and linker work is pretty different for windows, linux and OS X.

Just use CMake.

Creating a library on all supported platforms is as easy as:



It takes care of all the gory details of building the library.