From 13d8dc2da75276f172ae819dabf82b964f7e66fc5fc57626becf374877de2057 Mon Sep 17 00:00:00 2001 From: Eyad Issa Date: Tue, 21 May 2024 11:57:06 +0000 Subject: [PATCH 1/5] Accepting request 1175546 from openSUSE:Factory:RISCV RISCV patch OBS-URL: https://build.opensuse.org/request/show/1175546 OBS-URL: https://build.opensuse.org/package/show/science:machinelearning/ollama?expand=0&rev=17 --- ollama.spec | 2 ++ riscv.patch | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 riscv.patch diff --git a/ollama.spec b/ollama.spec index 8b6e211..e8f2047 100644 --- a/ollama.spec +++ b/ollama.spec @@ -36,6 +36,8 @@ BuildRequires: golang(API) >= 1.22 %{sysusers_requires} +Patch24300: riscv.patch + %description Ollama is a tool for running AI models on one's own hardware. It offers a command-line interface and a RESTful API. diff --git a/riscv.patch b/riscv.patch new file mode 100644 index 0000000..8f50500 --- /dev/null +++ b/riscv.patch @@ -0,0 +1,38 @@ +Index: ollama-0.1.37/llm/llm.go +=================================================================== +--- ollama-0.1.37.orig/llm/llm.go ++++ ollama-0.1.37/llm/llm.go +@@ -7,6 +7,7 @@ package llm + // #cgo windows,arm64 LDFLAGS: ${SRCDIR}/build/windows/arm64_static/libllama.a -static -lstdc++ + // #cgo linux,amd64 LDFLAGS: ${SRCDIR}/build/linux/x86_64_static/libllama.a -lstdc++ + // #cgo linux,arm64 LDFLAGS: ${SRCDIR}/build/linux/arm64_static/libllama.a -lstdc++ ++// #cgo linux,riscv64 LDFLAGS: ${SRCDIR}/build/linux/riscv64_static/libllama.a -lstdc++ + // #include + // #include "llama.h" + import "C" +Index: ollama-0.1.37/vendor/github.com/chewxy/math32/stubs_riscv64.s +=================================================================== +--- /dev/null ++++ ollama-0.1.37/vendor/github.com/chewxy/math32/stubs_riscv64.s +@@ -0,0 +1,21 @@ ++#include "textflag.h" ++ ++// func Exp(x float32) float32 ++TEXT ·Exp(SB),NOSPLIT,$0 ++ JMP ·exp(SB) ++ ++// func Exp2(x float32) float32 ++TEXT ·Exp2(SB),NOSPLIT,$0 ++ JMP ·exp2(SB) ++ ++// func Log(x float32) float32 ++TEXT ·Log(SB),NOSPLIT,$0 ++ JMP ·log(SB) ++ ++// func Remainder(x, y float32) float32 ++TEXT ·Remainder(SB),NOSPLIT,$0 ++ JMP ·remainder(SB) ++ ++// func Sqrt(x float32) float32 ++TEXT ·Sqrt(SB),NOSPLIT,$0 ++ JMP ·sqrt(SB) From 71c9d435095bbce4d92ac001a8095190d16d9227ff11594dcc381d5ea9707c15 Mon Sep 17 00:00:00 2001 From: Eyad Issa Date: Wed, 22 May 2024 17:56:10 +0000 Subject: [PATCH 2/5] Accepting request 1175901 from home:mslacken:ml added 15.6 build OBS-URL: https://build.opensuse.org/request/show/1175901 OBS-URL: https://build.opensuse.org/package/show/science:machinelearning/ollama?expand=0&rev=18 --- ollama.spec | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ollama.spec b/ollama.spec index e8f2047..7be2577 100644 --- a/ollama.spec +++ b/ollama.spec @@ -28,7 +28,11 @@ Source2: ollama.service Source3: %{name}-user.conf Patch0: enable-lto.patch BuildRequires: cmake >= 3.24 +%if 0%{?sle_version} == 150600 +BuildRequires: gcc12-c++ +%else BuildRequires: gcc-c++ >= 11.4.0 +%endif BuildRequires: git BuildRequires: sysuser-tools BuildRequires: zstd @@ -55,6 +59,12 @@ can be imported. %ifnarch ppc64 export GOFLAGS="-buildmode=pie -mod=vendor" %endif +%if 0%{?sle_version} == 150600 +export CXX=g++-12 +export CC=gcc-12 +# pie doesn't work with gcc12 on leap +export GOFLAGS="-mod=vendor" +%endif export OLLAMA_SKIP_PATCHING=1 From bc9c8a70920b7b812f32aa4585dec915cf76bbfad31f58cabc6ff0d040065365 Mon Sep 17 00:00:00 2001 From: Eyad Issa Date: Wed, 22 May 2024 18:06:13 +0000 Subject: [PATCH 3/5] - Added 15.6 build OBS-URL: https://build.opensuse.org/package/show/science:machinelearning/ollama?expand=0&rev=19 --- ollama.changes | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ollama.changes b/ollama.changes index 89a644d..f3b7661 100644 --- a/ollama.changes +++ b/ollama.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed May 22 18:05:30 UTC 2024 - Eyad Issa + +- Added 15.6 build + ------------------------------------------------------------------- Thu May 16 19:55:51 UTC 2024 - Eyad Issa From 87f951cc3a73c10292a6d8e1cfe2a793f872484f51eeb1e3af22d5db525ed16b Mon Sep 17 00:00:00 2001 From: Eyad Issa Date: Wed, 22 May 2024 18:08:19 +0000 Subject: [PATCH 4/5] - Added 15.6 build - Added patch to build on RISC-V arch OBS-URL: https://build.opensuse.org/package/show/science:machinelearning/ollama?expand=0&rev=20 --- ollama.changes | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ollama.changes b/ollama.changes index f3b7661..d070d48 100644 --- a/ollama.changes +++ b/ollama.changes @@ -1,7 +1,8 @@ ------------------------------------------------------------------- Wed May 22 18:05:30 UTC 2024 - Eyad Issa -- Added 15.6 build +- Added 15.6 build +- Added patch to build on RISC-V arch ------------------------------------------------------------------- Thu May 16 19:55:51 UTC 2024 - Eyad Issa From 45b2d8c6ae4242359d4f05efce3111adefb8af16d8f33e46e605082042d33892 Mon Sep 17 00:00:00 2001 From: Eyad Issa Date: Wed, 22 May 2024 20:22:14 +0000 Subject: [PATCH 5/5] OBS-URL: https://build.opensuse.org/package/show/science:machinelearning/ollama?expand=0&rev=21 --- ollama.changes | 1 - ollama.spec | 2 -- riscv.patch | 38 -------------------------------------- 3 files changed, 41 deletions(-) delete mode 100644 riscv.patch diff --git a/ollama.changes b/ollama.changes index d070d48..1733569 100644 --- a/ollama.changes +++ b/ollama.changes @@ -2,7 +2,6 @@ Wed May 22 18:05:30 UTC 2024 - Eyad Issa - Added 15.6 build -- Added patch to build on RISC-V arch ------------------------------------------------------------------- Thu May 16 19:55:51 UTC 2024 - Eyad Issa diff --git a/ollama.spec b/ollama.spec index 7be2577..e6624df 100644 --- a/ollama.spec +++ b/ollama.spec @@ -40,8 +40,6 @@ BuildRequires: golang(API) >= 1.22 %{sysusers_requires} -Patch24300: riscv.patch - %description Ollama is a tool for running AI models on one's own hardware. It offers a command-line interface and a RESTful API. diff --git a/riscv.patch b/riscv.patch deleted file mode 100644 index 8f50500..0000000 --- a/riscv.patch +++ /dev/null @@ -1,38 +0,0 @@ -Index: ollama-0.1.37/llm/llm.go -=================================================================== ---- ollama-0.1.37.orig/llm/llm.go -+++ ollama-0.1.37/llm/llm.go -@@ -7,6 +7,7 @@ package llm - // #cgo windows,arm64 LDFLAGS: ${SRCDIR}/build/windows/arm64_static/libllama.a -static -lstdc++ - // #cgo linux,amd64 LDFLAGS: ${SRCDIR}/build/linux/x86_64_static/libllama.a -lstdc++ - // #cgo linux,arm64 LDFLAGS: ${SRCDIR}/build/linux/arm64_static/libllama.a -lstdc++ -+// #cgo linux,riscv64 LDFLAGS: ${SRCDIR}/build/linux/riscv64_static/libllama.a -lstdc++ - // #include - // #include "llama.h" - import "C" -Index: ollama-0.1.37/vendor/github.com/chewxy/math32/stubs_riscv64.s -=================================================================== ---- /dev/null -+++ ollama-0.1.37/vendor/github.com/chewxy/math32/stubs_riscv64.s -@@ -0,0 +1,21 @@ -+#include "textflag.h" -+ -+// func Exp(x float32) float32 -+TEXT ·Exp(SB),NOSPLIT,$0 -+ JMP ·exp(SB) -+ -+// func Exp2(x float32) float32 -+TEXT ·Exp2(SB),NOSPLIT,$0 -+ JMP ·exp2(SB) -+ -+// func Log(x float32) float32 -+TEXT ·Log(SB),NOSPLIT,$0 -+ JMP ·log(SB) -+ -+// func Remainder(x, y float32) float32 -+TEXT ·Remainder(SB),NOSPLIT,$0 -+ JMP ·remainder(SB) -+ -+// func Sqrt(x float32) float32 -+TEXT ·Sqrt(SB),NOSPLIT,$0 -+ JMP ·sqrt(SB)