Skip to content

Distribute and run LLMs with a single file.

Make --nocompile flag work as intended

Justine Tunney474b44fe7c25
diff --git a/llamafile/cuda.c b/llamafile/cuda.c
index 4a08ee8a..c265df8c 100644
--- a/llamafile/cuda.c
+++ b/llamafile/cuda.c
@@ -701,7 +701,9 @@ static bool ImportCudaImpl(void) {
strlcat(dso, "ggml-rocm.", PATH_MAX);
strlcat(dso, GetDsoExtension(), PATH_MAX);
if (FLAG_nocompile) {
- if (LinkCudaDso(dso, library_path)) {
+ if ((FileExists(dso) ||
+ ExtractCudaDso(dso, "ggml-rocm")) &&
+ LinkCudaDso(dso, library_path)) {
return true;
} else {
goto TryNvidia;
@@ -776,7 +778,9 @@ TryNvidia:
strlcat(dso, "ggml-cuda.", PATH_MAX);
strlcat(dso, GetDsoExtension(), PATH_MAX);
if (FLAG_nocompile) {
- return LinkCudaDso(dso, library_path);
+ return ((FileExists(dso) ||
+ ExtractCudaDso(dso, "ggml-cuda")) &&
+ LinkCudaDso(dso, library_path));
}
// Check if DSO is already compiled.