public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-04-07 18:22 Paul Zander
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Zander @ 2025-04-07 18:22 UTC (permalink / raw
  To: gentoo-commits

commit:     4c15d8ccb15dbf406efdfda4048901c4e687d8c1
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Mon Apr  7 18:09:33 2025 +0000
Commit:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Mon Apr  7 18:12:53 2025 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=4c15d8cc

sci-ml/ollama: filter flags in go file comments

Closes: https://bugs.gentoo.org/953049
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>

 sci-ml/ollama/ollama-0.6.3.ebuild | 4 ++++
 sci-ml/ollama/ollama-9999.ebuild  | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/sci-ml/ollama/ollama-0.6.3.ebuild b/sci-ml/ollama/ollama-0.6.3.ebuild
index 9f07083dd..cf664c756 100644
--- a/sci-ml/ollama/ollama-0.6.3.ebuild
+++ b/sci-ml/ollama/ollama-0.6.3.ebuild
@@ -93,6 +93,10 @@ src_prepare() {
 		-e "/PRE_INCLUDE_REGEXES.*hip/d" \
 		-i CMakeLists.txt || die sed
 
+	sed \
+		-e "s/-O3/${CFLAGS}/g" \
+		-i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
+
 	if use amd64; then
 		if ! use cpu_flags_x86_avx; then
 			sed -e "/ggml_add_cpu_backend_variant(sandybridge/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die

diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-9999.ebuild
index 7147e4cc8..6726a5970 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-9999.ebuild
@@ -93,6 +93,10 @@ src_prepare() {
 		-e "/PRE_INCLUDE_REGEXES.*hip/d" \
 		-i CMakeLists.txt || die sed
 
+	sed \
+		-e "s/-O3/${CFLAGS}/g" \
+		-i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
+
 	if use amd64; then
 		if ! use cpu_flags_x86_avx; then
 			sed -e "/ggml_add_cpu_backend_variant(sandybridge/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-04-07 18:22 Paul Zander
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Zander @ 2025-04-07 18:22 UTC (permalink / raw
  To: gentoo-commits

commit:     2b8d876eb74b90e7f4925304df1e5df6193b1529
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Mon Apr  7 18:08:46 2025 +0000
Commit:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Mon Apr  7 18:12:53 2025 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=2b8d876e

sci-ml/ollama: add missing USE-dep to 0.6.3 to put user in video group

Closes: https://bugs.gentoo.org/953074
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>

 sci-ml/ollama/ollama-0.6.3.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sci-ml/ollama/ollama-0.6.3.ebuild b/sci-ml/ollama/ollama-0.6.3.ebuild
index b4969fb21..9f07083dd 100644
--- a/sci-ml/ollama/ollama-0.6.3.ebuild
+++ b/sci-ml/ollama/ollama-0.6.3.ebuild
@@ -68,7 +68,7 @@ DEPEND="
 RDEPEND="
 	${COMMON_DEPEND}
 	acct-group/${PN}
-	acct-user/${PN}
+	acct-user/${PN}[cuda?]
 "
 
 PATCHES=(


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-04-07 18:22 Paul Zander
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Zander @ 2025-04-07 18:22 UTC (permalink / raw
  To: gentoo-commits

commit:     7938f65683c3c090abb864090a53a11c97ef36b8
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Mon Apr  7 18:09:54 2025 +0000
Commit:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Mon Apr  7 18:12:53 2025 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=7938f656

sci-ml/ollama: add 0.6.4

Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>

 sci-ml/ollama/Manifest            |   2 +
 sci-ml/ollama/ollama-0.6.4.ebuild | 305 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 307 insertions(+)

diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index 88cd835f1..57079a8a0 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -1,2 +1,4 @@
 DIST ollama-0.6.3-vendor.tar.xz 4417068 BLAKE2B 33aabb08f8582c7f211ebfc51c95af96d7ce1402c6350b656fb0114fe849901ea65f22bf833175a87aa318a685f35c0941b236dfcbf84c81d7766a91d66f6db3 SHA512 79044b751daba3d463d7890792d5a6581e96317951de763191b128237e90e81dac578b674654d527e70d48fa059cb62f40831554c432a2a424d659790dbd7a10
 DIST ollama-0.6.3.gh.tar.gz 7950300 BLAKE2B 4a14bab714b11104753caafe58a1301490d6a24d7af90a374741b6977fafb47792a50fa570e0883b13d5275f621ae1516f2d4055f6c32583e42821725d65e59f SHA512 28a0688f1aa35a161e09af19b643b2a53115fa29ce0b522ed2bd76bcaedc710553a266af2370886bc23408025935f786d13f07297ffb3e783b13132237f10712
+DIST ollama-0.6.4-vendor.tar.xz 4414140 BLAKE2B 72452a0143863afc6a748a78ece63d8e33842b8f53ae041b2a0e5d727765cf452ac95e81fff4af2fddbc86da793864ef1d2489f7feb15092b5732f1bcae1f698 SHA512 acb179bc8816e843cd78858be6af828496932385a4f1c7877af1de1ad38c68f55b789c2b0ab81b7ce92e0aea9e2224bc004d18b3fbce1ff81e2bc904234d9d48
+DIST ollama-0.6.4.gh.tar.gz 7958849 BLAKE2B 1cc6b1490913c3d11d1abe3ad99f44db0cc953ca58e507949b4cef02e37a1be20e7621627f999426a0d224a5a1a41de6186254730a2507f200540340f621e034 SHA512 ee2de90c51f4c85e6bacab8c570ffe3d0adc59369423127c0875cd328ea1469899f7ee847eb00c5e35856adba50d8c2d2e8de88df2389a043313d6f0edcbf5db

diff --git a/sci-ml/ollama/ollama-0.6.4.ebuild b/sci-ml/ollama/ollama-0.6.4.ebuild
new file mode 100644
index 000000000..cf664c756
--- /dev/null
+++ b/sci-ml/ollama/ollama-0.6.4.ebuild
@@ -0,0 +1,305 @@
+# Copyright 2024-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# supports ROCM/HIP >=5.5, but we define 6.1 due to the eclass
+ROCM_VERSION=6.1
+inherit cuda rocm
+inherit cmake
+inherit go-module systemd toolchain-funcs
+
+DESCRIPTION="Get up and running with Llama 3, Mistral, Gemma, and other language models."
+HOMEPAGE="https://ollama.com"
+
+if [[ ${PV} == *9999* ]]; then
+	inherit git-r3
+	EGIT_REPO_URI="https://github.com/ollama/ollama.git"
+else
+	SRC_URI="
+		https://github.com/ollama/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.gh.tar.gz
+		https://github.com/negril/gentoo-overlay-vendored/raw/refs/heads/blobs/${P}-vendor.tar.xz
+	"
+	KEYWORDS="~amd64"
+fi
+
+LICENSE="MIT"
+SLOT="0"
+
+X86_CPU_FLAGS=(
+	avx
+	f16c
+	avx2
+	fma3
+	avx512f
+	avx512vbmi
+	avx512_vnni
+	avx512_bf16
+	avx_vnni
+	amx_tile
+	amx_int8
+)
+CPU_FLAGS=( "${X86_CPU_FLAGS[@]/#/cpu_flags_x86_}" )
+IUSE="${CPU_FLAGS[*]} cuda blas mkl rocm"
+# IUSE+=" opencl vulkan"
+
+COMMON_DEPEND="
+	cuda? (
+		dev-util/nvidia-cuda-toolkit:=
+	)
+	blas? (
+		!mkl? (
+			virtual/blas
+		)
+		mkl? (
+			sci-libs/mkl
+		)
+	)
+	rocm? (
+		>=sci-libs/hipBLAS-5.5:=[${ROCM_USEDEP}]
+	)
+"
+
+DEPEND="
+	${COMMON_DEPEND}
+	>=dev-lang/go-1.23.4
+"
+
+RDEPEND="
+	${COMMON_DEPEND}
+	acct-group/${PN}
+	acct-user/${PN}[cuda?]
+"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-0.6.3-use-GNUInstallDirs.patch"
+)
+
+src_unpack() {
+	if [[ "${PV}" == *9999* ]]; then
+		git-r3_src_unpack
+		go-module_live_vendor
+	else
+		go-module_src_unpack
+	fi
+}
+
+src_prepare() {
+	cmake_src_prepare
+
+	sed \
+		-e "/set(GGML_CCACHE/s/ON/OFF/g" \
+		-e "/PRE_INCLUDE_REGEXES.*cu/d" \
+		-e "/PRE_INCLUDE_REGEXES.*hip/d" \
+		-i CMakeLists.txt || die sed
+
+	sed \
+		-e "s/-O3/${CFLAGS}/g" \
+		-i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
+
+	if use amd64; then
+		if ! use cpu_flags_x86_avx; then
+			sed -e "/ggml_add_cpu_backend_variant(sandybridge/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
+			# AVX)
+		fi
+		if
+			! use cpu_flags_x86_avx ||
+			! use cpu_flags_x86_f16c ||
+			! use cpu_flags_x86_avx2 ||
+			! use cpu_flags_x86_fma3; then
+			sed -e "/ggml_add_cpu_backend_variant(haswell/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
+			# AVX F16C AVX2 FMA)
+		fi
+		if
+			! use cpu_flags_x86_avx ||
+			! use cpu_flags_x86_f16c ||
+			! use cpu_flags_x86_avx2 ||
+			! use cpu_flags_x86_fma3 ||
+			! use cpu_flags_x86_avx512f; then
+			sed -e "/ggml_add_cpu_backend_variant(skylakex/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt ||  die
+			# AVX F16C AVX2 FMA AVX512)
+		fi
+		if
+			! use cpu_flags_x86_avx ||
+			! use cpu_flags_x86_f16c ||
+			! use cpu_flags_x86_avx2 ||
+			! use cpu_flags_x86_fma3 ||
+			! use cpu_flags_x86_avx512f ||
+			! use cpu_flags_x86_avx512vbmi ||
+			! use cpu_flags_x86_avx512_vnni; then
+			sed -e "/ggml_add_cpu_backend_variant(icelake/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
+			# AVX F16C AVX2 FMA AVX512 AVX512_VBMI AVX512_VNNI)
+		fi
+		if
+			! use cpu_flags_x86_avx ||
+			! use cpu_flags_x86_f16c ||
+			! use cpu_flags_x86_avx2 ||
+			! use cpu_flags_x86_fma3 ||
+			! use cpu_flags_x86_avx_vnni; then
+			sed -e "/ggml_add_cpu_backend_variant(alderlake/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
+			# AVX F16C AVX2 FMA AVX_VNNI)
+		fi
+
+		if
+			! use cpu_flags_x86_avx ||
+			! use cpu_flags_x86_f16c ||
+			! use cpu_flags_x86_avx2 ||
+			! use cpu_flags_x86_fma3 ||
+			! use cpu_flags_x86_avx512f ||
+			! use cpu_flags_x86_avx512vbmi ||
+			! use cpu_flags_x86_avx512_vnni ||
+			! use cpu_flags_x86_avx512_bf16 ||
+			! use cpu_flags_x86_amx_tile ||
+			! use cpu_flags_x86_amx_int8 ; then
+			sed -e "/ggml_add_cpu_backend_variant(sapphirerapids/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
+			#AVX F16C AVX2 FMA AVX512 AVX512_VBMI AVX512_VNNI AVX512_BF16 AMX_TILE AMX_INT8)
+		fi
+		: # ml/backend/ggml/ggml/src/CMakeLists.txt
+	fi
+
+	# default
+	# return
+	if use cuda; then
+		cuda_src_prepare
+	fi
+
+	if use rocm; then
+		# --hip-version gets appended to the compile flags which isn't a known flag.
+		# This causes rocm builds to fail because -Wunused-command-line-argument is turned on.
+		# Use nuclear option to fix this.
+		# Disable -Werror's from go modules.
+		find "${S}" -name ".go" -exec sed -i "s/ -Werror / /g" {} + || die
+	fi
+}
+
+src_configure() {
+	local mycmakeargs=(
+		-DCMAKE_POLICY_DEFAULT_CMP0177="OLD"
+		-DGGML_CCACHE="no"
+
+		# -DGGML_CPU="yes"
+		-DGGML_BLAS="$(usex blas)"
+		# -DGGML_CUDA="$(usex cuda)"
+		# -DGGML_HIP="$(usex rocm)"
+
+		# -DGGML_METAL="yes" # apple
+		# missing from ml/backend/ggml/ggml/src/
+		# -DGGML_CANN="yes"
+		# -DGGML_MUSA="yes"
+		# -DGGML_RPC="yes"
+		# -DGGML_SYCL="yes"
+		# -DGGML_KOMPUTE="$(usex kompute)"
+		# -DGGML_OPENCL="$(usex opencl)"
+		# -DGGML_VULKAN="$(usex vulkan)"
+	)
+
+	if use blas; then
+		if use mkl; then
+			mycmakeargs+=(
+				-DGGML_BLAS_VENDOR="Intel"
+			)
+		else
+			mycmakeargs+=(
+				-DGGML_BLAS_VENDOR="Generic"
+			)
+		fi
+	fi
+	if use cuda; then
+		local -x CUDAHOSTCXX CUDAHOSTLD
+		CUDAHOSTCXX="$(cuda_gccdir)"
+		CUDAHOSTLD="$(tc-getCXX)"
+
+		cuda_add_sandbox -w
+	else
+		mycmakeargs+=(
+			-DCMAKE_CUDA_COMPILER="NOTFOUND"
+		)
+	fi
+
+	if use rocm; then
+		mycmakeargs+=(
+			-DCMAKE_HIP_PLATFORM="amd"
+		)
+
+		local -x HIP_ARCHS HIP_PATH
+		HIP_ARCHS="$(get_amdgpu_flags)"
+		HIP_PATH="${ESYSROOT}/usr"
+
+		check_amdgpu
+	else
+		mycmakeargs+=(
+			-DCMAKE_HIP_COMPILER="NOTFOUND"
+		)
+	fi
+
+	cmake_src_configure
+
+	# if ! use cuda && ! use rocm; then
+	# 	# to configure and build only CPU variants
+	# 	set -- cmake --preset Default "${mycmakeargs[@]}"
+	# fi
+
+	# if use cuda; then
+	# 	# to configure and build only CUDA
+	# 	set -- cmake --preset CUDA "${mycmakeargs[@]}"
+	# fi
+
+	# if use rocm; then
+	# 	# to configure and build only ROCm
+	# 	set -- cmake --preset ROCm "${mycmakeargs[@]}"
+	# fi
+
+	# echo "$@" >&2
+	# "$@" || die -n "${*} failed"
+}
+
+src_compile() {
+	ego build
+
+	cmake_src_compile
+
+	# if ! use cuda && ! use rocm; then
+	# 	# to configure and build only CPU variants
+	# 	set -- cmake --build --preset Default -j16
+	# fi
+
+	# if use cuda; then
+	# 	# to configure and build only CUDA
+	# 	set -- cmake --build --preset CUDA -j16
+	# fi
+
+	# if use rocm; then
+	# 	# to configure and build only ROCm
+	# 	set -- cmake --build --preset ROCm -j16
+	# fi
+
+	# echo "$@" >&2
+	# "$@" || die -n "${*} failed"
+}
+
+src_install() {
+	dobin ollama
+
+	cmake_src_install
+
+	newinitd "${FILESDIR}/ollama.init" "${PN}"
+	newconfd "${FILESDIR}/ollama.confd" "${PN}"
+
+	systemd_dounit "${FILESDIR}/ollama.service"
+}
+
+pkg_preinst() {
+	keepdir /var/log/ollama
+	fperms 750 /var/log/ollama
+	fowners "${PN}:${PN}" /var/log/ollama
+}
+
+pkg_postinst() {
+	if [[ -z ${REPLACING_VERSIONS} ]] ; then
+		einfo "Quick guide:"
+		einfo "\tollama serve"
+		einfo "\tollama run llama3:70b"
+		einfo
+		einfo "See available models at https://ollama.com/library"
+	fi
+}


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-04-10 21:48 Paul Zander
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Zander @ 2025-04-10 21:48 UTC (permalink / raw
  To: gentoo-commits

commit:     362def25a8c2eb028c438b8faf7c25267216fe8e
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Thu Apr 10 21:47:41 2025 +0000
Commit:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Thu Apr 10 21:47:55 2025 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=362def25

sci-ml/ollama: add 0.6.5

Closes: https://bugs.gentoo.org/953511
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>

 sci-ml/ollama/Manifest                                    | 2 ++
 sci-ml/ollama/{ollama-9999.ebuild => ollama-0.6.5.ebuild} | 3 ++-
 sci-ml/ollama/ollama-9999.ebuild                          | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index 57079a8a0..292ef15d2 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -2,3 +2,5 @@ DIST ollama-0.6.3-vendor.tar.xz 4417068 BLAKE2B 33aabb08f8582c7f211ebfc51c95af96
 DIST ollama-0.6.3.gh.tar.gz 7950300 BLAKE2B 4a14bab714b11104753caafe58a1301490d6a24d7af90a374741b6977fafb47792a50fa570e0883b13d5275f621ae1516f2d4055f6c32583e42821725d65e59f SHA512 28a0688f1aa35a161e09af19b643b2a53115fa29ce0b522ed2bd76bcaedc710553a266af2370886bc23408025935f786d13f07297ffb3e783b13132237f10712
 DIST ollama-0.6.4-vendor.tar.xz 4414140 BLAKE2B 72452a0143863afc6a748a78ece63d8e33842b8f53ae041b2a0e5d727765cf452ac95e81fff4af2fddbc86da793864ef1d2489f7feb15092b5732f1bcae1f698 SHA512 acb179bc8816e843cd78858be6af828496932385a4f1c7877af1de1ad38c68f55b789c2b0ab81b7ce92e0aea9e2224bc004d18b3fbce1ff81e2bc904234d9d48
 DIST ollama-0.6.4.gh.tar.gz 7958849 BLAKE2B 1cc6b1490913c3d11d1abe3ad99f44db0cc953ca58e507949b4cef02e37a1be20e7621627f999426a0d224a5a1a41de6186254730a2507f200540340f621e034 SHA512 ee2de90c51f4c85e6bacab8c570ffe3d0adc59369423127c0875cd328ea1469899f7ee847eb00c5e35856adba50d8c2d2e8de88df2389a043313d6f0edcbf5db
+DIST ollama-0.6.5-vendor.tar.xz 4416776 BLAKE2B be4ad1df96e17d94d5bd8464113d95518173aeccb998a22ee3bffb8788019b520f18a141d1e1e9c594295c9c4d20a9064eb86905c44520da00f170f769b11fed SHA512 ca8eb19061e6772d79f4f531d610692837334046d906a1c500202bafc3ae48b4c181c9d8a3f79b273bc5e8616012117f7ae248d3505d74bda3db942386923662
+DIST ollama-0.6.5.gh.tar.gz 7964755 BLAKE2B af059b433e28766988f7a4097fd2774d17331282ea670c588d69d69865b73f5460d0c9d271154228bb1e3488ccbe7fe785ed637acb88fb51f1efb5efed905ac6 SHA512 dc97098b51f215ec5259aece5872fe213aa7b413344aab30b6417754e15f9ce27d2515dd9134edf620d70b8af88d3de5d305ea4020adb7d281b268d26b672adf

diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-0.6.5.ebuild
similarity index 98%
copy from sci-ml/ollama/ollama-9999.ebuild
copy to sci-ml/ollama/ollama-0.6.5.ebuild
index 6726a5970..f9f8e9cb2 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-0.6.5.ebuild
@@ -94,7 +94,7 @@ src_prepare() {
 		-i CMakeLists.txt || die sed
 
 	sed \
-		-e "s/-O3/${CFLAGS}/g" \
+		-e "s/-O3/$(get-flag O)/g" \
 		-i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
 
 	if use amd64; then
@@ -174,6 +174,7 @@ src_prepare() {
 
 src_configure() {
 	local mycmakeargs=(
+		-DCMAKE_POLICY_DEFAULT_CMP0177="OLD"
 		-DGGML_CCACHE="no"
 
 		# -DGGML_CPU="yes"

diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-9999.ebuild
index 6726a5970..d8944477e 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-9999.ebuild
@@ -94,7 +94,7 @@ src_prepare() {
 		-i CMakeLists.txt || die sed
 
 	sed \
-		-e "s/-O3/${CFLAGS}/g" \
+		-e "s/-O3/$(get-flag O)/g" \
 		-i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
 
 	if use amd64; then


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-04-16 12:24 Paul Zander
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Zander @ 2025-04-16 12:24 UTC (permalink / raw
  To: gentoo-commits

commit:     bf4efd75347fbd1c1fd123823d24ac77864d4054
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Wed Apr 16 12:15:44 2025 +0000
Commit:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Wed Apr 16 12:15:44 2025 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=bf4efd75

sci-ml/ollama: fix accelerated library lookup path

The go binary discarded libraries not in `lib/ollama`. This only showed when
running with `OLLAMA_DEBUG=1`.

Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>

 ...{ollama-0.6.5.ebuild => ollama-0.6.5-r1.ebuild} | 61 ++++++++--------------
 sci-ml/ollama/ollama-9999.ebuild                   | 61 ++++++++--------------
 2 files changed, 42 insertions(+), 80 deletions(-)

diff --git a/sci-ml/ollama/ollama-0.6.5.ebuild b/sci-ml/ollama/ollama-0.6.5-r1.ebuild
similarity index 85%
rename from sci-ml/ollama/ollama-0.6.5.ebuild
rename to sci-ml/ollama/ollama-0.6.5-r1.ebuild
index f9f8e9cb2..d5fda71a5 100644
--- a/sci-ml/ollama/ollama-0.6.5.ebuild
+++ b/sci-ml/ollama/ollama-0.6.5-r1.ebuild
@@ -68,7 +68,7 @@ DEPEND="
 RDEPEND="
 	${COMMON_DEPEND}
 	acct-group/${PN}
-	acct-user/${PN}[cuda?]
+	>=acct-user/${PN}-3[cuda?]
 "
 
 PATCHES=(
@@ -97,6 +97,19 @@ src_prepare() {
 		-e "s/-O3/$(get-flag O)/g" \
 		-i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
 
+	# fix library location
+	sed \
+		-e "s#lib/ollama#$(get_libdir)/ollama#g" \
+		-i CMakeLists.txt || die sed
+
+	sed \
+		-e "s/\"..\", \"lib\"/\"..\", \"$(get_libdir)\"/" \
+		-e "s#\"lib/ollama\"#\"$(get_libdir)/ollama\"#" \
+		-i \
+			ml/backend/ggml/ggml/src/ggml.go \
+			discover/path.go \
+		|| die
+
 	if use amd64; then
 		if ! use cpu_flags_x86_avx; then
 			sed -e "/ggml_add_cpu_backend_variant(sandybridge/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
@@ -218,12 +231,11 @@ src_configure() {
 
 	if use rocm; then
 		mycmakeargs+=(
+			-DCMAKE_HIP_ARCHITECTURES="$(get_amdgpu_flags)"
 			-DCMAKE_HIP_PLATFORM="amd"
 		)
 
-		local -x HIP_ARCHS HIP_PATH
-		HIP_ARCHS="$(get_amdgpu_flags)"
-		HIP_PATH="${ESYSROOT}/usr"
+		local -x HIP_PATH="${ESYSROOT}/usr"
 
 		check_amdgpu
 	else
@@ -233,48 +245,12 @@ src_configure() {
 	fi
 
 	cmake_src_configure
-
-	# if ! use cuda && ! use rocm; then
-	# 	# to configure and build only CPU variants
-	# 	set -- cmake --preset Default "${mycmakeargs[@]}"
-	# fi
-
-	# if use cuda; then
-	# 	# to configure and build only CUDA
-	# 	set -- cmake --preset CUDA "${mycmakeargs[@]}"
-	# fi
-
-	# if use rocm; then
-	# 	# to configure and build only ROCm
-	# 	set -- cmake --preset ROCm "${mycmakeargs[@]}"
-	# fi
-
-	# echo "$@" >&2
-	# "$@" || die -n "${*} failed"
 }
 
 src_compile() {
 	ego build
 
 	cmake_src_compile
-
-	# if ! use cuda && ! use rocm; then
-	# 	# to configure and build only CPU variants
-	# 	set -- cmake --build --preset Default -j16
-	# fi
-
-	# if use cuda; then
-	# 	# to configure and build only CUDA
-	# 	set -- cmake --build --preset CUDA -j16
-	# fi
-
-	# if use rocm; then
-	# 	# to configure and build only ROCm
-	# 	set -- cmake --build --preset ROCm -j16
-	# fi
-
-	# echo "$@" >&2
-	# "$@" || die -n "${*} failed"
 }
 
 src_install() {
@@ -302,4 +278,9 @@ pkg_postinst() {
 		einfo
 		einfo "See available models at https://ollama.com/library"
 	fi
+
+	if use cuda ; then
+		einfo "When using cuda the user running ${PN} has to be in the video group or it won't detect devices."
+		einfo "The ebuild ensures this for user ${PN} via acct-user/${PN}[cuda]"
+	fi
 }

diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-9999.ebuild
index d8944477e..085c656fa 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-9999.ebuild
@@ -68,7 +68,7 @@ DEPEND="
 RDEPEND="
 	${COMMON_DEPEND}
 	acct-group/${PN}
-	acct-user/${PN}[cuda?]
+	>=acct-user/${PN}-3[cuda?]
 "
 
 PATCHES=(
@@ -97,6 +97,19 @@ src_prepare() {
 		-e "s/-O3/$(get-flag O)/g" \
 		-i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
 
+	# fix library location
+	sed \
+		-e "s#lib/ollama#$(get_libdir)/ollama#g" \
+		-i CMakeLists.txt || die sed
+
+	sed \
+		-e "s/\"..\", \"lib\"/\"..\", \"$(get_libdir)\"/" \
+		-e "s#\"lib/ollama\"#\"$(get_libdir)/ollama\"#" \
+		-i \
+			ml/backend/ggml/ggml/src/ggml.go \
+			discover/path.go \
+		|| die
+
 	if use amd64; then
 		if ! use cpu_flags_x86_avx; then
 			sed -e "/ggml_add_cpu_backend_variant(sandybridge/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
@@ -217,12 +230,11 @@ src_configure() {
 
 	if use rocm; then
 		mycmakeargs+=(
+			-DCMAKE_HIP_ARCHITECTURES="$(get_amdgpu_flags)"
 			-DCMAKE_HIP_PLATFORM="amd"
 		)
 
-		local -x HIP_ARCHS HIP_PATH
-		HIP_ARCHS="$(get_amdgpu_flags)"
-		HIP_PATH="${ESYSROOT}/usr"
+		local -x HIP_PATH="${ESYSROOT}/usr"
 
 		check_amdgpu
 	else
@@ -232,48 +244,12 @@ src_configure() {
 	fi
 
 	cmake_src_configure
-
-	# if ! use cuda && ! use rocm; then
-	# 	# to configure and build only CPU variants
-	# 	set -- cmake --preset Default "${mycmakeargs[@]}"
-	# fi
-
-	# if use cuda; then
-	# 	# to configure and build only CUDA
-	# 	set -- cmake --preset CUDA "${mycmakeargs[@]}"
-	# fi
-
-	# if use rocm; then
-	# 	# to configure and build only ROCm
-	# 	set -- cmake --preset ROCm "${mycmakeargs[@]}"
-	# fi
-
-	# echo "$@" >&2
-	# "$@" || die -n "${*} failed"
 }
 
 src_compile() {
 	ego build
 
 	cmake_src_compile
-
-	# if ! use cuda && ! use rocm; then
-	# 	# to configure and build only CPU variants
-	# 	set -- cmake --build --preset Default -j16
-	# fi
-
-	# if use cuda; then
-	# 	# to configure and build only CUDA
-	# 	set -- cmake --build --preset CUDA -j16
-	# fi
-
-	# if use rocm; then
-	# 	# to configure and build only ROCm
-	# 	set -- cmake --build --preset ROCm -j16
-	# fi
-
-	# echo "$@" >&2
-	# "$@" || die -n "${*} failed"
 }
 
 src_install() {
@@ -301,4 +277,9 @@ pkg_postinst() {
 		einfo
 		einfo "See available models at https://ollama.com/library"
 	fi
+
+	if use cuda ; then
+		einfo "When using cuda the user running ${PN} has to be in the video group or it won't detect devices."
+		einfo "The ebuild ensures this for user ${PN} via acct-user/${PN}[cuda]"
+	fi
 }


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-04-16 12:24 Paul Zander
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Zander @ 2025-04-16 12:24 UTC (permalink / raw
  To: gentoo-commits

commit:     3670bb4d97602d491fb10b868c06b5623d7cdf42
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Wed Apr 16 12:16:34 2025 +0000
Commit:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Wed Apr 16 12:16:34 2025 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=3670bb4d

sci-ml/ollama: drop -O2 flag from go file

Closes: https://bugs.gentoo.org/953877
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>

 sci-ml/ollama/ollama-0.6.5-r1.ebuild | 2 +-
 sci-ml/ollama/ollama-9999.ebuild     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sci-ml/ollama/ollama-0.6.5-r1.ebuild b/sci-ml/ollama/ollama-0.6.5-r1.ebuild
index d5fda71a5..f0c4ca473 100644
--- a/sci-ml/ollama/ollama-0.6.5-r1.ebuild
+++ b/sci-ml/ollama/ollama-0.6.5-r1.ebuild
@@ -94,7 +94,7 @@ src_prepare() {
 		-i CMakeLists.txt || die sed
 
 	sed \
-		-e "s/-O3/$(get-flag O)/g" \
+		-e "s/ -O3//g" \
 		-i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
 
 	# fix library location

diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-9999.ebuild
index 085c656fa..79bdf486b 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-9999.ebuild
@@ -94,7 +94,7 @@ src_prepare() {
 		-i CMakeLists.txt || die sed
 
 	sed \
-		-e "s/-O3/$(get-flag O)/g" \
+		-e "s/ -O3//g" \
 		-i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
 
 	# fix library location


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-04-16 12:24 Paul Zander
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Zander @ 2025-04-16 12:24 UTC (permalink / raw
  To: gentoo-commits

commit:     69efba9ce107ee517eeb05c80adbcc176c6e4440
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Wed Apr 16 12:17:02 2025 +0000
Commit:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Wed Apr 16 12:17:02 2025 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=69efba9c

sci-ml/ollama: drop 0.6.4 0.6.3

Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>

 sci-ml/ollama/Manifest            |   4 -
 sci-ml/ollama/ollama-0.6.3.ebuild | 305 --------------------------------------
 sci-ml/ollama/ollama-0.6.4.ebuild | 305 --------------------------------------
 3 files changed, 614 deletions(-)

diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index 292ef15d2..c8ac3ffaf 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -1,6 +1,2 @@
-DIST ollama-0.6.3-vendor.tar.xz 4417068 BLAKE2B 33aabb08f8582c7f211ebfc51c95af96d7ce1402c6350b656fb0114fe849901ea65f22bf833175a87aa318a685f35c0941b236dfcbf84c81d7766a91d66f6db3 SHA512 79044b751daba3d463d7890792d5a6581e96317951de763191b128237e90e81dac578b674654d527e70d48fa059cb62f40831554c432a2a424d659790dbd7a10
-DIST ollama-0.6.3.gh.tar.gz 7950300 BLAKE2B 4a14bab714b11104753caafe58a1301490d6a24d7af90a374741b6977fafb47792a50fa570e0883b13d5275f621ae1516f2d4055f6c32583e42821725d65e59f SHA512 28a0688f1aa35a161e09af19b643b2a53115fa29ce0b522ed2bd76bcaedc710553a266af2370886bc23408025935f786d13f07297ffb3e783b13132237f10712
-DIST ollama-0.6.4-vendor.tar.xz 4414140 BLAKE2B 72452a0143863afc6a748a78ece63d8e33842b8f53ae041b2a0e5d727765cf452ac95e81fff4af2fddbc86da793864ef1d2489f7feb15092b5732f1bcae1f698 SHA512 acb179bc8816e843cd78858be6af828496932385a4f1c7877af1de1ad38c68f55b789c2b0ab81b7ce92e0aea9e2224bc004d18b3fbce1ff81e2bc904234d9d48
-DIST ollama-0.6.4.gh.tar.gz 7958849 BLAKE2B 1cc6b1490913c3d11d1abe3ad99f44db0cc953ca58e507949b4cef02e37a1be20e7621627f999426a0d224a5a1a41de6186254730a2507f200540340f621e034 SHA512 ee2de90c51f4c85e6bacab8c570ffe3d0adc59369423127c0875cd328ea1469899f7ee847eb00c5e35856adba50d8c2d2e8de88df2389a043313d6f0edcbf5db
 DIST ollama-0.6.5-vendor.tar.xz 4416776 BLAKE2B be4ad1df96e17d94d5bd8464113d95518173aeccb998a22ee3bffb8788019b520f18a141d1e1e9c594295c9c4d20a9064eb86905c44520da00f170f769b11fed SHA512 ca8eb19061e6772d79f4f531d610692837334046d906a1c500202bafc3ae48b4c181c9d8a3f79b273bc5e8616012117f7ae248d3505d74bda3db942386923662
 DIST ollama-0.6.5.gh.tar.gz 7964755 BLAKE2B af059b433e28766988f7a4097fd2774d17331282ea670c588d69d69865b73f5460d0c9d271154228bb1e3488ccbe7fe785ed637acb88fb51f1efb5efed905ac6 SHA512 dc97098b51f215ec5259aece5872fe213aa7b413344aab30b6417754e15f9ce27d2515dd9134edf620d70b8af88d3de5d305ea4020adb7d281b268d26b672adf

diff --git a/sci-ml/ollama/ollama-0.6.3.ebuild b/sci-ml/ollama/ollama-0.6.3.ebuild
deleted file mode 100644
index cf664c756..000000000
--- a/sci-ml/ollama/ollama-0.6.3.ebuild
+++ /dev/null
@@ -1,305 +0,0 @@
-# Copyright 2024-2025 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# supports ROCM/HIP >=5.5, but we define 6.1 due to the eclass
-ROCM_VERSION=6.1
-inherit cuda rocm
-inherit cmake
-inherit go-module systemd toolchain-funcs
-
-DESCRIPTION="Get up and running with Llama 3, Mistral, Gemma, and other language models."
-HOMEPAGE="https://ollama.com"
-
-if [[ ${PV} == *9999* ]]; then
-	inherit git-r3
-	EGIT_REPO_URI="https://github.com/ollama/ollama.git"
-else
-	SRC_URI="
-		https://github.com/ollama/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.gh.tar.gz
-		https://github.com/negril/gentoo-overlay-vendored/raw/refs/heads/blobs/${P}-vendor.tar.xz
-	"
-	KEYWORDS="~amd64"
-fi
-
-LICENSE="MIT"
-SLOT="0"
-
-X86_CPU_FLAGS=(
-	avx
-	f16c
-	avx2
-	fma3
-	avx512f
-	avx512vbmi
-	avx512_vnni
-	avx512_bf16
-	avx_vnni
-	amx_tile
-	amx_int8
-)
-CPU_FLAGS=( "${X86_CPU_FLAGS[@]/#/cpu_flags_x86_}" )
-IUSE="${CPU_FLAGS[*]} cuda blas mkl rocm"
-# IUSE+=" opencl vulkan"
-
-COMMON_DEPEND="
-	cuda? (
-		dev-util/nvidia-cuda-toolkit:=
-	)
-	blas? (
-		!mkl? (
-			virtual/blas
-		)
-		mkl? (
-			sci-libs/mkl
-		)
-	)
-	rocm? (
-		>=sci-libs/hipBLAS-5.5:=[${ROCM_USEDEP}]
-	)
-"
-
-DEPEND="
-	${COMMON_DEPEND}
-	>=dev-lang/go-1.23.4
-"
-
-RDEPEND="
-	${COMMON_DEPEND}
-	acct-group/${PN}
-	acct-user/${PN}[cuda?]
-"
-
-PATCHES=(
-	"${FILESDIR}/${PN}-0.6.3-use-GNUInstallDirs.patch"
-)
-
-src_unpack() {
-	if [[ "${PV}" == *9999* ]]; then
-		git-r3_src_unpack
-		go-module_live_vendor
-	else
-		go-module_src_unpack
-	fi
-}
-
-src_prepare() {
-	cmake_src_prepare
-
-	sed \
-		-e "/set(GGML_CCACHE/s/ON/OFF/g" \
-		-e "/PRE_INCLUDE_REGEXES.*cu/d" \
-		-e "/PRE_INCLUDE_REGEXES.*hip/d" \
-		-i CMakeLists.txt || die sed
-
-	sed \
-		-e "s/-O3/${CFLAGS}/g" \
-		-i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
-
-	if use amd64; then
-		if ! use cpu_flags_x86_avx; then
-			sed -e "/ggml_add_cpu_backend_variant(sandybridge/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
-			# AVX)
-		fi
-		if
-			! use cpu_flags_x86_avx ||
-			! use cpu_flags_x86_f16c ||
-			! use cpu_flags_x86_avx2 ||
-			! use cpu_flags_x86_fma3; then
-			sed -e "/ggml_add_cpu_backend_variant(haswell/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
-			# AVX F16C AVX2 FMA)
-		fi
-		if
-			! use cpu_flags_x86_avx ||
-			! use cpu_flags_x86_f16c ||
-			! use cpu_flags_x86_avx2 ||
-			! use cpu_flags_x86_fma3 ||
-			! use cpu_flags_x86_avx512f; then
-			sed -e "/ggml_add_cpu_backend_variant(skylakex/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt ||  die
-			# AVX F16C AVX2 FMA AVX512)
-		fi
-		if
-			! use cpu_flags_x86_avx ||
-			! use cpu_flags_x86_f16c ||
-			! use cpu_flags_x86_avx2 ||
-			! use cpu_flags_x86_fma3 ||
-			! use cpu_flags_x86_avx512f ||
-			! use cpu_flags_x86_avx512vbmi ||
-			! use cpu_flags_x86_avx512_vnni; then
-			sed -e "/ggml_add_cpu_backend_variant(icelake/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
-			# AVX F16C AVX2 FMA AVX512 AVX512_VBMI AVX512_VNNI)
-		fi
-		if
-			! use cpu_flags_x86_avx ||
-			! use cpu_flags_x86_f16c ||
-			! use cpu_flags_x86_avx2 ||
-			! use cpu_flags_x86_fma3 ||
-			! use cpu_flags_x86_avx_vnni; then
-			sed -e "/ggml_add_cpu_backend_variant(alderlake/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
-			# AVX F16C AVX2 FMA AVX_VNNI)
-		fi
-
-		if
-			! use cpu_flags_x86_avx ||
-			! use cpu_flags_x86_f16c ||
-			! use cpu_flags_x86_avx2 ||
-			! use cpu_flags_x86_fma3 ||
-			! use cpu_flags_x86_avx512f ||
-			! use cpu_flags_x86_avx512vbmi ||
-			! use cpu_flags_x86_avx512_vnni ||
-			! use cpu_flags_x86_avx512_bf16 ||
-			! use cpu_flags_x86_amx_tile ||
-			! use cpu_flags_x86_amx_int8 ; then
-			sed -e "/ggml_add_cpu_backend_variant(sapphirerapids/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
-			#AVX F16C AVX2 FMA AVX512 AVX512_VBMI AVX512_VNNI AVX512_BF16 AMX_TILE AMX_INT8)
-		fi
-		: # ml/backend/ggml/ggml/src/CMakeLists.txt
-	fi
-
-	# default
-	# return
-	if use cuda; then
-		cuda_src_prepare
-	fi
-
-	if use rocm; then
-		# --hip-version gets appended to the compile flags which isn't a known flag.
-		# This causes rocm builds to fail because -Wunused-command-line-argument is turned on.
-		# Use nuclear option to fix this.
-		# Disable -Werror's from go modules.
-		find "${S}" -name ".go" -exec sed -i "s/ -Werror / /g" {} + || die
-	fi
-}
-
-src_configure() {
-	local mycmakeargs=(
-		-DCMAKE_POLICY_DEFAULT_CMP0177="OLD"
-		-DGGML_CCACHE="no"
-
-		# -DGGML_CPU="yes"
-		-DGGML_BLAS="$(usex blas)"
-		# -DGGML_CUDA="$(usex cuda)"
-		# -DGGML_HIP="$(usex rocm)"
-
-		# -DGGML_METAL="yes" # apple
-		# missing from ml/backend/ggml/ggml/src/
-		# -DGGML_CANN="yes"
-		# -DGGML_MUSA="yes"
-		# -DGGML_RPC="yes"
-		# -DGGML_SYCL="yes"
-		# -DGGML_KOMPUTE="$(usex kompute)"
-		# -DGGML_OPENCL="$(usex opencl)"
-		# -DGGML_VULKAN="$(usex vulkan)"
-	)
-
-	if use blas; then
-		if use mkl; then
-			mycmakeargs+=(
-				-DGGML_BLAS_VENDOR="Intel"
-			)
-		else
-			mycmakeargs+=(
-				-DGGML_BLAS_VENDOR="Generic"
-			)
-		fi
-	fi
-	if use cuda; then
-		local -x CUDAHOSTCXX CUDAHOSTLD
-		CUDAHOSTCXX="$(cuda_gccdir)"
-		CUDAHOSTLD="$(tc-getCXX)"
-
-		cuda_add_sandbox -w
-	else
-		mycmakeargs+=(
-			-DCMAKE_CUDA_COMPILER="NOTFOUND"
-		)
-	fi
-
-	if use rocm; then
-		mycmakeargs+=(
-			-DCMAKE_HIP_PLATFORM="amd"
-		)
-
-		local -x HIP_ARCHS HIP_PATH
-		HIP_ARCHS="$(get_amdgpu_flags)"
-		HIP_PATH="${ESYSROOT}/usr"
-
-		check_amdgpu
-	else
-		mycmakeargs+=(
-			-DCMAKE_HIP_COMPILER="NOTFOUND"
-		)
-	fi
-
-	cmake_src_configure
-
-	# if ! use cuda && ! use rocm; then
-	# 	# to configure and build only CPU variants
-	# 	set -- cmake --preset Default "${mycmakeargs[@]}"
-	# fi
-
-	# if use cuda; then
-	# 	# to configure and build only CUDA
-	# 	set -- cmake --preset CUDA "${mycmakeargs[@]}"
-	# fi
-
-	# if use rocm; then
-	# 	# to configure and build only ROCm
-	# 	set -- cmake --preset ROCm "${mycmakeargs[@]}"
-	# fi
-
-	# echo "$@" >&2
-	# "$@" || die -n "${*} failed"
-}
-
-src_compile() {
-	ego build
-
-	cmake_src_compile
-
-	# if ! use cuda && ! use rocm; then
-	# 	# to configure and build only CPU variants
-	# 	set -- cmake --build --preset Default -j16
-	# fi
-
-	# if use cuda; then
-	# 	# to configure and build only CUDA
-	# 	set -- cmake --build --preset CUDA -j16
-	# fi
-
-	# if use rocm; then
-	# 	# to configure and build only ROCm
-	# 	set -- cmake --build --preset ROCm -j16
-	# fi
-
-	# echo "$@" >&2
-	# "$@" || die -n "${*} failed"
-}
-
-src_install() {
-	dobin ollama
-
-	cmake_src_install
-
-	newinitd "${FILESDIR}/ollama.init" "${PN}"
-	newconfd "${FILESDIR}/ollama.confd" "${PN}"
-
-	systemd_dounit "${FILESDIR}/ollama.service"
-}
-
-pkg_preinst() {
-	keepdir /var/log/ollama
-	fperms 750 /var/log/ollama
-	fowners "${PN}:${PN}" /var/log/ollama
-}
-
-pkg_postinst() {
-	if [[ -z ${REPLACING_VERSIONS} ]] ; then
-		einfo "Quick guide:"
-		einfo "\tollama serve"
-		einfo "\tollama run llama3:70b"
-		einfo
-		einfo "See available models at https://ollama.com/library"
-	fi
-}

diff --git a/sci-ml/ollama/ollama-0.6.4.ebuild b/sci-ml/ollama/ollama-0.6.4.ebuild
deleted file mode 100644
index cf664c756..000000000
--- a/sci-ml/ollama/ollama-0.6.4.ebuild
+++ /dev/null
@@ -1,305 +0,0 @@
-# Copyright 2024-2025 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-# supports ROCM/HIP >=5.5, but we define 6.1 due to the eclass
-ROCM_VERSION=6.1
-inherit cuda rocm
-inherit cmake
-inherit go-module systemd toolchain-funcs
-
-DESCRIPTION="Get up and running with Llama 3, Mistral, Gemma, and other language models."
-HOMEPAGE="https://ollama.com"
-
-if [[ ${PV} == *9999* ]]; then
-	inherit git-r3
-	EGIT_REPO_URI="https://github.com/ollama/ollama.git"
-else
-	SRC_URI="
-		https://github.com/ollama/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.gh.tar.gz
-		https://github.com/negril/gentoo-overlay-vendored/raw/refs/heads/blobs/${P}-vendor.tar.xz
-	"
-	KEYWORDS="~amd64"
-fi
-
-LICENSE="MIT"
-SLOT="0"
-
-X86_CPU_FLAGS=(
-	avx
-	f16c
-	avx2
-	fma3
-	avx512f
-	avx512vbmi
-	avx512_vnni
-	avx512_bf16
-	avx_vnni
-	amx_tile
-	amx_int8
-)
-CPU_FLAGS=( "${X86_CPU_FLAGS[@]/#/cpu_flags_x86_}" )
-IUSE="${CPU_FLAGS[*]} cuda blas mkl rocm"
-# IUSE+=" opencl vulkan"
-
-COMMON_DEPEND="
-	cuda? (
-		dev-util/nvidia-cuda-toolkit:=
-	)
-	blas? (
-		!mkl? (
-			virtual/blas
-		)
-		mkl? (
-			sci-libs/mkl
-		)
-	)
-	rocm? (
-		>=sci-libs/hipBLAS-5.5:=[${ROCM_USEDEP}]
-	)
-"
-
-DEPEND="
-	${COMMON_DEPEND}
-	>=dev-lang/go-1.23.4
-"
-
-RDEPEND="
-	${COMMON_DEPEND}
-	acct-group/${PN}
-	acct-user/${PN}[cuda?]
-"
-
-PATCHES=(
-	"${FILESDIR}/${PN}-0.6.3-use-GNUInstallDirs.patch"
-)
-
-src_unpack() {
-	if [[ "${PV}" == *9999* ]]; then
-		git-r3_src_unpack
-		go-module_live_vendor
-	else
-		go-module_src_unpack
-	fi
-}
-
-src_prepare() {
-	cmake_src_prepare
-
-	sed \
-		-e "/set(GGML_CCACHE/s/ON/OFF/g" \
-		-e "/PRE_INCLUDE_REGEXES.*cu/d" \
-		-e "/PRE_INCLUDE_REGEXES.*hip/d" \
-		-i CMakeLists.txt || die sed
-
-	sed \
-		-e "s/-O3/${CFLAGS}/g" \
-		-i ml/backend/ggml/ggml/src/ggml-cpu/cpu.go || die sed
-
-	if use amd64; then
-		if ! use cpu_flags_x86_avx; then
-			sed -e "/ggml_add_cpu_backend_variant(sandybridge/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
-			# AVX)
-		fi
-		if
-			! use cpu_flags_x86_avx ||
-			! use cpu_flags_x86_f16c ||
-			! use cpu_flags_x86_avx2 ||
-			! use cpu_flags_x86_fma3; then
-			sed -e "/ggml_add_cpu_backend_variant(haswell/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
-			# AVX F16C AVX2 FMA)
-		fi
-		if
-			! use cpu_flags_x86_avx ||
-			! use cpu_flags_x86_f16c ||
-			! use cpu_flags_x86_avx2 ||
-			! use cpu_flags_x86_fma3 ||
-			! use cpu_flags_x86_avx512f; then
-			sed -e "/ggml_add_cpu_backend_variant(skylakex/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt ||  die
-			# AVX F16C AVX2 FMA AVX512)
-		fi
-		if
-			! use cpu_flags_x86_avx ||
-			! use cpu_flags_x86_f16c ||
-			! use cpu_flags_x86_avx2 ||
-			! use cpu_flags_x86_fma3 ||
-			! use cpu_flags_x86_avx512f ||
-			! use cpu_flags_x86_avx512vbmi ||
-			! use cpu_flags_x86_avx512_vnni; then
-			sed -e "/ggml_add_cpu_backend_variant(icelake/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
-			# AVX F16C AVX2 FMA AVX512 AVX512_VBMI AVX512_VNNI)
-		fi
-		if
-			! use cpu_flags_x86_avx ||
-			! use cpu_flags_x86_f16c ||
-			! use cpu_flags_x86_avx2 ||
-			! use cpu_flags_x86_fma3 ||
-			! use cpu_flags_x86_avx_vnni; then
-			sed -e "/ggml_add_cpu_backend_variant(alderlake/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
-			# AVX F16C AVX2 FMA AVX_VNNI)
-		fi
-
-		if
-			! use cpu_flags_x86_avx ||
-			! use cpu_flags_x86_f16c ||
-			! use cpu_flags_x86_avx2 ||
-			! use cpu_flags_x86_fma3 ||
-			! use cpu_flags_x86_avx512f ||
-			! use cpu_flags_x86_avx512vbmi ||
-			! use cpu_flags_x86_avx512_vnni ||
-			! use cpu_flags_x86_avx512_bf16 ||
-			! use cpu_flags_x86_amx_tile ||
-			! use cpu_flags_x86_amx_int8 ; then
-			sed -e "/ggml_add_cpu_backend_variant(sapphirerapids/s/^/# /g" -i ml/backend/ggml/ggml/src/CMakeLists.txt || die
-			#AVX F16C AVX2 FMA AVX512 AVX512_VBMI AVX512_VNNI AVX512_BF16 AMX_TILE AMX_INT8)
-		fi
-		: # ml/backend/ggml/ggml/src/CMakeLists.txt
-	fi
-
-	# default
-	# return
-	if use cuda; then
-		cuda_src_prepare
-	fi
-
-	if use rocm; then
-		# --hip-version gets appended to the compile flags which isn't a known flag.
-		# This causes rocm builds to fail because -Wunused-command-line-argument is turned on.
-		# Use nuclear option to fix this.
-		# Disable -Werror's from go modules.
-		find "${S}" -name ".go" -exec sed -i "s/ -Werror / /g" {} + || die
-	fi
-}
-
-src_configure() {
-	local mycmakeargs=(
-		-DCMAKE_POLICY_DEFAULT_CMP0177="OLD"
-		-DGGML_CCACHE="no"
-
-		# -DGGML_CPU="yes"
-		-DGGML_BLAS="$(usex blas)"
-		# -DGGML_CUDA="$(usex cuda)"
-		# -DGGML_HIP="$(usex rocm)"
-
-		# -DGGML_METAL="yes" # apple
-		# missing from ml/backend/ggml/ggml/src/
-		# -DGGML_CANN="yes"
-		# -DGGML_MUSA="yes"
-		# -DGGML_RPC="yes"
-		# -DGGML_SYCL="yes"
-		# -DGGML_KOMPUTE="$(usex kompute)"
-		# -DGGML_OPENCL="$(usex opencl)"
-		# -DGGML_VULKAN="$(usex vulkan)"
-	)
-
-	if use blas; then
-		if use mkl; then
-			mycmakeargs+=(
-				-DGGML_BLAS_VENDOR="Intel"
-			)
-		else
-			mycmakeargs+=(
-				-DGGML_BLAS_VENDOR="Generic"
-			)
-		fi
-	fi
-	if use cuda; then
-		local -x CUDAHOSTCXX CUDAHOSTLD
-		CUDAHOSTCXX="$(cuda_gccdir)"
-		CUDAHOSTLD="$(tc-getCXX)"
-
-		cuda_add_sandbox -w
-	else
-		mycmakeargs+=(
-			-DCMAKE_CUDA_COMPILER="NOTFOUND"
-		)
-	fi
-
-	if use rocm; then
-		mycmakeargs+=(
-			-DCMAKE_HIP_PLATFORM="amd"
-		)
-
-		local -x HIP_ARCHS HIP_PATH
-		HIP_ARCHS="$(get_amdgpu_flags)"
-		HIP_PATH="${ESYSROOT}/usr"
-
-		check_amdgpu
-	else
-		mycmakeargs+=(
-			-DCMAKE_HIP_COMPILER="NOTFOUND"
-		)
-	fi
-
-	cmake_src_configure
-
-	# if ! use cuda && ! use rocm; then
-	# 	# to configure and build only CPU variants
-	# 	set -- cmake --preset Default "${mycmakeargs[@]}"
-	# fi
-
-	# if use cuda; then
-	# 	# to configure and build only CUDA
-	# 	set -- cmake --preset CUDA "${mycmakeargs[@]}"
-	# fi
-
-	# if use rocm; then
-	# 	# to configure and build only ROCm
-	# 	set -- cmake --preset ROCm "${mycmakeargs[@]}"
-	# fi
-
-	# echo "$@" >&2
-	# "$@" || die -n "${*} failed"
-}
-
-src_compile() {
-	ego build
-
-	cmake_src_compile
-
-	# if ! use cuda && ! use rocm; then
-	# 	# to configure and build only CPU variants
-	# 	set -- cmake --build --preset Default -j16
-	# fi
-
-	# if use cuda; then
-	# 	# to configure and build only CUDA
-	# 	set -- cmake --build --preset CUDA -j16
-	# fi
-
-	# if use rocm; then
-	# 	# to configure and build only ROCm
-	# 	set -- cmake --build --preset ROCm -j16
-	# fi
-
-	# echo "$@" >&2
-	# "$@" || die -n "${*} failed"
-}
-
-src_install() {
-	dobin ollama
-
-	cmake_src_install
-
-	newinitd "${FILESDIR}/ollama.init" "${PN}"
-	newconfd "${FILESDIR}/ollama.confd" "${PN}"
-
-	systemd_dounit "${FILESDIR}/ollama.service"
-}
-
-pkg_preinst() {
-	keepdir /var/log/ollama
-	fperms 750 /var/log/ollama
-	fowners "${PN}:${PN}" /var/log/ollama
-}
-
-pkg_postinst() {
-	if [[ -z ${REPLACING_VERSIONS} ]] ; then
-		einfo "Quick guide:"
-		einfo "\tollama serve"
-		einfo "\tollama run llama3:70b"
-		einfo
-		einfo "See available models at https://ollama.com/library"
-	fi
-}


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/
@ 2025-04-28 18:52 Paul Zander
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Zander @ 2025-04-28 18:52 UTC (permalink / raw
  To: gentoo-commits

commit:     e92cad7ec294d72b3435e5f3aaa52a48da3c57a5
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Sun Apr 27 14:20:05 2025 +0000
Commit:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
CommitDate: Mon Apr 28 18:48:24 2025 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=e92cad7e

sci-ml/ollama: add 0.6.6

Closes: https://bugs.gentoo.org/954399
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>

 sci-ml/ollama/Manifest                                    | 2 ++
 sci-ml/ollama/{ollama-9999.ebuild => ollama-0.6.6.ebuild} | 2 ++
 sci-ml/ollama/ollama-9999.ebuild                          | 3 +++
 3 files changed, 7 insertions(+)

diff --git a/sci-ml/ollama/Manifest b/sci-ml/ollama/Manifest
index c8ac3ffaf..4ab89af65 100644
--- a/sci-ml/ollama/Manifest
+++ b/sci-ml/ollama/Manifest
@@ -1,2 +1,4 @@
 DIST ollama-0.6.5-vendor.tar.xz 4416776 BLAKE2B be4ad1df96e17d94d5bd8464113d95518173aeccb998a22ee3bffb8788019b520f18a141d1e1e9c594295c9c4d20a9064eb86905c44520da00f170f769b11fed SHA512 ca8eb19061e6772d79f4f531d610692837334046d906a1c500202bafc3ae48b4c181c9d8a3f79b273bc5e8616012117f7ae248d3505d74bda3db942386923662
 DIST ollama-0.6.5.gh.tar.gz 7964755 BLAKE2B af059b433e28766988f7a4097fd2774d17331282ea670c588d69d69865b73f5460d0c9d271154228bb1e3488ccbe7fe785ed637acb88fb51f1efb5efed905ac6 SHA512 dc97098b51f215ec5259aece5872fe213aa7b413344aab30b6417754e15f9ce27d2515dd9134edf620d70b8af88d3de5d305ea4020adb7d281b268d26b672adf
+DIST ollama-0.6.6-vendor.tar.xz 4411192 BLAKE2B 49eb6a51eba9faed05a61cb4769d4696a936b8fec65be56c6b5e95b59c8cfbb2505e1e3a1a15baeed7eac4a2651f4965eb4a70ba7ba36ae8b18955d305e450aa SHA512 319352dcb98195723800da3d5eb3bf12de521a7634a2a484d3d4b89f8e6661fff760bccef734a083f6b81bc837996f043fdbd2d7d1d9dcca5a069ede02f37592
+DIST ollama-0.6.6.gh.tar.gz 8290979 BLAKE2B 3082cca4e9a9e690f792d8286888b4141fe7ada2b91a703503a0330f9da29a80bc29ac78b1308e5276868bd125f4fe68d644fba47ec930fe1373a850373f49d9 SHA512 83df0cd3c76d771d4486ecf9a6789287c309d4b99a0e1e2d2d895f4527592f219b06eb695d4cfc0b4f37446aa26883a407eecfd00ac043355e406ca919d7032b

diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-0.6.6.ebuild
similarity index 98%
copy from sci-ml/ollama/ollama-9999.ebuild
copy to sci-ml/ollama/ollama-0.6.6.ebuild
index 79bdf486b..8b736f59f 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-0.6.6.ebuild
@@ -232,6 +232,8 @@ src_configure() {
 		mycmakeargs+=(
 			-DCMAKE_HIP_ARCHITECTURES="$(get_amdgpu_flags)"
 			-DCMAKE_HIP_PLATFORM="amd"
+			# ollama doesn't honor the default cmake options
+			-DAMDGPU_TARGETS="$(get_amdgpu_flags)"
 		)
 
 		local -x HIP_PATH="${ESYSROOT}/usr"

diff --git a/sci-ml/ollama/ollama-9999.ebuild b/sci-ml/ollama/ollama-9999.ebuild
index 79bdf486b..fcfb09625 100644
--- a/sci-ml/ollama/ollama-9999.ebuild
+++ b/sci-ml/ollama/ollama-9999.ebuild
@@ -222,6 +222,7 @@ src_configure() {
 		CUDAHOSTLD="$(tc-getCXX)"
 
 		cuda_add_sandbox -w
+		addpredict "/dev/char/"
 	else
 		mycmakeargs+=(
 			-DCMAKE_CUDA_COMPILER="NOTFOUND"
@@ -232,6 +233,8 @@ src_configure() {
 		mycmakeargs+=(
 			-DCMAKE_HIP_ARCHITECTURES="$(get_amdgpu_flags)"
 			-DCMAKE_HIP_PLATFORM="amd"
+			# ollama doesn't honor the default cmake options
+			-DAMDGPU_TARGETS="$(get_amdgpu_flags)"
 		)
 
 		local -x HIP_PATH="${ESYSROOT}/usr"


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-04-28 18:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07 18:22 [gentoo-commits] repo/proj/guru:dev commit in: sci-ml/ollama/ Paul Zander
  -- strict thread matches above, loose matches on Subject: below --
2025-04-28 18:52 Paul Zander
2025-04-16 12:24 Paul Zander
2025-04-16 12:24 Paul Zander
2025-04-16 12:24 Paul Zander
2025-04-10 21:48 Paul Zander
2025-04-07 18:22 Paul Zander
2025-04-07 18:22 Paul Zander

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox