Adding .cu files to a DLL

Hey everyone,

I was wondering if it is possible to include .cu files (or files based on .cu files) inside a VS2005 project which would ultimately compile to be a DLL. I have gotten the FFT code working in DLL mode to my satisfaction, but that doesn’t require loading a kernel. I would like to do some post processing on the FFT data, but this seems to require a kernel for which I written the .cu file.

Ultimately: “Is there a way to integrate the .cu file into a DLL? If yes, how is this done?”


Yes it works just fine.

Just add the cu files to your project and setup their custom compile options. For the runtime API you can use the custom ‘rules’ file in the CUDA sdk directory.

You then communicate between cu files and cpp files by creating external functions (there are examples in the CUDA SDK that illustrate this).

Alternatively use the driver API theirs a good example on this as of version 0.9. Just have a look at an example ending with ‘Drv’.

Wonderful! I will give it a try. Thanks.

Above answer from AustinMcElroy
>>> (there are examples in the CUDA SDK that illustrate this)
(Assuming “illustrate this” is: have some exe code calling kernels defined inside a DLL without using the driver API)

I looked in the examples directory but couldn’t find anything with “dll” in its name.
Could you please tell me which example to look at? (the .vcxproj file, how to do that)