Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Check existence of cuda

ozanarmaganbf38c33551d9
diff --git a/src/text_embedder.cpp b/src/text_embedder.cpp
index ea1d5b03..d4bd5471 100644
--- a/src/text_embedder.cpp
+++ b/src/text_embedder.cpp
@@ -14,12 +14,15 @@ TextEmbedder::TextEmbedder(const std::string& model_name) {
for(auto& provider : providers) {
if(provider == "CUDAExecutionProvider") {
- // check existence of so file
- void* handle = dlopen("libonnxruntime_providers_cuda.so", RTLD_LAZY);
+ // check existence of cuda
+ void* handle = dlopen("libcudnn.so", RTLD_NOW | RTLD_GLOBAL);
if(!handle) {
+ LOG(ERROR) << "Error loading CUDA: " << dlerror();
continue;
}
+ dlclose(handle);
+
LOG(INFO) << "Using CUDAExecutionProvider";
OrtCUDAProviderOptions cuda_options;
session_options.AppendExecutionProvider_CUDA(cuda_options);