LostRuins / koboldcpp

Run GGUF models easily with a KoboldAI UI. One File. Zero Install.
https://github.com/lostruins/koboldcpp
GNU Affero General Public License v3.0
4.66k stars 334 forks source link

Illegal instruction (core dumped) #46

Closed Stairdeck closed 1 year ago

Stairdeck commented 1 year ago

Hello. I trying to launch on Ubuntu-22.04

gpt@gpt:~/koboldcpp$ make LLAMA_OPENBLAS=1
I llama.cpp build info:
I UNAME_S:  Linux
I UNAME_P:  x86_64
I UNAME_M:  x86_64
I CFLAGS:   -I.              -Ofast -DNDEBUG -std=c11   -fPIC -pthread -s  -pthread -mf16c -mavx -msse3  -DGGML_USE_OPENBLAS -I/usr/local/include/openblas
I CXXFLAGS: -I. -I./examples -Ofast -DNDEBUG -std=c++11 -fPIC -pthread -s -Wno-multichar -pthread
I LDFLAGS:  -lopenblas
I CC:       cc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
I CXX:      g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0

g++ -I. -I./examples -Ofast -DNDEBUG -std=c++11 -fPIC -pthread -s -Wno-multichar -pthread  ggml.o ggml_v1.o expose.o common.o llama_adapter.o gpttype_adapter.o -shared -o koboldcpp.dll -lopenblas
cc  -I.              -Ofast -DNDEBUG -std=c11   -fPIC -pthread -s  -pthread -mf16c -mavx -msse3  -DGGML_USE_OPENBLAS -I/usr/local/include/openblas -c otherarch/ggml_v1.c -o ggml_v1.o
gpt@gpt:~/koboldcpp$ python3 koboldcpp.py ggml-model.bin 1080
Welcome to KoboldCpp - Version 1.5
Warning: libopenblas.dll or koboldcpp_openblas.dll not found. Non-BLAS library will be used. Ignore this if you have manually linked with OpenBLAS.
Initializing dynamic library: koboldcpp.dll
Loading model: /home/gpt/koboldcpp/ggml-model.bin
[Parts: 1, Threads: 3]

---
Identified as LLAMA model: (ver 3)
Attempting to Load...
---
System Info: AVX = 1 | AVX2 = 1 | AVX512 = 0 | FMA = 1 | NEON = 0 | ARM_FMA = 0 | F16C = 1 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 0 | SSE3 = 1 | VSX = 0 |
llama.cpp: loading model from /home/gpt/koboldcpp/ggml-model.bin
llama_model_load_internal: format     = ggjt v1 (latest)
llama_model_load_internal: n_vocab    = 32000
llama_model_load_internal: n_ctx      = 2048
llama_model_load_internal: n_embd     = 6656
llama_model_load_internal: n_mult     = 256
llama_model_load_internal: n_head     = 52
llama_model_load_internal: n_layer    = 60
llama_model_load_internal: n_rot      = 128
llama_model_load_internal: ftype      = 2 (mostly Q4_0)
llama_model_load_internal: n_ff       = 17920
llama_model_load_internal: n_parts    = 1
llama_model_load_internal: model size = 30B
llama_model_load_internal: ggml ctx size = 110.30 KB
llama_model_load_internal: mem required  = 21695.46 MB (+ 3124.00 MB per state)
Illegal instruction (core dumped)
rabidcopy commented 1 year ago

Replace

    CFLAGS += -mf16c -mavx -msse3 
    BONUSCFLAGS += -mfma -mavx2 

with

    CFLAGS += -march=native -mtune=native
    CXXFLAGS += -march=native -mtune=native

at line 75-76 of Makefile, run make clean and make again. I had this issue on my older laptop that doesn't support AVX2.

LostRuins commented 1 year ago

If you're on windows, it should now build both AVX2 and non avx2 binaries with the makefile, and allow dynamic selection at runtime.