okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
b2de2641f
main
1#!/bin/bash 2# strata-split-N (the all-cards split engine, src/split, from sFNX, MIT, John Fink) for NVIDIA on Linux, built next to the release engine 3# so package_engine.py can ship it with `--include 'strata-split-*'` beside `strata`. One executable per card count and one architecture 4# (the engine refuses a card of any other architecture). RUNPATH $ORIGIN: it finds cudart/cublas beside itself. 5# 6# SRC=<checkout> B=<build dir> CUDA=/usr/local/cuda-13.1 [GG=<llama.cpp checkout, an override>] [ARCH=86] [CARDS="2"] [JOBS=8] packaging/build_split_cuda.sh 7# 8# ARCH is one compute capability; 86 is the one that has been run (2 RTX A6000). CARDS lists the counts to build; 3 and 4 build but have 9# not been run with the host exchange, and the launcher keeps them off unless a tester allows them (strata_control/split_engine.py). 10# After the build the script FAILS if the binary can call any CUDA peer-access function: the engine must not map one card into another. 11# Prints the binary paths, one per line, last. 12set -eu 13SRC =${ SRC :-$( cd " $( dirname " $ 0" ) /.." && pwd )} 14B =${ B :? B =<build dir>} 15CUDA =${ CUDA :? CUDA =<toolkit root>} 16GG =${ GG :-} # optional override (kept for two releases): a llama.cpp checkout to take ggml from; empty: the vendored third_party/strata-ggml 17ggml ="" ; [ -z" $ GG " ] ||ggml ="-DSTRATA_GGML_DIR= $ GG " 18ARCH =${ ARCH :-86} 19CARDS =${ CARDS :-2} 20JOBS =${ JOBS :-8} 21export PATH =$ CUDA /bin:$ PATH 22rm -f " $ B /CMakeCache.txt" 23cmake -G Ninja-S " $ SRC " -B " $ B " -DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_CUDA=ON -DSTRATA_BUILD_TESTS=OFF -DSTRATA_BUILD_SPLIT=ON \ 24"-DSTRATA_SPLIT_CARDS= ${ CARDS // /;} " -DSTRATA_SPLIT_ARCH= " $ ARCH " "-DCMAKE_CUDA_ARCHITECTURES= $ ARCH " -DCMAKE_CUDA_COMPILER= " $ CUDA /bin/nvcc" \ 25-DCUDAToolkit_ROOT= " $ CUDA " $ ggml -DSTRATA_NATIVE_EXPERTS=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ 26-DCMAKE_SKIP_BUILD_RPATH=OFF '-DCMAKE_INSTALL_RPATH=$ORIGIN' 27out ="" 28for n in $ CARDS ;do 29ninja -j " $ JOBS " -C " $ B " "strata-split- $ n " 30exe =$( find " $ B " -name "strata-split- $ n " -type f | head -1 ) 31 [ -x" $ exe " ] || {echo "build_split_cuda.sh: no strata-split- $ n " >&2;exit 1; } 32if nm -D --undefined-only " $ exe " | grep -qi peer;then 33echo "build_split_cuda.sh: $ exe can call a CUDA peer function:" >&2 34nm -D --undefined-only " $ exe " | grep -i peer >&2 35exit 1 36fi 37out =" $ out $ exe " $'\n' 38done 39printf '%s' " $ out "