fixed linux openblas build errors
This commit is contained in:
parent
977a9a246f
commit
354d4f232f
2 changed files with 17 additions and 6 deletions
17
Makefile
17
Makefile
|
@ -182,8 +182,8 @@ ifndef LLAMA_NO_ACCELERATE
|
|||
endif
|
||||
endif
|
||||
ifdef LLAMA_OPENBLAS
|
||||
CFLAGS += -DGGML_USE_OPENBLAS -I/usr/local/include/openblas
|
||||
LDFLAGS += -l:libopenblas.lib -L.
|
||||
CFLAGS += -DGGML_USE_OPENBLAS -I/usr/local/include/openblas
|
||||
LDFLAGS += -lopenblas
|
||||
endif
|
||||
ifdef LLAMA_GPROF
|
||||
CFLAGS += -pg
|
||||
|
@ -206,6 +206,13 @@ ifneq ($(filter armv8%,$(UNAME_M)),)
|
|||
CFLAGS += -mfp16-format=ieee -mno-unaligned-access
|
||||
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
|
||||
#
|
||||
|
@ -243,7 +250,7 @@ extra.o: extra.cpp extra.h
|
|||
$(CXX) $(CXXFLAGS) -c extra.cpp -o extra.o
|
||||
|
||||
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
|
||||
$(CXX) $(CXXFLAGS) examples/main/main.cpp ggml.o llama.o common.o -o main $(LDFLAGS)
|
||||
|
@ -255,8 +262,8 @@ llamalib: expose.cpp ggml.o common.o extra.o
|
|||
$(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
|
||||
$(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
|
||||
$(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):
|
||||
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")):
|
||||
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
|
||||
elif not args.noblas:
|
||||
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:
|
||||
print("Could not load model: " + modelname)
|
||||
time.sleep(1)
|
||||
sys.exit(3)
|
||||
try:
|
||||
basepath = os.path.abspath(os.path.dirname(__file__))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue