From af1b3016eeb5db8b53de35d892a8ededa4ff4eca Mon Sep 17 00:00:00 2001 From: mudler Date: Mon, 18 Mar 2024 12:27:01 +0100 Subject: [PATCH] bindings/go: also look into stubs when CUBLAS is enabled Signed-off-by: mudler --- Makefile | 2 +- bindings/go/README.md | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 030391d0fc0..ef03ce582c6 100644 --- a/Makefile +++ b/Makefile @@ -224,7 +224,7 @@ ifdef WHISPER_CUBLAS CFLAGS += -DGGML_USE_CUBLAS -I/usr/local/cuda/include -I/opt/cuda/include -I$(CUDA_PATH)/targets/$(UNAME_M)-linux/include CXXFLAGS += -DGGML_USE_CUBLAS -I/usr/local/cuda/include -I/opt/cuda/include -I$(CUDA_PATH)/targets/$(UNAME_M)-linux/include - LDFLAGS += -lcuda -lcublas -lculibos -lcudart -lcublasLt -lpthread -ldl -lrt -L/usr/local/cuda/lib64 -L/opt/cuda/lib64 -L$(CUDA_PATH)/targets/$(UNAME_M)-linux/lib -L/usr/lib/wsl/lib + LDFLAGS += -lcuda -lcublas -lculibos -lcudart -lcublasLt -lpthread -ldl -lrt -L/usr/local/cuda/lib64 -L/opt/cuda/lib64 -L$(CUDA_PATH)/targets/$(UNAME_M)-linux/lib -L$(CUDA_PATH)/targets/$(UNAME_M)-linux/lib -L/usr/lib/wsl/lib WHISPER_OBJ += ggml-cuda.o NVCC = nvcc NVCCFLAGS = --forward-unknown-to-host-compiler -arch=$(CUDA_ARCH_FLAG) diff --git a/bindings/go/README.md b/bindings/go/README.md index 1968cfd2470..678c461ee25 100644 --- a/bindings/go/README.md +++ b/bindings/go/README.md @@ -94,6 +94,20 @@ Getting help: * Follow the discussion for the go bindings [here](https://github.com/ggerganov/whisper.cpp/discussions/312) +## Notes + +### CUDA + +If you are using the binding with cuda and having linker issues, you may need to set the `CGO_LDFLAGS` environment variable to include the cuda libraries. For example: + +```bash +CGO_LDFLAGS="-L/usr/local/cuda-11.7/targets/x86_64-linux/lib/stubs/ -L/usr/local/cuda/lib64/ -lcuda -lcublas -lcudart -lculibos -lcublasLt" +``` + +Note that the exact paths and libraries may vary depending on your system and CUDA installation, notice some symbols are present in the `stubs` directory and others in the `lib64` directory. + +See also https://github.com/ggerganov/whisper.cpp/issues/1553 for more information. + ## License The license for the Go bindings is the same as the license for the rest of the whisper.cpp project, which is the MIT License. See the `LICENSE` file for more details.