Load libcuda.so.1 if libcuda.so is missing

This commit is contained in:
dec05eba 2022-09-26 01:57:35 +02:00
parent a648b591a0
commit febffdacc9

View File

@ -50,8 +50,11 @@ struct Cuda {
dlerror(); // clear dlerror(); // clear
void *lib = dlopen("libcuda.so", RTLD_LAZY); void *lib = dlopen("libcuda.so", RTLD_LAZY);
if(!lib) { if(!lib) {
fprintf(stderr, "Error: failed to load libcuda.so, error: %s\n", dlerror()); lib = dlopen("libcuda.so.1", RTLD_LAZY);
return false; if(!lib) {
fprintf(stderr, "Error: failed to load libcuda.so and libcuda.so.1, error: %s\n", dlerror());
return false;
}
} }
cuInit = (CUINIT)load_symbol(lib, "cuInit"); cuInit = (CUINIT)load_symbol(lib, "cuInit");
@ -126,4 +129,4 @@ private:
} }
private: private:
void *library = nullptr; void *library = nullptr;
}; };