[GH-ISSUE #644] error: illegal instruction on CPUs without AVX or AVX2 instruction sets #26045

Closed
opened 2026-04-22 01:55:45 -05:00 by GiteaMirror · 14 comments
Owner

Originally created by @jacoboglez on GitHub (Sep 29, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/644

I was testing the Ollama release for WSL and I could not get any model running.

I installed it as indicated in the website:
curl https://ollama.ai/install.sh | sh

I got the server running correctly, and the model was download properly.
Finally, when trying to run the model (ollama run llama2) I got the following error on the server:

2023/09/29 09:11:12 llama.go:310: starting llama runner
2023/09/29 09:11:12 llama.go:346: waiting for llama runner to start responding
2023/09/29 09:11:12 llama.go:320: llama runner exited with error: signal: illegal instruction

I was trying to run it in Ubuntu-22.04 (WSL version 2). Processor: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz.

Originally created by @jacoboglez on GitHub (Sep 29, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/644 I was testing the Ollama release for WSL and I could not get any model running. I installed it as indicated in the website: `curl https://ollama.ai/install.sh | sh` I got the server running correctly, and the model was download properly. Finally, when trying to run the model (`ollama run llama2`) I got the following error on the server: ``` 2023/09/29 09:11:12 llama.go:310: starting llama runner 2023/09/29 09:11:12 llama.go:346: waiting for llama runner to start responding 2023/09/29 09:11:12 llama.go:320: llama runner exited with error: signal: illegal instruction ``` I was trying to run it in Ubuntu-22.04 (WSL version 2). Processor: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz.
GiteaMirror added the bug label 2026-04-22 01:55:45 -05:00
Author
Owner

@BruceMacD commented on GitHub (Sep 29, 2023):

This looks like it is without a GPU correct? I wasn't able to reproduce this one, but if you're able to drop the full logs in a pastebin I might be able to see a root cause.

<!-- gh-comment-id:1741068431 --> @BruceMacD commented on GitHub (Sep 29, 2023): This looks like it is without a GPU correct? I wasn't able to reproduce this one, but if you're able to drop the full logs in a pastebin I might be able to see a root cause.
Author
Owner

@tomkwok commented on GitHub (Sep 29, 2023):

OP uses i7-3770 which is an Ivy Bridge processor that does not support AVX2 instructions. I am facing the same issue with an old AMD processor.

Refer to https://github.com/ggerganov/llama.cpp/issues/1583

<!-- gh-comment-id:1741248734 --> @tomkwok commented on GitHub (Sep 29, 2023): OP uses i7-3770 which is an Ivy Bridge processor that does not support AVX2 instructions. I am facing the same issue with an old AMD processor. Refer to https://github.com/ggerganov/llama.cpp/issues/1583
Author
Owner

@tomkwok commented on GitHub (Sep 29, 2023):

https://github.com/ggerganov/llama.cpp/pull/809 implements compile-time checks for AVX/AVX2/AVX512. Ideally we would have run-time checks for AVX/AVX2/AVX512 so that we can produce a binary that runs with AVX2/AVX512 only on processors that support them.

<!-- gh-comment-id:1741257226 --> @tomkwok commented on GitHub (Sep 29, 2023): https://github.com/ggerganov/llama.cpp/pull/809 implements compile-time checks for AVX/AVX2/AVX512. Ideally we would have run-time checks for AVX/AVX2/AVX512 so that we can produce a binary that runs with AVX2/AVX512 only on processors that support them.
Author
Owner

@kalinstaykov commented on GitHub (Oct 10, 2023):

Yeah, some checks like those might help:

package main

import (
	"fmt"

	"golang.org/x/sys/cpu"
)

func main() {

	if cpu.X86.HasAVX {
		fmt.Println("AVX: true")
	} else {
		fmt.Println("AVX: false")
	}

	if cpu.X86.HasAVX2 {
		fmt.Println("AVX2: true")
	} else {
		fmt.Println("AVX2: false")
	}

	if cpu.X86.HasAVX512 {
		fmt.Println("AVX512: true")
	} else {
		fmt.Println("AVX512: false")
	}

}

On my i7-4820K CPU this prints:

AVX: true
AVX2: false
AVX512: false

So therefore I also get errors when trying to run llama2 model on this machine:

2023/10/10 12:05:56 llama.go:349: waiting for llama runner to start responding
{"timestamp":1696939556,"level":"WARNING","function":"server_params_parse","line":845,"message":"Not compiled with GPU offload support, --n-gpu-layers option will be ignored. See main README.md for information on enabling GPU BLAS support","n_gpu_layers":0}
2023/10/10 12:05:56 llama.go:323: llama runner exited with error: signal: illegal instruction (core dumped)
2023/10/10 12:07:56 llama.go:330: error starting llama runner: llama runner did not start within alloted time, retrying
2023/10/10 12:07:56 llama.go:313: starting llama runner
2023/10/10 12:07:56 llama.go:349: waiting for llama runner to start responding
{"timestamp":1696939676,"level":"WARNING","function":"server_params_parse","line":845,"message":"Not compiled with GPU offload support, --n-gpu-layers option will be ignored. See main README.md for information on enabling GPU BLAS support","n_gpu_layers":0}
2023/10/10 12:07:56 llama.go:323: llama runner exited with error: signal: illegal instruction (core dumped)
2023/10/10 12:09:56 llama.go:330: error starting llama runner: llama runner did not start within alloted time, retrying
<!-- gh-comment-id:1755777566 --> @kalinstaykov commented on GitHub (Oct 10, 2023): Yeah, some checks like those might help: ``` package main import ( "fmt" "golang.org/x/sys/cpu" ) func main() { if cpu.X86.HasAVX { fmt.Println("AVX: true") } else { fmt.Println("AVX: false") } if cpu.X86.HasAVX2 { fmt.Println("AVX2: true") } else { fmt.Println("AVX2: false") } if cpu.X86.HasAVX512 { fmt.Println("AVX512: true") } else { fmt.Println("AVX512: false") } } ``` On my i7-4820K CPU this prints: ``` AVX: true AVX2: false AVX512: false ``` So therefore I also get errors when trying to run llama2 model on this machine: ``` 2023/10/10 12:05:56 llama.go:349: waiting for llama runner to start responding {"timestamp":1696939556,"level":"WARNING","function":"server_params_parse","line":845,"message":"Not compiled with GPU offload support, --n-gpu-layers option will be ignored. See main README.md for information on enabling GPU BLAS support","n_gpu_layers":0} 2023/10/10 12:05:56 llama.go:323: llama runner exited with error: signal: illegal instruction (core dumped) 2023/10/10 12:07:56 llama.go:330: error starting llama runner: llama runner did not start within alloted time, retrying 2023/10/10 12:07:56 llama.go:313: starting llama runner 2023/10/10 12:07:56 llama.go:349: waiting for llama runner to start responding {"timestamp":1696939676,"level":"WARNING","function":"server_params_parse","line":845,"message":"Not compiled with GPU offload support, --n-gpu-layers option will be ignored. See main README.md for information on enabling GPU BLAS support","n_gpu_layers":0} 2023/10/10 12:07:56 llama.go:323: llama runner exited with error: signal: illegal instruction (core dumped) 2023/10/10 12:09:56 llama.go:330: error starting llama runner: llama runner did not start within alloted time, retrying ```
Author
Owner

@lasseedfast commented on GitHub (Oct 20, 2023):

I have the exact same problem and have tried the whole day to get around it. Is there a solution to this if I have a processor not running AVX2? I have an I7 2700K.
Best,
Lasse

<!-- gh-comment-id:1773190159 --> @lasseedfast commented on GitHub (Oct 20, 2023): I have the exact same problem and have tried the whole day to get around it. Is there a solution to this if I have a processor not running AVX2? I have an I7 2700K. Best, Lasse
Author
Owner

@jmorganca commented on GitHub (Oct 28, 2023):

Hi all, Ollama no longer requires AVX2. AVX is enabled by default, but most CPUs should support this after 2011. Later, we'll be moving to runtime checks (vs compile time checks many of you have pointed out) which should open up support for more CPUs. Since I would imagine most compatibility issues should be fixed in #900 now (and in Ollama 0.1.6+), I'll close this for now!

<!-- gh-comment-id:1783903043 --> @jmorganca commented on GitHub (Oct 28, 2023): Hi all, Ollama no longer requires `AVX2`. `AVX` is enabled by default, but most CPUs should support this after 2011. Later, we'll be moving to runtime checks (vs compile time checks many of you have pointed out) which should open up support for more CPUs. Since I would imagine most compatibility issues should be fixed in #900 now (and in Ollama 0.1.6+), I'll close this for now!
Author
Owner

@myaiatemygithubaccount commented on GitHub (Nov 13, 2023):

I have ollama version 0.1.8. My CPU does not support AVX.
I still get this error when I try to run any model:

⠙ Error: llama runner process has terminated

<!-- gh-comment-id:1807616779 --> @myaiatemygithubaccount commented on GitHub (Nov 13, 2023): I have ollama version 0.1.8. My CPU does not support AVX. I still get this error when I try to run any model: ⠙ Error: llama runner process has terminated
Author
Owner

@myaiatemygithubaccount commented on GitHub (Nov 13, 2023):

I have ollama version 0.1.8. My CPU does not support AVX. I still get this error when I try to run any model:

⠙ Error: llama runner process has terminated

I just installed ollama version 0.1.9 and have the same error

I see discussion about flags to enable during the build process if you don't have AVX, but can't find a build guide to follow?

<!-- gh-comment-id:1807695582 --> @myaiatemygithubaccount commented on GitHub (Nov 13, 2023): > I have ollama version 0.1.8. My CPU does not support AVX. I still get this error when I try to run any model: > > ⠙ Error: llama runner process has terminated I just installed ollama version 0.1.9 and have the same error I see discussion about flags to enable during the build process if you don't have AVX, but can't find a build guide to follow?
Author
Owner

@lasseedfast commented on GitHub (Nov 13, 2023):

Some version of AVX is needed as I understand it, but not AVX2 as was required before.

<!-- gh-comment-id:1807703000 --> @lasseedfast commented on GitHub (Nov 13, 2023): Some version of AVX is needed as I understand it, but not AVX2 as was required before.
Author
Owner

@myaiatemygithubaccount commented on GitHub (Nov 13, 2023):

Some version of AVX is needed as I understand it, but not AVX2 as was required before.

/Is it possible to build my own ollama from source and change the build flags so that it works?

<!-- gh-comment-id:1807705528 --> @myaiatemygithubaccount commented on GitHub (Nov 13, 2023): > Some version of AVX is needed as I understand it, but not AVX2 as was required before. /Is it possible to build my own ollama from source and change the build flags so that it works?
Author
Owner

@lasseedfast commented on GitHub (Nov 13, 2023):

I don't know. This issue seems to be closed, search to see if there is one that adress your question or open a new one where you describe your issue with errors etc.

<!-- gh-comment-id:1807709988 --> @lasseedfast commented on GitHub (Nov 13, 2023): I don't know. This issue seems to be closed, search to see if there is one that adress your question or open a new one where you describe your issue with errors etc.
Author
Owner

@ewintr commented on GitHub (Dec 14, 2023):

For @myaiatemygithubaccount and others who find this issue:

I also ran into this error when trying to run it on a Intel Celeron 3955U cpu. It is from December 2015, so much later than 2011. But still old. The script in the comment of zinderic confirmed that it has no AVX.

I got it working anyway by changing the build flags referenced in #900.

Steps:

  1. Clone the repository
  2. In llm/llama.cpp/generate_linux.go, on both line 17 and 24, change -DLLAMA_AVX=on to -DLLAMA_AVX=off (I did this on Linux. Presumably a similar change works for other platforms)
  3. Follow the steps in the documentation for a development build.
  4. Copy the resulting binary ollama to /usr/bin/ollama

Note: running on such an old cpu and disabling those flags does not make it very fast. On the contrary, it is quite slow. But it does work.

<!-- gh-comment-id:1855730187 --> @ewintr commented on GitHub (Dec 14, 2023): For @myaiatemygithubaccount and others who find this issue: I also ran into this error when trying to run it on a Intel Celeron 3955U cpu. It is from [December 2015](https://en.wikipedia.org/wiki/List_of_Intel_Celeron_processors#Skylake_based_Celerons_2), so much later than 2011. But still old. The script in the comment of zinderic confirmed that it has no AVX. I got it working anyway by changing the build flags referenced in #900. Steps: 1. Clone the repository 2. In `llm/llama.cpp/generate_linux.go`, on both line `17` and `24`, change `-DLLAMA_AVX=on` to `-DLLAMA_AVX=off` (I did this on Linux. Presumably a similar change works for other platforms) 3. Follow the steps in the documentation for a [development build](https://github.com/jmorganca/ollama/blob/main/docs/development.md). 4. Copy the resulting binary `ollama` to `/usr/bin/ollama` Note: running on such an old cpu and disabling those flags does not make it very fast. On the contrary, it is quite slow. But it does work.
Author
Owner

@melroy89 commented on GitHub (Dec 19, 2023):

I also get signal: illegal instruction (core dumped), would be nice to just give a better error IMO instead of dump core crash.

<!-- gh-comment-id:1862050837 --> @melroy89 commented on GitHub (Dec 19, 2023): I also get `signal: illegal instruction (core dumped)`, would be nice to just give a better error IMO instead of dump core crash.
Author
Owner

@toleabivol commented on GitHub (Oct 7, 2024):

I have a 2009 i7 CPU without AVX and somehow doing this works :

curl -fsSL https://ollama.com/install.sh | sh
ollama run llama3.2

image
it is really slow ~1 token/s

With ollama run llama3.2:1b it was ~3 tokens/s

<!-- gh-comment-id:2397471075 --> @toleabivol commented on GitHub (Oct 7, 2024): I have a 2009 i7 CPU without AVX and somehow doing this works : ``` curl -fsSL https://ollama.com/install.sh | sh ollama run llama3.2 ``` ![image](https://github.com/user-attachments/assets/4c48a51d-4c70-42b0-a366-bc158de8786e) it is really slow ~1 token/s With `ollama run llama3.2:1b` it was ~3 tokens/s
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#26045