]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
go : fix CUDA build (#2416)
authorBinozo <redacted>
Sun, 15 Sep 2024 09:23:56 +0000 (11:23 +0200)
committerGitHub <redacted>
Sun, 15 Sep 2024 09:23:56 +0000 (12:23 +0300)
* Fixed go cuda bindings building

* Added note to go bindings Readme to build using cuda support

---------

Co-authored-by: Binozo <redacted>
bindings/go/Makefile
bindings/go/README.md

index 20a054c116fe2637a6bbe1708a96f4fc303146d6..ca39de20555f1c62f507d347d1df055bc97653c9 100644 (file)
@@ -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
index 1968cfd24700be7acdf5d54b9044b520e1425911..6958ede80f25afdcf33e53633d90faed7641d707 100644 (file)
@@ -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