Is it possible to program with CUDA in dll files?

We have a program that loads modules that are in dll files. Each module has 2 functions which are the modules interface to the program.
Would it be possible to use CUDA in the dll file(i.e. the module) when the program that loads the module doesn’t support CUDA or is unaware that the module uses CUDA?
Thanks,
Greenman External Image

yes

Sure, why not? But you would require to ship “cudart.dll” and possibly “nvcuda.dll” if you want to work on any hardware (whether they have CUDA enabled card or not). This will ensure that your application will NOT have “DLL not found” error in platforms that dont have CUDA installed… In such platforms, your DLL module could possibly just run on CPUs.

Check out this discussion…

http://forums.nvidia.com/index.php?showtopic=82897

nvcuda.dll is installed with the NVIDIA driver. Applications should not distribute it. cudart.dll can be distributed, though.

First of all, thanks for the help.

Just to be in the safe side, “nvcuda” is needed only for computers that have a CUDA supported card and is part of the driver.

While computers without a CUDA supported card need “cudart.dll”.

Is this correct?

nvuda.dll is the portion of the NVIDIA driver that handles the low level CUDA calls to the GPU. If you write a Driver API program, this is the only library needed to run it.

cudart.dll is the runtime API dll that comes with the CUDA toolkit. If you write a CUDA runtime API program and want it to run on a users’s computer without having them install the CUDA toolkit, you need to redistribute a copy of cudart.dll along with it.

Computes that won’t run CUDA need neither. Since you are stuffing your CUDA calls all in dll, just don’t load it unless CUDA calculations are enabled.