Skip to content

Commit b186eb7

Browse files
hack3ricfelixonmars
authored andcommitted
updpatch: ollama 0.5.2-1
Enable ROCm support by removing some unsupported flags.
1 parent d71336a commit b186eb7

File tree

3 files changed

+58
-42
lines changed

3 files changed

+58
-42
lines changed

ollama/ollama-riscv-support.patch

Lines changed: 0 additions & 28 deletions
This file was deleted.

ollama/remove-unsupported-flags.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/make/Makefile.rocm b/make/Makefile.rocm
2+
index cf45dc6d..be555b55 100644
3+
--- a/make/Makefile.rocm
4+
+++ b/make/Makefile.rocm
5+
@@ -63,8 +63,6 @@ GPU_VECTOR_FLAGS=$(if $(filter avx512,$(GPU_RUNNER_CPU_FLAGS)),avx512f avx512dq
6+
GPU_COMPILER_CUFLAGS = \
7+
$(GPU_COMPILER_FPIC) \
8+
$(addprefix -m,$(GPU_VECTOR_FLAGS)) \
9+
- -mf16c \
10+
- -mfma \
11+
-c \
12+
-O3 \
13+
-DGGML_USE_CUDA \

ollama/riscv64.patch

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,52 @@
11
--- PKGBUILD
22
+++ PKGBUILD
3-
@@ -21,6 +21,11 @@ b2sums=('02154afa3129c64d2dc3365a49860748271003c25441fd663a1abfc6e7ef3b324a00576
4-
'3aabf135c4f18e1ad745ae8800db782b25b15305dfeaaa031b4501408ab7e7d01f66e8ebb5be59fc813cfbff6788d08d2e48dcf24ecc480a40ec9db8dbce9fec'
5-
'e8f2b19e2474f30a4f984b45787950012668bf0acb5ad1ebb25cd9776925ab4a6aa927f8131ed53e35b1c71b32c504c700fe5b5145ecd25c7a8284373bb951ed')
3+
@@ -37,7 +37,7 @@ build() {
64

7-
+prepare() {
8-
+ cd $pkgbase
9-
+ patch -Np1 -i ../$pkgname-riscv-support.patch
10-
+}
11-
+
12-
build() {
13-
export CFLAGS+=' -w' CXXFLAGS+=' -w'
14-
export LDFLAGS+=' -L/opt/cuda/targets/x86_64-linux/lib/stubs/'
15-
@@ -62,3 +67,6 @@ package_ollama-docs() {
5+
# Unset these otherwise somehow nvcc will try to use them.
6+
unset CFLAGS CXXFLAGS
7+
- make dist CUDA_12_PATH=/opt/cuda
8+
+ make dist
9+
go build .
10+
}
11+
12+
@@ -50,7 +50,7 @@ check() {
13+
package_ollama() {
14+
install -Dm755 ollama/ollama "$pkgdir/usr/bin/ollama"
15+
mkdir -p "$pkgdir"/usr/lib/ollama/runners
16+
- cp -r ollama/dist/linux-amd64/lib/ollama/runners/cpu* "$pkgdir"/usr/lib/ollama/runners/
17+
+ cp -r ollama/dist/linux-riscv64/lib/ollama/runners/cpu* "$pkgdir"/usr/lib/ollama/runners/
18+
19+
install -Dm755 $pkgname/$pkgbase "$pkgdir/usr/bin/$pkgbase"
20+
install -dm755 "$pkgdir/var/lib/ollama"
21+
@@ -67,7 +67,7 @@ package_ollama-rocm() {
22+
depends+=(ollama hipblas)
23+
24+
mkdir -p "$pkgdir"/usr/lib/ollama/runners
25+
- cp -r ollama/dist/linux-amd64/lib/ollama/runners/rocm* "$pkgdir"/usr/lib/ollama/runners
26+
+ cp -r ollama/dist/linux-riscv64/lib/ollama/runners/rocm* "$pkgdir"/usr/lib/ollama/runners
27+
}
28+
29+
package_ollama-cuda() {
30+
@@ -75,7 +75,7 @@ package_ollama-cuda() {
31+
depends+=(ollama cuda)
32+
33+
mkdir -p "$pkgdir"/usr/lib/ollama/runners
34+
- cp -r ollama/dist/linux-amd64/lib/ollama/runners/cuda* "$pkgdir"/usr/lib/ollama/runners
35+
+ cp -r ollama/dist/linux-riscv64/lib/ollama/runners/cuda* "$pkgdir"/usr/lib/ollama/runners
36+
}
37+
38+
package_ollama-docs() {
39+
@@ -85,3 +85,13 @@ package_ollama-docs() {
1640
cp -r $pkgbase/docs "$pkgdir/usr/share/doc/$pkgbase"
1741
install -Dm644 $pkgbase/LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
1842
}
1943
+
20-
+source+=($pkgname-riscv-support.patch) # https://github.com/ollama/ollama/pull/6627
21-
+b2sums+=('336d0ea08b05a3f4da075c80d79becadf72b5573cb7f74361d1a1513970e0907cc7d3d586c4b65f7b7086346bf77da3ff1234fcf9e3c1ff258fca069c33d0e1e')
44+
+pkgname=(${pkgname[@]/ollama-cuda})
45+
+makedepends=(${makedepends[@]/cuda})
46+
+source+=(remove-unsupported-flags.patch)
47+
+b2sums+=('19f2aefbc5f4c4ba3102275f6e6e5376500cadc8df609873c290b29210ddd60926fadef315b2878ba3f97591469b862b9c7dd6e797017f3bc8cbd8bccc577086')
48+
+
49+
+prepare() {
50+
+ cd ollama
51+
+ patch -Np1 -i "$srcdir"/remove-unsupported-flags.patch
52+
+}

0 commit comments

Comments
 (0)