From: Binozo Date: Sun, 15 Sep 2024 09:23:56 +0000 (+0200) Subject: go : fix CUDA build (#2416) X-Git-Tag: upstream/1.7.4~443 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=049b3a0e53c8a8e4c4576c06a1a4fccf0063a73f;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp go : fix CUDA build (#2416) * Fixed go cuda bindings building * Added note to go bindings Readme to build using cuda support --------- Co-authored-by: Binozo --- diff --git a/bindings/go/Makefile b/bindings/go/Makefile index 20a054c1..ca39de20 100644 --- a/bindings/go/Makefile +++ b/bindings/go/Makefile @@ -17,6 +17,11 @@ EXAMPLES_DIR := $(wildcard examples/*) INCLUDE_PATH := $(abspath ../../include):$(abspath ../../ggml/include) LIBRARY_PATH := $(abspath ../..) +ifeq ($(GGML_CUDA),1) + LIBRARY_PATH := $(LIBRARY_PATH):$(CUDA_PATH)/targets/$(UNAME_M)-linux/lib/ + BUILD_FLAGS := -ldflags "-extldflags '-lcudart -lcuda -lcublas'" +endif + ifeq ($(UNAME_S),Darwin) EXT_LDFLAGS := -framework Foundation -framework Metal -framework MetalKit endif diff --git a/bindings/go/README.md b/bindings/go/README.md index 1968cfd2..6958ede8 100644 --- a/bindings/go/README.md +++ b/bindings/go/README.md @@ -62,6 +62,12 @@ This will compile a static `libwhisper.a` in a `build` folder, download a model make examples ``` +To build using cuda support add `GGML_CUDA=1`: + +```bash +GGML_CUDA=1 make examples +``` + The examples are placed in the `build` directory. Once built, you can download all the models with the following command: ```bash