Skip to content

Commit 91171b8

Browse files
make : fix CLBLAST compile support in FreeBSD (#2331)
* Fix Makefile for CLBLAST compile support and instructions for compile llama.cpp FreeBSD * More general use-case for CLBLAST support (Linux and FreeBSD)
1 parent 355c80f commit 91171b8

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,15 @@ ggml-cuda.o: ggml-cuda.cu ggml-cuda.h
235235
endif # LLAMA_CUBLAS
236236

237237
ifdef LLAMA_CLBLAST
238-
CFLAGS += -DGGML_USE_CLBLAST
239-
CXXFLAGS += -DGGML_USE_CLBLAST
238+
239+
CFLAGS += -DGGML_USE_CLBLAST $(shell pkg-config --cflags clblast OpenCL)
240+
CXXFLAGS += -DGGML_USE_CLBLAST $(shell pkg-config --cflags clblast OpenCL)
241+
240242
# Mac provides OpenCL as a framework
241243
ifeq ($(UNAME_S),Darwin)
242244
LDFLAGS += -lclblast -framework OpenCL
243245
else
244-
LDFLAGS += -lclblast -lOpenCL
246+
LDFLAGS += $(shell pkg-config --libs clblast OpenCL)
245247
endif
246248
OBJS += ggml-opencl.o
247249

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,23 @@ In order to build llama.cpp you have three different options.
242242
zig build -Doptimize=ReleaseFast
243243
```
244244

245+
- Using `gmake` (FreeBSD):
246+
247+
1. Install and activate [DRM in FreeBSD](https://wiki.freebsd.org/Graphics)
248+
2. Add your user to **video** group
249+
3. Install compilation dependencies.
250+
251+
```bash
252+
sudo pkg install gmake automake autoconf pkgconf llvm15 clinfo clover \
253+
opencl clblast openblas
254+
255+
gmake CC=/usr/local/bin/clang15 CXX=/usr/local/bin/clang++15 -j4
256+
```
257+
258+
**Notes:** With this packages you can build llama.cpp with OPENBLAS and
259+
CLBLAST support for use OpenCL GPU acceleration in FreeBSD. Please read
260+
the instructions for use and activate this options in this document below.
261+
245262
### Metal Build
246263

247264
Using Metal allows the computation to be executed on the GPU for Apple devices:

0 commit comments

Comments
 (0)