okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge f-ds-out ac306afb2 into f-own-intaff3a132f

main
2.7 KiB48 linesraw
1#!/bin/sh
2# Build the Linux ARM64 CUDA engine package for the release feed, for the NVIDIA DGX Spark (GB10, sm_121).
3#
4#   COMMIT=<40 hex> packaging/build_cuda_linux_aarch64.sh
5#   SHAPE=q4_lite COMMIT=<40 hex> packaging/build_cuda_linux_aarch64.sh   # the engine of a model shape (packaging/shape_build.sh)
6#
7# Run it on the Spark (arm64 Linux, CUDA 13.0 toolkit, a Python 3 venv with requirements.txt and requirements-build.txt, cmake and
8# ninja on PATH; PYTHON=<that python>).  It runs spark/build_engine.sh, then makes the package in $OUT (default ./out-engine-cuda13-aarch64):
9#   <ver>-linux-aarch64-cuda-cuda13/       strata, libstrata_kq.so, strata-vision and the CUDA libraries  (feed member "engine")
10# Nothing is signed or uploaded: sign with packaging/feed_tool.py (sign-package, then pack-engine).
11#
12# PKGVER is the package version (default: the version in CMakeLists.txt); COMMIT names the source commit in the build id and is required
13# for a tree copy without .git.  The packages need glibc 2.39 or newer (Ubuntu 24.04, DGX OS 7): they are built on the Spark itself; there
14# is no older arm64 chroot to build in.
15set -eu
16repo=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd -P)
17py=${PYTHON:-python3}
18out=${OUT:-$repo/out-engine-cuda13-aarch64}
19mindriver=580.65
20case "$(uname -s)-$(uname -m)" in
21  Linux-aarch64|Linux-arm64) ;;
22  *) echo "build_cuda_linux_aarch64.sh: this builds on arm64 Linux (the DGX Spark)" >&2; exit 2 ;;
23esac
24cd "$repo"
25ver=${PKGVER:-$(sed -n 's/^[[:space:]]*project([^)]*VERSION[[:space:]]*\([0-9][0-9.]*\).*/\1/p' CMakeLists.txt | head -1)}
26commit=${COMMIT:-$(git rev-parse HEAD 2>/dev/null || true)}
27[ -n "$commit" ] || { echo "build_cuda_linux_aarch64.sh: set COMMIT=<hex> (no .git here)" >&2; exit 2; }
28export COMMIT=$commit
29. "$repo/packaging/shape_build.sh"; shape_setup "$repo"
30req=""
31if [ -n "${SHAPE:-}" ]; then req=$shape_pkg; fi
32stage=$(mktemp -d "${TMPDIR:-/tmp}/strata-engine-stage.XXXXXX")
33trap 'rm -rf "$stage"' EXIT
34OUT=$stage/engine BUILD_VISION=${BUILD_VISION:-1} sh spark/build_engine.sh
35shape_check "$stage/engine/strata"
36cudafull=$(sed -n 's/.*"cuda": "\([^"]*\)".*/\1/p' "$stage/engine/BUILD.json")
37id="release-${ver}-cuda13-${cudafull}-aarch64-$(printf '%s' "$commit" | cut -c1-12)"
38mkdir -p "$out"
39# the engine package
40"$py" packaging/package_engine.py --src "$stage/engine" --backend cuda --version "$ver" --out "$out" --arch sm_121 --arch compute_121 \
41    --min-driver nvidia=$mindriver --variant cuda13 --platform linux-aarch64 --build-id "$id" $req \
42    --include SYSTEM-LIBS.txt --include 'libstrata_kq*'
43for d in "$out"/*/; do
44  [ -f "$d/engine-component.json" ] || continue
45  "$py" packaging/package_engine.py --verify "$d"
46  "$py" packaging/binary_deps.py "$d"
47done
48echo "built: $out"