From 525cc93d4a9c151a4d8ac72ae388fcd07d5fe350 Mon Sep 17 00:00:00 2001 From: Thien Tran Date: Wed, 4 Jun 2025 08:59:24 +0800 Subject: [PATCH] fix system cudart detection on linux --- extensions/llamacpp-extension/src/backend.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/extensions/llamacpp-extension/src/backend.ts b/extensions/llamacpp-extension/src/backend.ts index 82481fcda..7e4a9db9d 100644 --- a/extensions/llamacpp-extension/src/backend.ts +++ b/extensions/llamacpp-extension/src/backend.ts @@ -242,9 +242,18 @@ async function _isCudaInstalled(version: string): Promise { const libname = libnameLookup[key] // check from system libraries first - // TODO: need to check for CuBLAS and CuBLASLt as well - if (await invoke('is_library_available', { library: libname })) - return true + // TODO: might need to check for CuBLAS and CuBLASLt as well + if (os_type === 'linux') { + // not sure why libloading cannot find library from name alone + // using full path here + const libPath = `/usr/local/cuda/lib64/${libname}` + if (await invoke('is_library_available', { library: libPath })) + return true + } else if (os_type === 'windows') { + // TODO: test this on Windows + if (await invoke('is_library_available', { library: libname })) + return true + } // check for libraries shipped with Jan's llama.cpp extension const janDataFolderPath = await getJanDataFolderPath()