mirror of
https://github.com/mudler/LocalAI.git
synced 2024-12-29 17:08:52 +00:00
fix: OSX Build Fix Part 1: Metal (#1365)
* Make Metal the default on OSX, simplify osx-specific code, and fix the file copy error. * fix endif / comment
This commit is contained in:
parent
c3fb4b1d8e
commit
e94a34be8c
23
Makefile
23
Makefile
@ -68,10 +68,17 @@ ifndef UNAME_S
|
|||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(UNAME_S),Darwin)
|
ifeq ($(OS),Darwin)
|
||||||
CGO_LDFLAGS += -lcblas -framework Accelerate
|
CGO_LDFLAGS += -lcblas -framework Accelerate
|
||||||
ifneq ($(BUILD_TYPE),metal)
|
ifeq ($(OSX_SIGNING_IDENTITY),)
|
||||||
# explicit disable metal if on Darwin and metal is disabled
|
OSX_SIGNING_IDENTITY := $(shell security find-identity -v -p codesigning | grep '"' | head -n 1 | sed -E 's/.*"(.*)"/\1/')
|
||||||
|
endif
|
||||||
|
|
||||||
|
# on OSX, if BUILD_TYPE is blank, we should default to use Metal
|
||||||
|
ifeq ($(BUILD_TYPE),)
|
||||||
|
BUILD_TYPE=metal
|
||||||
|
# disable metal if on Darwin and any other value is explicitly passed.
|
||||||
|
else ifneq ($(BUILD_TYPE),metal)
|
||||||
CMAKE_ARGS+=-DLLAMA_METAL=OFF
|
CMAKE_ARGS+=-DLLAMA_METAL=OFF
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -106,12 +113,6 @@ ifeq ($(BUILD_TYPE),clblas)
|
|||||||
CGO_LDFLAGS+=-lOpenCL -lclblast
|
CGO_LDFLAGS+=-lOpenCL -lclblast
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OS),Darwin)
|
|
||||||
ifeq ($(OSX_SIGNING_IDENTITY),)
|
|
||||||
OSX_SIGNING_IDENTITY := $(shell security find-identity -v -p codesigning | grep '"' | head -n 1 | sed -E 's/.*"(.*)"/\1/')
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
# glibc-static or glibc-devel-static required
|
# glibc-static or glibc-devel-static required
|
||||||
ifeq ($(STATIC),true)
|
ifeq ($(STATIC),true)
|
||||||
LD_FLAGS=-linkmode external -extldflags -static
|
LD_FLAGS=-linkmode external -extldflags -static
|
||||||
@ -411,9 +412,9 @@ backend-assets/grpc/llama: backend-assets/grpc sources/go-llama/libbinding.a
|
|||||||
$(GOCMD) mod edit -replace github.com/go-skynet/go-llama.cpp=$(shell pwd)/sources/go-llama
|
$(GOCMD) mod edit -replace github.com/go-skynet/go-llama.cpp=$(shell pwd)/sources/go-llama
|
||||||
CGO_LDFLAGS="$(CGO_LDFLAGS)" C_INCLUDE_PATH=$(shell pwd)/sources/go-llama LIBRARY_PATH=$(shell pwd)/sources/go-llama \
|
CGO_LDFLAGS="$(CGO_LDFLAGS)" C_INCLUDE_PATH=$(shell pwd)/sources/go-llama LIBRARY_PATH=$(shell pwd)/sources/go-llama \
|
||||||
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/llama ./backend/go/llm/llama/
|
$(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o backend-assets/grpc/llama ./backend/go/llm/llama/
|
||||||
# TODO: every binary should have its own folder instead, so can have different metal implementations
|
# TODO: every binary should have its own folder instead, so can have different implementations
|
||||||
ifeq ($(BUILD_TYPE),metal)
|
ifeq ($(BUILD_TYPE),metal)
|
||||||
cp go-llama/build/bin/ggml-metal.metal backend-assets/grpc/
|
cp backend/cpp/llama/llama.cpp/ggml-metal.metal backend-assets/grpc/
|
||||||
endif
|
endif
|
||||||
|
|
||||||
## BACKEND CPP LLAMA START
|
## BACKEND CPP LLAMA START
|
||||||
|
Loading…
Reference in New Issue
Block a user