]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
make : fix CLBLAST compile support in FreeBSD (#2331)
authorJose Maldonado <redacted>
Sun, 23 Jul 2023 11:52:08 +0000 (07:52 -0400)
committerGitHub <redacted>
Sun, 23 Jul 2023 11:52:08 +0000 (14:52 +0300)
* Fix Makefile for CLBLAST compile support and instructions for compile llama.cpp FreeBSD

* More general use-case for CLBLAST support (Linux and FreeBSD)

Makefile
README.md

index 1ea3c45622487eaa4da54f05213956137ddbf613..e620835ef6d25431ef1480fc99f0cf33d49db934 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -235,13 +235,15 @@ ggml-cuda.o: ggml-cuda.cu ggml-cuda.h
 endif # LLAMA_CUBLAS
 
 ifdef LLAMA_CLBLAST
-       CFLAGS   += -DGGML_USE_CLBLAST
-       CXXFLAGS += -DGGML_USE_CLBLAST
+
+       CFLAGS   += -DGGML_USE_CLBLAST $(shell pkg-config --cflags clblast OpenCL)
+       CXXFLAGS += -DGGML_USE_CLBLAST $(shell pkg-config --cflags clblast OpenCL)
+
        # Mac provides OpenCL as a framework
        ifeq ($(UNAME_S),Darwin)
                LDFLAGS += -lclblast -framework OpenCL
        else
-               LDFLAGS += -lclblast -lOpenCL
+               LDFLAGS += $(shell pkg-config --libs clblast OpenCL)
        endif
        OBJS    += ggml-opencl.o
 
index f45e4bf0849f06b4f7dbbb0eb4e79e4bf9a42f2e..c9fe6187bf9d184db6a3ce5fc17b4ce0eb3e44e0 100644 (file)
--- a/README.md
+++ b/README.md
@@ -242,6 +242,23 @@ In order to build llama.cpp you have three different options.
     zig build -Doptimize=ReleaseFast
     ```
 
+-   Using `gmake` (FreeBSD):
+
+    1. Install and activate [DRM in FreeBSD](https://wiki.freebsd.org/Graphics)
+    2. Add your user to **video** group
+    3. Install compilation dependencies.
+
+        ```bash
+        sudo pkg install gmake automake autoconf pkgconf llvm15 clinfo clover \
+            opencl clblast openblas
+
+            gmake CC=/usr/local/bin/clang15 CXX=/usr/local/bin/clang++15 -j4
+        ```
+
+    **Notes:** With this packages you can build llama.cpp with OPENBLAS and
+    CLBLAST support for use OpenCL GPU acceleration in FreeBSD. Please read
+    the instructions for use and activate this options in this document below.
+
 ### Metal Build
 
 Using Metal allows the computation to be executed on the GPU for Apple devices: