speed up tests by only building static lib (#4740)
This commit is contained in:
parent
eb2c443a79
commit
7ca9605f54
2 changed files with 46 additions and 41 deletions
2
.github/workflows/test.yaml
vendored
2
.github/workflows/test.yaml
vendored
|
@ -287,6 +287,8 @@ jobs:
|
||||||
GOARCH: ${{ matrix.arch }}
|
GOARCH: ${{ matrix.arch }}
|
||||||
CGO_ENABLED: '1'
|
CGO_ENABLED: '1'
|
||||||
OLLAMA_CPU_TARGET: 'static'
|
OLLAMA_CPU_TARGET: 'static'
|
||||||
|
OLLAMA_SKIP_CPU_GENERATE: '1'
|
||||||
|
OLLAMA_SKIP_METAL_GENERATE: '1'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -32,42 +32,43 @@ case "${GOARCH}" in
|
||||||
echo "Building static library"
|
echo "Building static library"
|
||||||
build
|
build
|
||||||
|
|
||||||
|
if [ -z "$OLLAMA_SKIP_CPU_GENERATE" ]; then
|
||||||
|
#
|
||||||
|
# CPU first for the default library, set up as lowest common denominator for maximum compatibility (including Rosetta)
|
||||||
|
#
|
||||||
|
init_vars
|
||||||
|
CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_ACCELERATE=off -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}"
|
||||||
|
BUILD_DIR="../build/darwin/${ARCH}/cpu"
|
||||||
|
echo "Building LCD CPU"
|
||||||
|
build
|
||||||
|
sign ${BUILD_DIR}/bin/ollama_llama_server
|
||||||
|
compress
|
||||||
|
|
||||||
#
|
#
|
||||||
# CPU first for the default library, set up as lowest common denominator for maximum compatibility (including Rosetta)
|
# ~2011 CPU Dynamic library with more capabilities turned on to optimize performance
|
||||||
#
|
# Approximately 400% faster than LCD on same CPU
|
||||||
init_vars
|
#
|
||||||
CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_ACCELERATE=off -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}"
|
init_vars
|
||||||
BUILD_DIR="../build/darwin/${ARCH}/cpu"
|
CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_ACCELERATE=off -DLLAMA_AVX=on -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}"
|
||||||
echo "Building LCD CPU"
|
BUILD_DIR="../build/darwin/${ARCH}/cpu_avx"
|
||||||
build
|
echo "Building AVX CPU"
|
||||||
sign ${BUILD_DIR}/bin/ollama_llama_server
|
build
|
||||||
compress
|
sign ${BUILD_DIR}/bin/ollama_llama_server
|
||||||
|
compress
|
||||||
|
|
||||||
#
|
#
|
||||||
# ~2011 CPU Dynamic library with more capabilities turned on to optimize performance
|
# ~2013 CPU Dynamic library
|
||||||
# Approximately 400% faster than LCD on same CPU
|
# Approximately 10% faster than AVX on same CPU
|
||||||
#
|
#
|
||||||
init_vars
|
init_vars
|
||||||
CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_ACCELERATE=off -DLLAMA_AVX=on -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}"
|
CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_ACCELERATE=on -DLLAMA_AVX=on -DLLAMA_AVX2=on -DLLAMA_AVX512=off -DLLAMA_FMA=on -DLLAMA_F16C=on ${CMAKE_DEFS}"
|
||||||
BUILD_DIR="../build/darwin/${ARCH}/cpu_avx"
|
BUILD_DIR="../build/darwin/${ARCH}/cpu_avx2"
|
||||||
echo "Building AVX CPU"
|
echo "Building AVX2 CPU"
|
||||||
build
|
EXTRA_LIBS="${EXTRA_LIBS} -framework Accelerate -framework Foundation"
|
||||||
sign ${BUILD_DIR}/bin/ollama_llama_server
|
build
|
||||||
compress
|
sign ${BUILD_DIR}/bin/ollama_llama_server
|
||||||
|
compress
|
||||||
#
|
fi
|
||||||
# ~2013 CPU Dynamic library
|
|
||||||
# Approximately 10% faster than AVX on same CPU
|
|
||||||
#
|
|
||||||
init_vars
|
|
||||||
CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_ACCELERATE=on -DLLAMA_AVX=on -DLLAMA_AVX2=on -DLLAMA_AVX512=off -DLLAMA_FMA=on -DLLAMA_F16C=on ${CMAKE_DEFS}"
|
|
||||||
BUILD_DIR="../build/darwin/${ARCH}/cpu_avx2"
|
|
||||||
echo "Building AVX2 CPU"
|
|
||||||
EXTRA_LIBS="${EXTRA_LIBS} -framework Accelerate -framework Foundation"
|
|
||||||
build
|
|
||||||
sign ${BUILD_DIR}/bin/ollama_llama_server
|
|
||||||
compress
|
|
||||||
;;
|
;;
|
||||||
"arm64")
|
"arm64")
|
||||||
|
|
||||||
|
@ -79,13 +80,15 @@ case "${GOARCH}" in
|
||||||
echo "Building static library"
|
echo "Building static library"
|
||||||
build
|
build
|
||||||
|
|
||||||
init_vars
|
if [ -z "$OLLAMA_SKIP_METAL_GENERATE" ]; then
|
||||||
CMAKE_DEFS="${COMMON_DARWIN_DEFS} -DLLAMA_ACCELERATE=on -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_OSX_ARCHITECTURES=${ARCH} -DLLAMA_METAL=on ${CMAKE_DEFS}"
|
init_vars
|
||||||
BUILD_DIR="../build/darwin/${ARCH}/metal"
|
CMAKE_DEFS="${COMMON_DARWIN_DEFS} -DLLAMA_ACCELERATE=on -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_OSX_ARCHITECTURES=${ARCH} -DLLAMA_METAL=on ${CMAKE_DEFS}"
|
||||||
EXTRA_LIBS="${EXTRA_LIBS} -framework Accelerate -framework Foundation -framework Metal -framework MetalKit -framework MetalPerformanceShaders"
|
BUILD_DIR="../build/darwin/${ARCH}/metal"
|
||||||
build
|
EXTRA_LIBS="${EXTRA_LIBS} -framework Accelerate -framework Foundation -framework Metal -framework MetalKit -framework MetalPerformanceShaders"
|
||||||
sign ${BUILD_DIR}/bin/ollama_llama_server
|
build
|
||||||
compress
|
sign ${BUILD_DIR}/bin/ollama_llama_server
|
||||||
|
compress
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "GOARCH must be set"
|
echo "GOARCH must be set"
|
||||||
|
|
Loading…
Reference in a new issue