I'm writing a shared library containing cuda code, however cuda related code is only a very small part of that library and in most use cases users don't even need that cuda related features. For me, I don't want to compile and publish two versions: CPU version and GPU version. So I want to detect if cuda/GPU environment is available in users' runtime regardless they have a graphic card or not, is it possible? I've searched for a few answers but it's still unclear to me what's the minimal requirement for the library users to "detect cuda" in runtime?
Since I'm publishing a shared library, which dynamic linking to cuda, so I suppose users need to at least install cuda toolkit on his machine regardless he got a GPU or not? otherwise, my library will fail at the very beginning when trying to find cuda.so? Is my understanding correct....? And what would be the best practice to publish a library compatible with both GPU/non-GPU environments and decide the behavior during runtime?