Can't find CUDA Static libraries

I am trying to export my code as an exe with static libraries, so I can use it on any system with a GPU in the office. Unfortunately, I can’t find the static libraries in my install. When I try to reinstall CUDA, there is no option to install static libraries. Have I completely misunderstood static libraries in CUDA? Do I need to get them elsewhere? Can the dynamic libraries be used as static libraries? I’d appreciate any help.

In the parlance I am familiar with, that is not what static libraries are for. Static libraries are bound permanently to the application at app link time. You do not distribute them. Even if you did, an application cannot dynamically link to a static library, so there would be no way an application could make use of static libraries distributed with the app.

An example of a static library on linux in a standard install is

/usr/local/cuda/lib64/libcudart_static.a

the corresponding dynamic library would be:

/usr/local/cuda/lib64/libcudart.so

If you have done a typical CUDA install using the methodology provided by NVIDIA here, and either or both of those files are missing, then your install is broken, somehow.

There is no separate option to install static libraries. Using the previous example, and the installation source I indicated, you will get both of those libraries.

Conceptually, things are not hugely different on windows. The library names vary a bit, for example a typical dynamic library would end in .dll, not .so. However, for cudart (the CUDA runtime library), there are both static and dynamic versions provided, and they will be both in the same lib directory.

If your application is statically linked to a library, there is no need to also provide that library. If your application is dynamically linked to a library, then it may be necessary to distribute the dynamic version of that library (.dll or .so) with your application.

Thanks for the information. I am using Visual Studio, in my solution properties I had to define cudart_static.lib instead of cudart.lib as the library to use, but I can’t find an equivalent for the cusparse, cublas, and cusolver libraries. Do they not exist? If so, how am I meant to export my code as standalone .exe? Do I need to distribute those libraries with my code?

no, they don’t exist. The footprint of available static libraries on windows vs. linux is different.

To make any windows exe that uses these (cusparse, cublas, cusolver), you must use dynamic libraries/dynamic linking. There is no other option for those libraries. Therefore if those libraries (.dll) don’t already exist on the target machine, you will need to distribute them. They are mentioned in the distribution link I already provided.

Never tried them, so without warranty:

There exist tools to convert DLLs to static libraries.
E.g. https://dll-to-lib.software.informer.com/

Could be allowed or forbidden by Nvidia license terms.

Would be nice to hear from you, if you successfully used them with the Cuda DLLs.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.