]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
Allow compiling with CUDA without CUDA runtime installed (#7989)
authorUlrich Drepper <redacted>
Tue, 18 Jun 2024 12:00:14 +0000 (14:00 +0200)
committerGitHub <redacted>
Tue, 18 Jun 2024 12:00:14 +0000 (14:00 +0200)
On hosts which are not prepared/dedicated to execute code using CUDA
it is still possible to compile llama.cpp with CUDA support by just
installing the development packages.  Missing are the runtime
libraries like /usr/lib64/libcuda.so* and currently the link step
will fail.

The development environment is prepared for such situations.  There
are stub libraries for all the CUDA libraries available in the
$(CUDA_PATH)/lib64/stubs directory.  Adding this directory to the end
of the search path will not change anything for environments which
currently work fine but will enable compiling llama.cpp also in case
the runtime code is not available.

Makefile

index f94ee393377b74379b428475932bd4ab39af1d84..dddf647cd551d5495a0504809344e1d4260da453 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -507,7 +507,7 @@ ifdef LLAMA_CUDA
                CUDA_PATH ?= /usr/local/cuda
        endif
        MK_CPPFLAGS  += -DGGML_USE_CUDA -I$(CUDA_PATH)/include -I$(CUDA_PATH)/targets/$(UNAME_M)-linux/include -DGGML_CUDA_USE_GRAPHS
-       MK_LDFLAGS   += -lcuda -lcublas -lculibos -lcudart -lcublasLt -lpthread -ldl -lrt -L$(CUDA_PATH)/lib64 -L/usr/lib64 -L$(CUDA_PATH)/targets/$(UNAME_M)-linux/lib -L/usr/lib/wsl/lib
+       MK_LDFLAGS   += -lcuda -lcublas -lculibos -lcudart -lcublasLt -lpthread -ldl -lrt -L$(CUDA_PATH)/lib64 -L/usr/lib64 -L$(CUDA_PATH)/targets/$(UNAME_M)-linux/lib -L$(CUDA_PATH)/lib64/stubs -L/usr/lib/wsl/lib
        OBJS         += ggml-cuda.o
        OBJS         += $(patsubst %.cu,%.o,$(wildcard ggml-cuda/*.cu))
        OBJS         += $(OBJS_CUDA_TEMP_INST)