sci-ml/ollama: 9999 refactor blas handling

Use code for potential `blas-utils.eclass`.
Correctly forwarding the flexiblas dep to virtual/blas should fix failing
`BLAS=Generic` case.

Closes: https://bugs.gentoo.org/969379
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
This commit is contained in:
Paul Zander
2026-02-21 21:05:38 +01:00
parent 047e5d7e2b
commit c7c3e7b58a
2 changed files with 39 additions and 4 deletions

View File

@@ -6,8 +6,11 @@
<name>Paul Zander</name>
</maintainer>
<use>
<flag name="blis">Use <pkg>sci-libs/blis</pkg> as blas provider</flag>
<flag name="cuda">Enable NVIDIA CUDA support</flag>
<flag name="flexiblas">Use <pkg>sci-libs/flexiblas</pkg> as blas provider</flag>
<flag name="mkl">Use <pkg>sci-libs/mkl</pkg> for blas, lapack and sparse blas routines</flag>
<flag name="openblas">Use <pkg>sci-libs/openblas</pkg> as blas provider</flag>
<flag name="rocm">Enable ROCm gpu computing support</flag>
</use>
<upstream>

View File

@@ -26,9 +26,15 @@ fi
LICENSE="MIT"
SLOT="0"
IUSE="blas cuda rocm mkl vulkan"
IUSE="cuda rocm vulkan"
# IUSE+=" opencl"
BLAS_BACKENDS="blis mkl openblas"
BLAS_REQUIRED_USE="blas? ( ?? ( ${BLAS_BACKENDS} ) )"
IUSE+=" blas flexiblas ${BLAS_BACKENDS}"
REQUIRED_USE+=" ${BLAS_REQUIRED_USE}"
declare -rgA CPU_FEATURES=(
[AVX2]="x86"
[AVX512F]="x86"
@@ -51,14 +57,24 @@ add_cpu_features_use
RESTRICT="mirror test"
# FindBLAS.cmake
# If Fortran is an enabled compiler it sets BLAS_mkl_THREADING to gnu. -> sci-libs/mkl[gnu-openmp]
# If Fortran is not an enabled compiler it sets BLAS_mkl_THREADING to intel. -> sci-libs/mkl[llvm-openmp]
COMMON_DEPEND="
blas? (
!mkl? (
virtual/blas
blis? (
sci-libs/blis:=
)
flexiblas? (
sci-libs/flexiblas[blis?,mkl?,openblas?]
)
mkl? (
sci-libs/mkl[llvm-openmp]
)
openblas? (
sci-libs/openblas
)
virtual/blas[flexiblas=]
)
cuda? (
dev-util/nvidia-cuda-toolkit:=
@@ -264,10 +280,26 @@ src_configure() {
)
if use blas; then
if use mkl; then
if use flexiblas ; then
mycmakeargs+=(
-DGGML_BLAS_VENDOR="FlexiBLAS"
)
elif use blis ; then
mycmakeargs+=(
-DGGML_BLAS_VENDOR="FLAME"
)
elif use mkl ; then
mycmakeargs+=(
-DGGML_BLAS_VENDOR="Intel10_64lp"
)
# elif use nvhpc ; then
# mycmakeargs+=(
# -DGGML_BLAS_VENDOR="NVHPC"
# )
elif use openblas ; then
mycmakeargs+=(
-DGGML_BLAS_VENDOR="OpenBLAS"
)
else
mycmakeargs+=(
-DGGML_BLAS_VENDOR="Generic"