File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ arch=${1:? target architecture is required}
5+ build_type=${2-}
6+
7+ # GPU arm64 base images do not consistently provide the gcc-14 toolchain needed
8+ # to compile ggml's armv9.2 CPU variants. Keep their portable fallback until the
9+ # builder images can supply that compiler.
10+ if [ " $arch " = " arm64" ] && [ -n " $build_type " ]; then
11+ echo turboquant-fallback
12+ else
13+ echo turboquant-cpu-all
14+ fi
Original file line number Diff line number Diff line change 1919
2020cd /LocalAI/backend/cpp/turboquant
2121
22- if [ -z " ${BUILD_TYPE:- } " ]; then
23- # Pure CPU image: one ggml CPU_ALL_VARIANTS build replaces the per-microarch binaries.
22+ BUILD_TARGET=$( /LocalAI/.docker/turboquant-build-target.sh " ${TARGETARCH} " " ${BUILD_TYPE:- } " )
23+ if [ " $BUILD_TARGET " = " turboquant-cpu-all" ]; then
24+ # BUILD_TYPE remains in the environment, so GPU builds retain their accelerator while
25+ # ggml selects the best CPU library when model work is offloaded to the host.
2426 # arm64: the armv9.2 SME variants need gcc-14 (gcc-13 rejects +sme).
2527 if [ " ${TARGETARCH} " = " arm64" ]; then
28+ sh /LocalAI/.docker/apt-mirror.sh || true
2629 apt-get update -qq && apt-get install -y -qq gcc-14 g++-14
2730 export CC=gcc-14 CXX=g++-14
2831 fi
29- make turboquant-cpu-all
30- else
31- # GPU build (cublas/hipblas/sycl/vulkan/...): single fallback CPU build, the accelerator
32- # does the compute. Keeps the GPU compile from also building the CPU variant matrix and
33- # avoids the gcc-14 apt step on GPU base images such as nvidia l4t.
34- make turboquant-fallback
3532fi
33+ make " $BUILD_TARGET "
3634make turboquant-grpc
3735make turboquant-rpc-server
3836
Original file line number Diff line number Diff line change @@ -12,9 +12,11 @@ grep -e "flags" /proc/cpuinfo | head -1
1212
1313BINARY=turboquant-fallback
1414
15- # x86/arm64 ship a single turboquant-cpu-all built with ggml CPU_ALL_VARIANTS: ggml's
15+ # CPU images and x86 GPU images ship a single turboquant-cpu-all built with ggml
16+ # CPU_ALL_VARIANTS: ggml's
1617# backend registry dlopens the best libggml-cpu-*.so for this host, so no shell-side
17- # probing. ROCm ships only turboquant-fallback, so fall back to it when cpu-all is absent.
18+ # probing. GPU arm64 images still ship turboquant-fallback until their builder toolchains
19+ # support ggml's complete arm variant matrix.
1820if [ -e " $CURDIR " /turboquant-cpu-all ]; then
1921 BINARY=turboquant-cpu-all
2022fi
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ CURDIR=$( dirname " $( realpath " $0 " ) " )
5+ SELECTOR=" $CURDIR /../../.docker/turboquant-build-target.sh"
6+
7+ assert_target () {
8+ local arch=$1
9+ local build_type=$2
10+ local expected=$3
11+ local actual
12+
13+ actual=$( " $SELECTOR " " $arch " " $build_type " )
14+ if [ " $actual " != " $expected " ]; then
15+ echo " FAIL: $arch /$build_type selected $actual , expected $expected "
16+ exit 1
17+ fi
18+ }
19+
20+ assert_target amd64 cublas turboquant-cpu-all
21+ assert_target amd64 vulkan turboquant-cpu-all
22+ assert_target amd64 " " turboquant-cpu-all
23+ assert_target arm64 cublas turboquant-fallback
24+ assert_target arm64 " " turboquant-cpu-all
25+
26+ echo " PASS: turboquant build target preserves CPU variants where supported"
You can’t perform that action at this time.
0 commit comments