2023-11-29 19:00:37 +00:00
|
|
|
#!/bin/bash
|
2023-11-14 01:20:34 +00:00
|
|
|
# This script is intended to run inside the go generate
|
2024-01-04 17:40:15 +00:00
|
|
|
# working directory must be ./llm/generate/
|
2023-11-14 01:20:34 +00:00
|
|
|
|
|
|
|
# TODO - add hardening to detect missing tools (cmake, etc.)
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
set -o pipefail
|
|
|
|
echo "Starting darwin generate script"
|
|
|
|
source $(dirname $0)/gen_common.sh
|
|
|
|
init_vars
|
2024-01-04 00:22:15 +00:00
|
|
|
CMAKE_DEFS="-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DLLAMA_METAL=on -DLLAMA_ACCELERATE=on ${CMAKE_DEFS}"
|
2024-01-04 17:40:15 +00:00
|
|
|
BUILD_DIR="${LLAMACPP_DIR}/build/darwin/metal"
|
2023-11-14 01:20:34 +00:00
|
|
|
case "${GOARCH}" in
|
2023-12-22 17:51:53 +00:00
|
|
|
"amd64")
|
2024-01-04 00:22:15 +00:00
|
|
|
CMAKE_DEFS="-DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_OSX_ARCHITECTURES=x86_64 -DLLAMA_NATIVE=off -DLLAMA_AVX=on -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}"
|
2023-12-22 17:51:53 +00:00
|
|
|
;;
|
|
|
|
"arm64")
|
|
|
|
CMAKE_DEFS="-DCMAKE_SYSTEM_PROCESSOR=arm64 -DCMAKE_OSX_ARCHITECTURES=arm64 ${CMAKE_DEFS}"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "GOARCH must be set"
|
|
|
|
echo "this script is meant to be run from within go generate"
|
|
|
|
exit 1
|
|
|
|
;;
|
2023-11-14 01:20:34 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
git_module_setup
|
|
|
|
apply_patches
|
2023-12-22 17:51:53 +00:00
|
|
|
build
|
2023-12-23 19:35:44 +00:00
|
|
|
install
|
2023-12-22 17:51:53 +00:00
|
|
|
cleanup
|