summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorSR_team2024-02-28 02:38:34 +0200
committerSR_team2024-02-28 02:40:15 +0200
commit826d25deb8f410f0990d5f630ac401b33e956fdf (patch)
treeb5eda58eaffa27112c7112d9aa9ed60f7c2af6c0
parentf53a39c4d115066ee7f65327a397004a0b1a2a6f (diff)
downloadaur-826d25deb8f410f0990d5f630ac401b33e956fdf.tar.gz
Add compilation with ROCm
-rw-r--r--.SRCINFO11
-rw-r--r--PKGBUILD23
2 files changed, 19 insertions, 15 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 803df352cb93..c3cfc1679019 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,12 +1,13 @@
-pkgbase = ollama-cuda-git
- pkgdesc = Create, run and share large language models (LLMs) with CUDA
- pkgver = 0.1.27.g275ea015
+pkgbase = ollama-rocm-git
+ pkgdesc = Create, run and share large language models (LLMs) with ROCm
+ pkgver = 0.1.27.g076237b8
pkgrel = 1
url = https://github.com/jmorganca/ollama
arch = x86_64
license = MIT
makedepends = cmake
- makedepends = cuda
+ makedepends = clblast
+ makedepends = rocblas
makedepends = git
makedepends = go
provides = ollama
@@ -21,4 +22,4 @@ pkgbase = ollama-cuda-git
b2sums = 3aabf135c4f18e1ad745ae8800db782b25b15305dfeaaa031b4501408ab7e7d01f66e8ebb5be59fc813cfbff6788d08d2e48dcf24ecc480a40ec9db8dbce9fec
b2sums = e8f2b19e2474f30a4f984b45787950012668bf0acb5ad1ebb25cd9776925ab4a6aa927f8131ed53e35b1c71b32c504c700fe5b5145ecd25c7a8284373bb951ed
-pkgname = ollama-cuda-git
+pkgname = ollama-rocm-git
diff --git a/PKGBUILD b/PKGBUILD
index bccf3d688019..1ce4327ca1c5 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,14 +1,14 @@
# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: Matt Harrison <matt@harrison.us.com>
-pkgname=ollama-cuda-git
-pkgdesc='Create, run and share large language models (LLMs) with CUDA'
-pkgver=0.1.27.g275ea015
+pkgname=ollama-rocm-git
+pkgdesc='Create, run and share large language models (LLMs) with ROCm'
+pkgver=0.1.27.g076237b8
pkgrel=1
arch=(x86_64)
url='https://github.com/jmorganca/ollama'
license=(MIT)
-makedepends=(cmake cuda git go)
+makedepends=(cmake clblast rocblas git go)
provides=(ollama)
conflicts=(ollama ollama-cuda)
source=(git+$url
@@ -21,7 +21,7 @@ b2sums=('SKIP'
'e8f2b19e2474f30a4f984b45787950012668bf0acb5ad1ebb25cd9776925ab4a6aa927f8131ed53e35b1c71b32c504c700fe5b5145ecd25c7a8284373bb951ed')
pkgver() {
- cd ${pkgname/-cuda-git}
+ cd ${pkgname/-rocm-git}
local _tag=$(git describe --tags --abbrev=0 | sed "s/^v//")
local _commit=$(git describe --abbrev=8 --always)
@@ -29,7 +29,7 @@ pkgver() {
}
prepare() {
- cd ${pkgname/-cuda-git}
+ cd ${pkgname/-rocm-git}
# Clone submodules (llama.cpp)
git submodule update --init --recursive
@@ -37,12 +37,15 @@ prepare() {
# Turn LTO on and set the build type to Release
sed -i 's,T_CODE=on,T_CODE=on -D LLAMA_LTO=on -D CMAKE_BUILD_TYPE=Release,g' llm/generate/gen_linux.sh
+ # Fix linking (https://github.com/ollama/ollama/issues/2473#issuecomment-1942090475)
+ sed -i 's,g++,/opt/rocm/llvm/bin/clang++ -fcf-protection=none,g' llm/generate/gen_common.sh
+
# Display a more helpful error message
sed -i "s|could not connect to ollama server, run 'ollama serve' to start it|ollama is not running, try 'systemctl start ollama'|g" cmd/cmd.go
}
build() {
- cd ${pkgname/-cuda-git}
+ cd ${pkgname/-rocm-git}
export CGO_CFLAGS="$CFLAGS" CGO_CPPFLAGS="$CPPFLAGS" CGO_CXXFLAGS="$CXXFLAGS" CGO_LDFLAGS="$LDFLAGS"
go generate ./...
go build -buildmode=pie -trimpath -mod=readonly -modcacherw -ldflags=-linkmode=external \
@@ -50,16 +53,16 @@ build() {
}
check() {
- cd ${pkgname/-cuda-git}
+ cd ${pkgname/-rocm-git}
go test ./api ./format
./ollama --version > /dev/null
}
package() {
- install -Dm755 ${pkgname/-cuda-git}/${pkgname/-cuda-git} "$pkgdir/usr/bin/${pkgname/-cuda-git}"
+ install -Dm755 ${pkgname/-rocm-git}/${pkgname/-rocm-git} "$pkgdir/usr/bin/${pkgname/-rocm-git}"
install -dm755 "$pkgdir/var/lib/ollama"
install -Dm644 ollama.service "$pkgdir/usr/lib/systemd/system/ollama.service"
install -Dm644 sysusers.conf "$pkgdir/usr/lib/sysusers.d/ollama.conf"
install -Dm644 tmpfiles.d "$pkgdir/usr/lib/tmpfiles.d/ollama.conf"
- install -Dm644 ${pkgname/-cuda-git}/LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+ install -Dm644 ${pkgname/-rocm-git}/LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}