Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
fda0d3be
Unverified
Commit
fda0d3be
authored
Sep 12, 2024
by
Daniel Hiltgen
Committed by
GitHub
Sep 12, 2024
Browse files
Use GOARCH for build dirs (#6779)
Corrects x86_64 vs amd64 discrepancy
parent
cd5c8f64
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
llm/generate/gen_darwin.sh
llm/generate/gen_darwin.sh
+4
-4
llm/generate/gen_linux.sh
llm/generate/gen_linux.sh
+8
-8
No files found.
llm/generate/gen_darwin.sh
View file @
fda0d3be
...
@@ -40,7 +40,7 @@ case "${GOARCH}" in
...
@@ -40,7 +40,7 @@ case "${GOARCH}" in
init_vars
init_vars
CMAKE_DEFS
=
"
${
COMMON_CPU_DEFS
}
-DGGML_ACCELERATE=off -DGGML_BLAS=off -DGGML_AVX=off -DGGML_AVX2=off -DGGML_AVX512=off -DGGML_FMA=off -DGGML_F16C=off
${
CMAKE_DEFS
}
"
CMAKE_DEFS
=
"
${
COMMON_CPU_DEFS
}
-DGGML_ACCELERATE=off -DGGML_BLAS=off -DGGML_AVX=off -DGGML_AVX2=off -DGGML_AVX512=off -DGGML_FMA=off -DGGML_F16C=off
${
CMAKE_DEFS
}
"
RUNNER
=
cpu
RUNNER
=
cpu
BUILD_DIR
=
"../build/darwin/
${
ARCH
}
/
${
RUNNER
}
"
BUILD_DIR
=
"../build/darwin/
${
GO
ARCH
}
/
${
RUNNER
}
"
echo
"Building LCD CPU"
echo
"Building LCD CPU"
build
build
sign
${
BUILD_DIR
}
/bin/ollama_llama_server
sign
${
BUILD_DIR
}
/bin/ollama_llama_server
...
@@ -53,7 +53,7 @@ case "${GOARCH}" in
...
@@ -53,7 +53,7 @@ case "${GOARCH}" in
init_vars
init_vars
CMAKE_DEFS
=
"
${
COMMON_CPU_DEFS
}
-DGGML_ACCELERATE=off -DGGML_BLAS=off -DGGML_AVX=on -DGGML_AVX2=off -DGGML_AVX512=off -DGGML_FMA=off -DGGML_F16C=off
${
CMAKE_DEFS
}
"
CMAKE_DEFS
=
"
${
COMMON_CPU_DEFS
}
-DGGML_ACCELERATE=off -DGGML_BLAS=off -DGGML_AVX=on -DGGML_AVX2=off -DGGML_AVX512=off -DGGML_FMA=off -DGGML_F16C=off
${
CMAKE_DEFS
}
"
RUNNER
=
cpu_avx
RUNNER
=
cpu_avx
BUILD_DIR
=
"../build/darwin/
${
ARCH
}
/
${
RUNNER
}
"
BUILD_DIR
=
"../build/darwin/
${
GO
ARCH
}
/
${
RUNNER
}
"
echo
"Building AVX CPU"
echo
"Building AVX CPU"
build
build
sign
${
BUILD_DIR
}
/bin/ollama_llama_server
sign
${
BUILD_DIR
}
/bin/ollama_llama_server
...
@@ -66,7 +66,7 @@ case "${GOARCH}" in
...
@@ -66,7 +66,7 @@ case "${GOARCH}" in
init_vars
init_vars
CMAKE_DEFS
=
"
${
COMMON_CPU_DEFS
}
-DGGML_ACCELERATE=on -DGGML_BLAS=off -DGGML_AVX=on -DGGML_AVX2=on -DGGML_AVX512=off -DGGML_FMA=on -DGGML_F16C=on
${
CMAKE_DEFS
}
"
CMAKE_DEFS
=
"
${
COMMON_CPU_DEFS
}
-DGGML_ACCELERATE=on -DGGML_BLAS=off -DGGML_AVX=on -DGGML_AVX2=on -DGGML_AVX512=off -DGGML_FMA=on -DGGML_F16C=on
${
CMAKE_DEFS
}
"
RUNNER
=
cpu_avx2
RUNNER
=
cpu_avx2
BUILD_DIR
=
"../build/darwin/
${
ARCH
}
/
${
RUNNER
}
"
BUILD_DIR
=
"../build/darwin/
${
GO
ARCH
}
/
${
RUNNER
}
"
echo
"Building AVX2 CPU"
echo
"Building AVX2 CPU"
EXTRA_LIBS
=
"
${
EXTRA_LIBS
}
-framework Accelerate -framework Foundation"
EXTRA_LIBS
=
"
${
EXTRA_LIBS
}
-framework Accelerate -framework Foundation"
build
build
...
@@ -88,7 +88,7 @@ case "${GOARCH}" in
...
@@ -88,7 +88,7 @@ case "${GOARCH}" in
init_vars
init_vars
CMAKE_DEFS
=
"
${
COMMON_DARWIN_DEFS
}
-DCMAKE_SYSTEM_PROCESSOR=
${
ARCH
}
-DCMAKE_OSX_ARCHITECTURES=
${
ARCH
}
${
CMAKE_DEFS
}
"
CMAKE_DEFS
=
"
${
COMMON_DARWIN_DEFS
}
-DCMAKE_SYSTEM_PROCESSOR=
${
ARCH
}
-DCMAKE_OSX_ARCHITECTURES=
${
ARCH
}
${
CMAKE_DEFS
}
"
RUNNER
=
"metal"
RUNNER
=
"metal"
BUILD_DIR
=
"../build/darwin/
${
ARCH
}
/
${
RUNNER
}
"
BUILD_DIR
=
"../build/darwin/
${
GO
ARCH
}
/
${
RUNNER
}
"
EXTRA_LIBS
=
"
${
EXTRA_LIBS
}
-framework Accelerate -framework Foundation -framework Metal -framework MetalKit -framework MetalPerformanceShaders"
EXTRA_LIBS
=
"
${
EXTRA_LIBS
}
-framework Accelerate -framework Foundation -framework Metal -framework MetalKit -framework MetalPerformanceShaders"
build
build
sign
${
BUILD_DIR
}
/bin/ollama_llama_server
sign
${
BUILD_DIR
}
/bin/ollama_llama_server
...
...
llm/generate/gen_linux.sh
View file @
fda0d3be
...
@@ -80,7 +80,7 @@ if [ -z "${OLLAMA_SKIP_CPU_GENERATE}" ]; then
...
@@ -80,7 +80,7 @@ if [ -z "${OLLAMA_SKIP_CPU_GENERATE}" ]; then
echo
"OLLAMA_CUSTOM_CPU_DEFS=
\"
${
OLLAMA_CUSTOM_CPU_DEFS
}
\"
"
echo
"OLLAMA_CUSTOM_CPU_DEFS=
\"
${
OLLAMA_CUSTOM_CPU_DEFS
}
\"
"
CMAKE_DEFS
=
"
${
OLLAMA_CUSTOM_CPU_DEFS
}
-DBUILD_SHARED_LIBS=on -DCMAKE_POSITION_INDEPENDENT_CODE=on
${
CMAKE_DEFS
}
"
CMAKE_DEFS
=
"
${
OLLAMA_CUSTOM_CPU_DEFS
}
-DBUILD_SHARED_LIBS=on -DCMAKE_POSITION_INDEPENDENT_CODE=on
${
CMAKE_DEFS
}
"
RUNNER
=
"cpu"
RUNNER
=
"cpu"
BUILD_DIR
=
"../build/linux/
${
ARCH
}
/
${
RUNNER
}
"
BUILD_DIR
=
"../build/linux/
${
GO
ARCH
}
/
${
RUNNER
}
"
echo
"Building custom CPU"
echo
"Building custom CPU"
build
build
install
install
...
@@ -105,7 +105,7 @@ if [ -z "${OLLAMA_SKIP_CPU_GENERATE}" ]; then
...
@@ -105,7 +105,7 @@ if [ -z "${OLLAMA_SKIP_CPU_GENERATE}" ]; then
init_vars
init_vars
CMAKE_DEFS
=
"
${
COMMON_CPU_DEFS
}
-DGGML_AVX=off -DGGML_AVX2=off -DGGML_AVX512=off -DGGML_FMA=off -DGGML_F16C=off
${
CMAKE_DEFS
}
"
CMAKE_DEFS
=
"
${
COMMON_CPU_DEFS
}
-DGGML_AVX=off -DGGML_AVX2=off -DGGML_AVX512=off -DGGML_FMA=off -DGGML_F16C=off
${
CMAKE_DEFS
}
"
RUNNER
=
cpu
RUNNER
=
cpu
BUILD_DIR
=
"../build/linux/
${
ARCH
}
/
${
RUNNER
}
"
BUILD_DIR
=
"../build/linux/
${
GO
ARCH
}
/
${
RUNNER
}
"
echo
"Building LCD CPU"
echo
"Building LCD CPU"
build
build
install
install
...
@@ -125,7 +125,7 @@ if [ -z "${OLLAMA_SKIP_CPU_GENERATE}" ]; then
...
@@ -125,7 +125,7 @@ if [ -z "${OLLAMA_SKIP_CPU_GENERATE}" ]; then
init_vars
init_vars
CMAKE_DEFS
=
"
${
COMMON_CPU_DEFS
}
-DGGML_AVX=on -DGGML_AVX2=off -DGGML_AVX512=off -DGGML_FMA=off -DGGML_F16C=off
${
CMAKE_DEFS
}
"
CMAKE_DEFS
=
"
${
COMMON_CPU_DEFS
}
-DGGML_AVX=on -DGGML_AVX2=off -DGGML_AVX512=off -DGGML_FMA=off -DGGML_F16C=off
${
CMAKE_DEFS
}
"
RUNNER
=
cpu_avx
RUNNER
=
cpu_avx
BUILD_DIR
=
"../build/linux/
${
ARCH
}
/
${
RUNNER
}
"
BUILD_DIR
=
"../build/linux/
${
GO
ARCH
}
/
${
RUNNER
}
"
echo
"Building AVX CPU"
echo
"Building AVX CPU"
build
build
install
install
...
@@ -141,7 +141,7 @@ if [ -z "${OLLAMA_SKIP_CPU_GENERATE}" ]; then
...
@@ -141,7 +141,7 @@ if [ -z "${OLLAMA_SKIP_CPU_GENERATE}" ]; then
init_vars
init_vars
CMAKE_DEFS
=
"
${
COMMON_CPU_DEFS
}
-DGGML_AVX=on -DGGML_AVX2=on -DGGML_AVX512=off -DGGML_FMA=on -DGGML_F16C=on
${
CMAKE_DEFS
}
"
CMAKE_DEFS
=
"
${
COMMON_CPU_DEFS
}
-DGGML_AVX=on -DGGML_AVX2=on -DGGML_AVX512=off -DGGML_FMA=on -DGGML_F16C=on
${
CMAKE_DEFS
}
"
RUNNER
=
cpu_avx2
RUNNER
=
cpu_avx2
BUILD_DIR
=
"../build/linux/
${
ARCH
}
/
${
RUNNER
}
"
BUILD_DIR
=
"../build/linux/
${
GO
ARCH
}
/
${
RUNNER
}
"
echo
"Building AVX2 CPU"
echo
"Building AVX2 CPU"
build
build
install
install
...
@@ -196,7 +196,7 @@ if [ -z "${OLLAMA_SKIP_CUDA_GENERATE}" -a -d "${CUDA_LIB_DIR}" ]; then
...
@@ -196,7 +196,7 @@ if [ -z "${OLLAMA_SKIP_CUDA_GENERATE}" -a -d "${CUDA_LIB_DIR}" ]; then
export
CUDAFLAGS
=
"-t8"
export
CUDAFLAGS
=
"-t8"
CMAKE_DEFS
=
"
${
COMMON_CMAKE_DEFS
}
${
CMAKE_DEFS
}
${
ARM64_DEFS
}
${
CMAKE_CUDA_DEFS
}
-DGGML_STATIC=off"
CMAKE_DEFS
=
"
${
COMMON_CMAKE_DEFS
}
${
CMAKE_DEFS
}
${
ARM64_DEFS
}
${
CMAKE_CUDA_DEFS
}
-DGGML_STATIC=off"
RUNNER
=
cuda
${
CUDA_VARIANT
}
RUNNER
=
cuda
${
CUDA_VARIANT
}
BUILD_DIR
=
"../build/linux/
${
ARCH
}
/
${
RUNNER
}
"
BUILD_DIR
=
"../build/linux/
${
GO
ARCH
}
/
${
RUNNER
}
"
export
LLAMA_SERVER_LDFLAGS
=
"-L
${
CUDA_LIB_DIR
}
-lcudart -lcublas -lcublasLt -lcuda"
export
LLAMA_SERVER_LDFLAGS
=
"-L
${
CUDA_LIB_DIR
}
-lcudart -lcublas -lcublasLt -lcuda"
CUDA_DIST_DIR
=
"
${
CUDA_DIST_DIR
:-${
DIST_BASE
}
/lib/ollama
}
"
CUDA_DIST_DIR
=
"
${
CUDA_DIST_DIR
:-${
DIST_BASE
}
/lib/ollama
}
"
build
build
...
@@ -223,7 +223,7 @@ if [ -z "${OLLAMA_SKIP_ONEAPI_GENERATE}" -a -d "${ONEAPI_ROOT}" ]; then
...
@@ -223,7 +223,7 @@ if [ -z "${OLLAMA_SKIP_ONEAPI_GENERATE}" -a -d "${ONEAPI_ROOT}" ]; then
CC
=
icx
CC
=
icx
CMAKE_DEFS
=
"
${
COMMON_CMAKE_DEFS
}
${
CMAKE_DEFS
}
-DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DGGML_SYCL=ON -DGGML_SYCL_F16=OFF"
CMAKE_DEFS
=
"
${
COMMON_CMAKE_DEFS
}
${
CMAKE_DEFS
}
-DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DGGML_SYCL=ON -DGGML_SYCL_F16=OFF"
RUNNER
=
oneapi
RUNNER
=
oneapi
BUILD_DIR
=
"../build/linux/
${
ARCH
}
/
${
RUNNER
}
"
BUILD_DIR
=
"../build/linux/
${
GO
ARCH
}
/
${
RUNNER
}
"
ONEAPI_DIST_DIR
=
"
${
DIST_BASE
}
/lib/ollama"
ONEAPI_DIST_DIR
=
"
${
DIST_BASE
}
/lib/ollama"
export
LLAMA_SERVER_LDFLAGS
=
"-fsycl -lOpenCL -lmkl_core -lmkl_sycl_blas -lmkl_intel_ilp64 -lmkl_tbb_thread -ltbb"
export
LLAMA_SERVER_LDFLAGS
=
"-fsycl -lOpenCL -lmkl_core -lmkl_sycl_blas -lmkl_intel_ilp64 -lmkl_tbb_thread -ltbb"
DEBUG_FLAGS
=
""
# icx compiles with -O0 if we pass -g, so we must remove it
DEBUG_FLAGS
=
""
# icx compiles with -O0 if we pass -g, so we must remove it
...
@@ -272,7 +272,7 @@ if [ -z "${OLLAMA_SKIP_ROCM_GENERATE}" -a -d "${ROCM_PATH}" ]; then
...
@@ -272,7 +272,7 @@ if [ -z "${OLLAMA_SKIP_ROCM_GENERATE}" -a -d "${ROCM_PATH}" ]; then
echo
"Building custom ROCM GPU"
echo
"Building custom ROCM GPU"
fi
fi
RUNNER
=
rocm
${
ROCM_VARIANT
}
RUNNER
=
rocm
${
ROCM_VARIANT
}
BUILD_DIR
=
"../build/linux/
${
ARCH
}
/
${
RUNNER
}
"
BUILD_DIR
=
"../build/linux/
${
GO
ARCH
}
/
${
RUNNER
}
"
# ROCm dependencies are too large to fit into a unified bundle
# ROCm dependencies are too large to fit into a unified bundle
ROCM_DIST_DIR
=
"
${
DIST_BASE
}
/../linux-
${
GOARCH
}
-rocm/lib/ollama"
ROCM_DIST_DIR
=
"
${
DIST_BASE
}
/../linux-
${
GOARCH
}
-rocm/lib/ollama"
# TODO figure out how to disable runpath (rpath)
# TODO figure out how to disable runpath (rpath)
...
@@ -282,7 +282,7 @@ if [ -z "${OLLAMA_SKIP_ROCM_GENERATE}" -a -d "${ROCM_PATH}" ]; then
...
@@ -282,7 +282,7 @@ if [ -z "${OLLAMA_SKIP_ROCM_GENERATE}" -a -d "${ROCM_PATH}" ]; then
# copy the ROCM dependencies
# copy the ROCM dependencies
mkdir
-p
"
${
ROCM_DIST_DIR
}
"
mkdir
-p
"
${
ROCM_DIST_DIR
}
"
for
dep
in
$(
ldd
"
${
BUILD_DIR
}
/bin/ollama_llama_server"
|
grep
"=>"
|
cut
-f2
-d
=
|
cut
-f2
-d
' '
|
grep
-v
"
${
ARCH
}
/rocm
${
ROCM_VARIANT
}
"
|
grep
-e
rocm
-e
amdgpu
-e
libtinfo
-e
libnuma
-e
libelf
)
;
do
for
dep
in
$(
ldd
"
${
BUILD_DIR
}
/bin/ollama_llama_server"
|
grep
"=>"
|
cut
-f2
-d
=
|
cut
-f2
-d
' '
|
grep
-v
"
${
GO
ARCH
}
/rocm
${
ROCM_VARIANT
}
"
|
grep
-e
rocm
-e
amdgpu
-e
libtinfo
-e
libnuma
-e
libelf
)
;
do
cp
-a
"
${
dep
}
"
*
"
${
ROCM_DIST_DIR
}
"
cp
-a
"
${
dep
}
"
*
"
${
ROCM_DIST_DIR
}
"
if
[
$(
readlink
-f
"
${
dep
}
"
)
!=
"
${
dep
}
"
]
;
then
if
[
$(
readlink
-f
"
${
dep
}
"
)
!=
"
${
dep
}
"
]
;
then
cp
$(
readlink
-f
"
${
dep
}
"
)
"
${
ROCM_DIST_DIR
}
"
cp
$(
readlink
-f
"
${
dep
}
"
)
"
${
ROCM_DIST_DIR
}
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment