Packaging of NVIDIA drivers DLLs for deployment


I have written my own Windows DLL in order to use TensorFlow software in our applications and our clients’ software. Basically this DLL is linked to the CUDA and CUDNN DLLs, and also seems to be linked to two NVIDIA drivers DLLs, namely nvcuda.dll and nvfatbinaryloader.dll. When used on a machine with those drivers prperly installed onto the system (i.e. in C:\Windows\System32), it works perfectly fine, the GPU is detected and properly used by our applications.

However, the two aforementioned driver DLLs need to be present even if there is no NVIDIA GPU on the machine, which is normal because our DLL was built with GPU support. Then when packaging our applications the two DLLs are copied into a local version in the application directory. It works fine without GPU, because those DLL are simply loaded at runtime but never used. The problem occurs when we try to use the GPU, as the application systematically crashes with memory allocation problems, or alternatively the GPU is not recognized. This is not an incompatibility problem between the driver and the CUDA version, since the two local DLLs are carbon copies of the DLLs installed onto the system. Oddly enough, when we delete the local DLLs (and let the application use the system-installed DLLs instead), this application works fine. It seems that simply copying the driver DLLs in the application packaging is insufficient. Do you have any insights on how to solve that?

1 Like

Put the bundled DLLs in a search path with lower priority than the windows system32 search path. If the driver installed DLLs are present, they will be used. If not, the bundled DLLs will be used.

alternatively, delay-load the DLLs so that they are not needed if you don’t detect GPU support in the platform.