fixed linux openblas build errors
This commit is contained in:
parent
977a9a246f
commit
354d4f232f
2 changed files with 17 additions and 6 deletions
13
Makefile
13
Makefile
|
@ -183,7 +183,7 @@ ifndef LLAMA_NO_ACCELERATE
|
||||||
endif
|
endif
|
||||||
ifdef LLAMA_OPENBLAS
|
ifdef LLAMA_OPENBLAS
|
||||||
CFLAGS += -DGGML_USE_OPENBLAS -I/usr/local/include/openblas
|
CFLAGS += -DGGML_USE_OPENBLAS -I/usr/local/include/openblas
|
||||||
LDFLAGS += -l:libopenblas.lib -L.
|
LDFLAGS += -lopenblas
|
||||||
endif
|
endif
|
||||||
ifdef LLAMA_GPROF
|
ifdef LLAMA_GPROF
|
||||||
CFLAGS += -pg
|
CFLAGS += -pg
|
||||||
|
@ -206,6 +206,13 @@ ifneq ($(filter armv8%,$(UNAME_M)),)
|
||||||
CFLAGS += -mfp16-format=ieee -mno-unaligned-access
|
CFLAGS += -mfp16-format=ieee -mno-unaligned-access
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
BLAS_BUILD =
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
BLAS_BUILD = $(CXX) $(CXXFLAGS) expose.cpp ggml_blas.o common.o extra.o libopenblas.lib -shared -o llamacpp_blas.dll $(LDFLAGS)
|
||||||
|
else
|
||||||
|
BLAS_BUILD = @echo 'Your OS is $(OS) and does not appear to be Windows. If you want to use openblas, please link it manually with LLAMA_OPENBLAS=1'
|
||||||
|
endif
|
||||||
|
|
||||||
#
|
#
|
||||||
# Print build information
|
# Print build information
|
||||||
#
|
#
|
||||||
|
@ -243,7 +250,7 @@ extra.o: extra.cpp extra.h
|
||||||
$(CXX) $(CXXFLAGS) -c extra.cpp -o extra.o
|
$(CXX) $(CXXFLAGS) -c extra.cpp -o extra.o
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -vf *.o main quantize perplexity embedding
|
rm -vf *.o main quantize perplexity embedding main.exe quantize.exe llamacpp.dll llamacpp_blas.dll
|
||||||
|
|
||||||
main: examples/main/main.cpp ggml.o llama.o common.o
|
main: examples/main/main.cpp ggml.o llama.o common.o
|
||||||
$(CXX) $(CXXFLAGS) examples/main/main.cpp ggml.o llama.o common.o -o main $(LDFLAGS)
|
$(CXX) $(CXXFLAGS) examples/main/main.cpp ggml.o llama.o common.o -o main $(LDFLAGS)
|
||||||
|
@ -255,7 +262,7 @@ llamalib: expose.cpp ggml.o common.o extra.o
|
||||||
$(CXX) $(CXXFLAGS) expose.cpp ggml.o common.o extra.o -shared -o llamacpp.dll $(LDFLAGS)
|
$(CXX) $(CXXFLAGS) expose.cpp ggml.o common.o extra.o -shared -o llamacpp.dll $(LDFLAGS)
|
||||||
|
|
||||||
llamalib_blas: expose.cpp ggml_blas.o common.o extra.o
|
llamalib_blas: expose.cpp ggml_blas.o common.o extra.o
|
||||||
$(CXX) $(CXXFLAGS) expose.cpp ggml_blas.o common.o extra.o libopenblas.lib -shared -o llamacpp_blas.dll $(LDFLAGS)
|
$(BLAS_BUILD)
|
||||||
|
|
||||||
quantize: examples/quantize/quantize.cpp ggml.o llama.o
|
quantize: examples/quantize/quantize.cpp ggml.o llama.o
|
||||||
$(CXX) $(CXXFLAGS) examples/quantize/quantize.cpp ggml.o llama.o -o quantize $(LDFLAGS)
|
$(CXX) $(CXXFLAGS) examples/quantize/quantize.cpp ggml.o llama.o -o quantize $(LDFLAGS)
|
||||||
|
|
|
@ -287,7 +287,10 @@ def RunServerMultiThreaded(addr, port, embedded_kailite = None):
|
||||||
def main(args):
|
def main(args):
|
||||||
global use_blas
|
global use_blas
|
||||||
if not os.path.exists(os.path.join(os.path.dirname(os.path.realpath(__file__)), "libopenblas.dll")) or not os.path.exists(os.path.join(os.path.dirname(os.path.realpath(__file__)), "llamacpp_blas.dll")):
|
if not os.path.exists(os.path.join(os.path.dirname(os.path.realpath(__file__)), "libopenblas.dll")) or not os.path.exists(os.path.join(os.path.dirname(os.path.realpath(__file__)), "llamacpp_blas.dll")):
|
||||||
print("Warning: libopenblas.dll or llamacpp_blas.dll not found. OpenBLAS will be disabled.")
|
print("Warning: libopenblas.dll or llamacpp_blas.dll not found. Non-BLAS library will be used. Ignore this if you have manually linked with OpenBLAS.")
|
||||||
|
use_blas = False
|
||||||
|
elif os.name != 'nt':
|
||||||
|
print("Prebuilt OpenBLAS binaries only available for windows. Please manually build/link libopenblas from makefile with LLAMA_OPENBLAS=1")
|
||||||
use_blas = False
|
use_blas = False
|
||||||
elif not args.noblas:
|
elif not args.noblas:
|
||||||
print("Attempting to use OpenBLAS library for faster prompt ingestion. A compatible libopenblas.dll will be required.")
|
print("Attempting to use OpenBLAS library for faster prompt ingestion. A compatible libopenblas.dll will be required.")
|
||||||
|
@ -318,6 +321,7 @@ def main(args):
|
||||||
|
|
||||||
if not loadok:
|
if not loadok:
|
||||||
print("Could not load model: " + modelname)
|
print("Could not load model: " + modelname)
|
||||||
|
time.sleep(1)
|
||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
try:
|
try:
|
||||||
basepath = os.path.abspath(os.path.dirname(__file__))
|
basepath = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue