diff options
author | git user | 2024-05-12 12:11:01 +0200 |
---|---|---|
committer | git user | 2024-05-12 12:11:01 +0200 |
commit | 7e70d34c68a2d14b767501fa87062892bda10a9c (patch) | |
tree | 26a56e513cc108a064c375ae2c1f239f3a911b99 | |
parent | a7dc37fcaf4ff2b8b21100e83bf03891f2e3bb37 (diff) | |
download | aur-7e70d34c68a2d14b767501fa87062892bda10a9c.tar.gz |
Upstream version bump, and adapted `disable-rocm-cuda.gen_linux.sh.patch` accordingly.
-rw-r--r-- | .SRCINFO | 20 | ||||
-rw-r--r-- | PKGBUILD | 20 | ||||
-rw-r--r-- | disable-rocm-cuda.gen_linux.sh.patch | 158 |
3 files changed, 157 insertions, 41 deletions
@@ -1,6 +1,6 @@ pkgbase = ollama-nogpu-git pkgdesc = Create, run and share large language models (LLMs). Package(s) without dedicated GPU offloading (no CUDA, no ROCm, no SYCL). - pkgver = 0.1.32+1.r2377.20240416.9df6c85c + pkgver = 0.1.37+3.r2707.20240511.4ec7445a pkgrel = 1 url = https://github.com/jmorganca/ollama arch = armv7h @@ -26,7 +26,7 @@ pkgbase = ollama-nogpu-git source = tmpfiles.d b2sums = SKIP b2sums = SKIP - b2sums = 490289e7afe8720792a7890636737147041a1f60d91f70f1b39a758f75e00ebc21724a1beb4d6ec74b0ff868636c887953f50fffbb998edc56ab087fe9477bbb + b2sums = 02d92a87554f2842b100908395a2599a843d21b95bf2c1961c2d862c35dda906893af107460054bf02340c52e4b4e3baa80cf95d071968fb9e158e697edaf0c6 b2sums = a773bbf16cf5ccc2ee505ad77c3f9275346ddf412be283cfeaee7c2e4c41b8637a31aaff8766ed769524ebddc0c03cf924724452639b62208e578d98b9176124 b2sums = 3aabf135c4f18e1ad745ae8800db782b25b15305dfeaaa031b4501408ab7e7d01f66e8ebb5be59fc813cfbff6788d08d2e48dcf24ecc480a40ec9db8dbce9fec b2sums = e8f2b19e2474f30a4f984b45787950012668bf0acb5ad1ebb25cd9776925ab4a6aa927f8131ed53e35b1c71b32c504c700fe5b5145ecd25c7a8284373bb951ed @@ -37,8 +37,8 @@ pkgname = ollama-generic-git depends = glibc depends = openssl optdepends = - provides = ollama=0.1.32+1.r2377.20240416.9df6c85c - provides = ollama-git=0.1.32+1.r2377.20240416.9df6c85c + provides = ollama=0.1.37+3.r2707.20240511.4ec7445a + provides = ollama-git=0.1.37+3.r2707.20240511.4ec7445a conflicts = ollama pkgname = ollama-openmpi-git @@ -47,8 +47,8 @@ pkgname = ollama-openmpi-git depends = glibc depends = openssl optdepends = - provides = ollama=0.1.32+1.r2377.20240416.9df6c85c - provides = ollama-git=0.1.32+1.r2377.20240416.9df6c85c + provides = ollama=0.1.37+3.r2707.20240511.4ec7445a + provides = ollama-git=0.1.37+3.r2707.20240511.4ec7445a conflicts = ollama pkgname = ollama-openblas-git @@ -57,8 +57,8 @@ pkgname = ollama-openblas-git depends = glibc depends = openssl optdepends = - provides = ollama=0.1.32+1.r2377.20240416.9df6c85c - provides = ollama-git=0.1.32+1.r2377.20240416.9df6c85c + provides = ollama=0.1.37+3.r2707.20240511.4ec7445a + provides = ollama-git=0.1.37+3.r2707.20240511.4ec7445a conflicts = ollama pkgname = ollama-vulkan-git @@ -67,6 +67,6 @@ pkgname = ollama-vulkan-git depends = glibc depends = openssl optdepends = - provides = ollama=0.1.32+1.r2377.20240416.9df6c85c - provides = ollama-git=0.1.32+1.r2377.20240416.9df6c85c + provides = ollama=0.1.37+3.r2707.20240511.4ec7445a + provides = ollama-git=0.1.37+3.r2707.20240511.4ec7445a conflicts = ollama @@ -35,7 +35,7 @@ if "${_build_vulkan}"; then pkgname+=("${_name}-vulkan-git") fi pkgdesc='Create, run and share large language models (LLMs). Package(s) without dedicated GPU offloading (no CUDA, no ROCm, no SYCL).' -pkgver=0.1.32+1.r2377.20240416.9df6c85c +pkgver=0.1.37+3.r2707.20240511.4ec7445a pkgrel=1 arch=( 'armv7h' @@ -79,15 +79,15 @@ source=( "tmpfiles.d" ) b2sums=( - 'SKIP' - 'SKIP' - '490289e7afe8720792a7890636737147041a1f60d91f70f1b39a758f75e00ebc21724a1beb4d6ec74b0ff868636c887953f50fffbb998edc56ab087fe9477bbb' - 'a773bbf16cf5ccc2ee505ad77c3f9275346ddf412be283cfeaee7c2e4c41b8637a31aaff8766ed769524ebddc0c03cf924724452639b62208e578d98b9176124' - '3aabf135c4f18e1ad745ae8800db782b25b15305dfeaaa031b4501408ab7e7d01f66e8ebb5be59fc813cfbff6788d08d2e48dcf24ecc480a40ec9db8dbce9fec' - 'e8f2b19e2474f30a4f984b45787950012668bf0acb5ad1ebb25cd9776925ab4a6aa927f8131ed53e35b1c71b32c504c700fe5b5145ecd25c7a8284373bb951ed' + 'SKIP' # ollama (git) + 'SKIP' # llama.cpp (git) + '02d92a87554f2842b100908395a2599a843d21b95bf2c1961c2d862c35dda906893af107460054bf02340c52e4b4e3baa80cf95d071968fb9e158e697edaf0c6' # disable-rocm-cuda.gen_linux.sh.patch + 'a773bbf16cf5ccc2ee505ad77c3f9275346ddf412be283cfeaee7c2e4c41b8637a31aaff8766ed769524ebddc0c03cf924724452639b62208e578d98b9176124' # ollama.service + '3aabf135c4f18e1ad745ae8800db782b25b15305dfeaaa031b4501408ab7e7d01f66e8ebb5be59fc813cfbff6788d08d2e48dcf24ecc480a40ec9db8dbce9fec' # sysusers.conf + 'e8f2b19e2474f30a4f984b45787950012668bf0acb5ad1ebb25cd9776925ab4a6aa927f8131ed53e35b1c71b32c504c700fe5b5145ecd25c7a8284373bb951ed' # tmpfiles.d ) options+=('emptydirs') -#options+=('!lto') # openmpi variant fails to link without LTO. +#options+=('!lto') # openmpi variant fails to link _without_ LTO. _check_cpufeature() { ## Checks if the host CPU supports the feature passed as argument "$1". @@ -245,9 +245,9 @@ build() { if "${_build_clblas}"; then cd "${srcdir}/ollama-clblas" - + export OLLAMA_CUSTOM_CPU_DEFS="${_cmake_options_common} ${_cmake_options_clblas}" - + printf '\n' printf '%s\n' " > Compiling clblas variant ..." printf '\n' diff --git a/disable-rocm-cuda.gen_linux.sh.patch b/disable-rocm-cuda.gen_linux.sh.patch index 2c4a04015449..859e0d8465e9 100644 --- a/disable-rocm-cuda.gen_linux.sh.patch +++ b/disable-rocm-cuda.gen_linux.sh.patch @@ -1,16 +1,16 @@ -diff -rU1 ollama.orig/llm/generate/gen_linux.sh ollama/llm/generate/gen_linux.sh ---- ollama.orig/llm/generate/gen_linux.sh 2024-04-17 15:02:16.439575013 +0200 -+++ ollama/llm/generate/gen_linux.sh 2024-04-17 15:16:15.656217455 +0200 +diff -rU1 ollama.orig/llm/generate/gen_linux.sh ollama.nocuda.norocm/llm/generate/gen_linux.sh +--- ollama.orig/llm/generate/gen_linux.sh 2024-05-12 11:46:20.026663875 +0200 ++++ ollama.nocuda.norocm/llm/generate/gen_linux.sh 2024-05-12 11:58:20.653330156 +0200 @@ -53,3 +53,3 @@ fi -COMMON_CMAKE_DEFS="-DCMAKE_POSITION_INDEPENDENT_CODE=on -DLLAMA_NATIVE=off -DLLAMA_AVX=on -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off" +COMMON_CMAKE_DEFS="-DCMAKE_POSITION_INDEPENDENT_CODE=on -DLLAMA_NATIVE=on" source $(dirname $0)/gen_common.sh -@@ -67,3 +67,3 @@ - CMAKE_TARGETS="--target llama --target ggml" -- CMAKE_DEFS="-DBUILD_SHARED_LIBS=off -DLLAMA_NATIVE=off -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}" -+ CMAKE_DEFS="-DBUILD_SHARED_LIBS=on -DLLAMA_NATIVE=on ${CMAKE_DEFS}" - BUILD_DIR="../build/linux/${ARCH}_static" +@@ -66,3 +66,3 @@ + CMAKE_TARGETS="--target llama --target ggml" +- CMAKE_DEFS="-DBUILD_SHARED_LIBS=off -DLLAMA_NATIVE=off -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}" ++ CMAKE_DEFS="-DBUILD_SHARED_LIBS=on -DLLAMA_NATIVE=on ${CMAKE_DEFS}" + BUILD_DIR="../build/linux/${ARCH}_static" @@ -95,3 +95,3 @@ - COMMON_CPU_DEFS="-DCMAKE_POSITION_INDEPENDENT_CODE=on -DLLAMA_NATIVE=off" @@ -21,7 +21,7 @@ diff -rU1 ollama.orig/llm/generate/gen_linux.sh ollama/llm/generate/gen_linux.sh - CMAKE_DEFS="${COMMON_CPU_DEFS} -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}" + CMAKE_DEFS="${COMMON_CPU_DEFS} ${CMAKE_DEFS}" BUILD_DIR="../build/linux/${ARCH}/cpu" -@@ -143,64 +143,2 @@ +@@ -143,71 +143,76 @@ -# If needed, look for the default CUDA toolkit location -if [ -z "${CUDA_LIB_DIR}" ] && [ -d /usr/local/cuda/lib64 ]; then @@ -47,14 +47,22 @@ diff -rU1 ollama.orig/llm/generate/gen_linux.sh ollama/llm/generate/gen_linux.sh - fi - if [ "${ARCH}" == "arm64" ]; then - echo "ARM CPU detected - disabling unsupported AVX instructions" -- +- - # ARM-based CPUs such as M1 and Tegra do not support AVX extensions. - # -- # CUDA compute < 6.0 lacks proper FP16 support on ARM. -- # Disabling has minimal performance effect while maintaining compatibility. +- # CUDA compute < 6.0 lacks proper FP16 support on ARM. +- # Disabling has minimal performance effect while maintaining compatibility. - ARM64_DEFS="-DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_CUDA_F16=off" - fi -- CMAKE_DEFS="-DLLAMA_CUDA=on -DLLAMA_CUDA_FORCE_MMQ=on -DCMAKE_CUDA_ARCHITECTURES=${CMAKE_CUDA_ARCHITECTURES} ${COMMON_CMAKE_DEFS} ${CMAKE_DEFS} ${ARM64_DEFS}" +- # Users building from source can tune the exact flags we pass to cmake for configuring llama.cpp +- if [ -n "${OLLAMA_CUSTOM_CUDA_DEFS}" ]; then +- echo "OLLAMA_CUSTOM_CUDA_DEFS=\"${OLLAMA_CUSTOM_CUDA_DEFS}\"" +- CMAKE_CUDA_DEFS="-DLLAMA_CUDA=on -DCMAKE_CUDA_ARCHITECTURES=${CMAKE_CUDA_ARCHITECTURES} ${OLLAMA_CUSTOM_CUDA_DEFS}" +- echo "Building custom CUDA GPU" +- else +- CMAKE_CUDA_DEFS="-DLLAMA_CUDA=on -DLLAMA_CUDA_FORCE_MMQ=on -DCMAKE_CUDA_ARCHITECTURES=${CMAKE_CUDA_ARCHITECTURES}" +- fi +- CMAKE_DEFS="${COMMON_CMAKE_DEFS} ${CMAKE_DEFS} ${ARM64_DEFS} ${CMAKE_CUDA_DEFS}" - BUILD_DIR="../build/linux/${ARCH}/cuda${CUDA_VARIANT}" - EXTRA_LIBS="-L${CUDA_LIB_DIR} -lcudart -lcublas -lcublasLt -lcuda" - build @@ -77,18 +85,88 @@ diff -rU1 ollama.orig/llm/generate/gen_linux.sh ollama/llm/generate/gen_linux.sh - fi - done - compress -- + -fi -- ++### CUDA stuff deactivated by patch: + -if [ -z "${ROCM_PATH}" ]; then - # Try the default location in case it exists - ROCM_PATH=/opt/rocm -fi -- - if [ -z "${CLBlast_DIR}" ]; then -@@ -211,28 +149,2 @@ - fi -- ++# # If needed, look for the default CUDA toolkit location ++# if [ -z "${CUDA_LIB_DIR}" ] && [ -d /usr/local/cuda/lib64 ]; then ++# CUDA_LIB_DIR=/usr/local/cuda/lib64 ++# fi ++# ++# # If needed, look for CUDA on Arch Linux ++# if [ -z "${CUDA_LIB_DIR}" ] && [ -d /opt/cuda/targets/x86_64-linux/lib ]; then ++# CUDA_LIB_DIR=/opt/cuda/targets/x86_64-linux/lib ++# fi ++# ++# # Allow override in case libcudart is in the wrong place ++# if [ -z "${CUDART_LIB_DIR}" ]; then ++# CUDART_LIB_DIR="${CUDA_LIB_DIR}" ++# fi ++# ++# if [ -d "${CUDA_LIB_DIR}" ]; then ++# echo "CUDA libraries detected - building dynamic CUDA library" ++# init_vars ++# CUDA_MAJOR=$(ls "${CUDA_LIB_DIR}"/libcudart.so.* | head -1 | cut -f3 -d. || true) ++# if [ -n "${CUDA_MAJOR}" ]; then ++# CUDA_VARIANT=_v${CUDA_MAJOR} ++# fi ++# if [ "${ARCH}" == "arm64" ]; then ++# echo "ARM CPU detected - disabling unsupported AVX instructions" ++# ++# # ARM-based CPUs such as M1 and Tegra do not support AVX extensions. ++# # ++# # CUDA compute < 6.0 lacks proper FP16 support on ARM. ++# # Disabling has minimal performance effect while maintaining compatibility. ++# ARM64_DEFS="-DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_CUDA_F16=off" ++# fi ++# # Users building from source can tune the exact flags we pass to cmake for configuring llama.cpp ++# if [ -n "${OLLAMA_CUSTOM_CUDA_DEFS}" ]; then ++# echo "OLLAMA_CUSTOM_CUDA_DEFS=\"${OLLAMA_CUSTOM_CUDA_DEFS}\"" ++# CMAKE_CUDA_DEFS="-DLLAMA_CUDA=on -DCMAKE_CUDA_ARCHITECTURES=${CMAKE_CUDA_ARCHITECTURES} ${OLLAMA_CUSTOM_CUDA_DEFS}" ++# echo "Building custom CUDA GPU" ++# else ++# CMAKE_CUDA_DEFS="-DLLAMA_CUDA=on -DLLAMA_CUDA_FORCE_MMQ=on -DCMAKE_CUDA_ARCHITECTURES=${CMAKE_CUDA_ARCHITECTURES}" ++# fi ++# CMAKE_DEFS="${COMMON_CMAKE_DEFS} ${CMAKE_DEFS} ${ARM64_DEFS} ${CMAKE_CUDA_DEFS}" ++# BUILD_DIR="../build/linux/${ARCH}/cuda${CUDA_VARIANT}" ++# EXTRA_LIBS="-L${CUDA_LIB_DIR} -lcudart -lcublas -lcublasLt -lcuda" ++# build ++# ++# # Carry the CUDA libs as payloads to help reduce dependency burden on users ++# # ++# # TODO - in the future we may shift to packaging these separately and conditionally ++# # downloading them in the install script. ++# DEPS="$(ldd ${BUILD_DIR}/bin/ollama_llama_server )" ++# for lib in libcudart.so libcublas.so libcublasLt.so ; do ++# DEP=$(echo "${DEPS}" | grep ${lib} | cut -f1 -d' ' | xargs || true) ++# if [ -n "${DEP}" -a -e "${CUDA_LIB_DIR}/${DEP}" ]; then ++# cp "${CUDA_LIB_DIR}/${DEP}" "${BUILD_DIR}/bin/" ++# elif [ -e "${CUDA_LIB_DIR}/${lib}.${CUDA_MAJOR}" ]; then ++# cp "${CUDA_LIB_DIR}/${lib}.${CUDA_MAJOR}" "${BUILD_DIR}/bin/" ++# elif [ -e "${CUDART_LIB_DIR}/${lib}" ]; then ++# cp -d ${CUDART_LIB_DIR}/${lib}* "${BUILD_DIR}/bin/" ++# else ++# cp -d "${CUDA_LIB_DIR}/${lib}*" "${BUILD_DIR}/bin/" ++# fi ++# done ++# compress ++# ++# fi ++ ++### ROCm stuff deactivated by patch: ++ ++# if [ -z "${ROCM_PATH}" ]; then ++# # Try the default location in case it exists ++# ROCM_PATH=/opt/rocm ++# fi + +@@ -220,33 +225,35 @@ + -if [ -d "${ROCM_PATH}" ]; then - echo "ROCm libraries detected - building dynamic ROCm library" - if [ -f ${ROCM_PATH}/lib/librocblas.so.*.*.????? ]; then @@ -96,10 +174,17 @@ diff -rU1 ollama.orig/llm/generate/gen_linux.sh ollama/llm/generate/gen_linux.sh - fi - init_vars - CMAKE_DEFS="${COMMON_CMAKE_DEFS} ${CMAKE_DEFS} -DLLAMA_HIPBLAS=on -DCMAKE_C_COMPILER=$ROCM_PATH/llvm/bin/clang -DCMAKE_CXX_COMPILER=$ROCM_PATH/llvm/bin/clang++ -DAMDGPU_TARGETS=$(amdGPUs) -DGPU_TARGETS=$(amdGPUs)" +- # Users building from source can tune the exact flags we pass to cmake for configuring llama.cpp +- if [ -n "${OLLAMA_CUSTOM_ROCM_DEFS}" ]; then +- echo "OLLAMA_CUSTOM_ROCM_DEFS=\"${OLLAMA_CUSTOM_ROCM_DEFS}\"" +- CMAKE_DEFS="${CMAKE_DEFS} ${OLLAMA_CUSTOM_ROCM_DEFS}" +- echo "Building custom ROCM GPU" +- fi - BUILD_DIR="../build/linux/${ARCH}/rocm${ROCM_VARIANT}" - EXTRA_LIBS="-L${ROCM_PATH}/lib -L/opt/amdgpu/lib/x86_64-linux-gnu/ -Wl,-rpath,\$ORIGIN/../../rocm/ -lhipblas -lrocblas -lamdhip64 -lrocsolver -lamd_comgr -lhsa-runtime64 -lrocsparse -ldrm -ldrm_amdgpu" - build -- ++### ROCm stuff deactivated by patch: + - # Record the ROCM dependencies - rm -f "${BUILD_DIR}/bin/deps.txt" - touch "${BUILD_DIR}/bin/deps.txt" @@ -114,4 +199,35 @@ diff -rU1 ollama.orig/llm/generate/gen_linux.sh ollama/llm/generate/gen_linux.sh - fi - compress -fi ++# if [ -d "${ROCM_PATH}" ]; then ++# echo "ROCm libraries detected - building dynamic ROCm library" ++# if [ -f ${ROCM_PATH}/lib/librocblas.so.*.*.????? ]; then ++# ROCM_VARIANT=_v$(ls ${ROCM_PATH}/lib/librocblas.so.*.*.????? | cut -f5 -d. || true) ++# fi ++# init_vars ++# CMAKE_DEFS="${COMMON_CMAKE_DEFS} ${CMAKE_DEFS} -DLLAMA_HIPBLAS=on -DCMAKE_C_COMPILER=$ROCM_PATH/llvm/bin/clang -DCMAKE_CXX_COMPILER=$ROCM_PATH/llvm/bin/clang++ -DAMDGPU_TARGETS=$(amdGPUs) -DGPU_TARGETS=$(amdGPUs)" ++# # Users building from source can tune the exact flags we pass to cmake for configuring llama.cpp ++# if [ -n "${OLLAMA_CUSTOM_ROCM_DEFS}" ]; then ++# echo "OLLAMA_CUSTOM_ROCM_DEFS=\"${OLLAMA_CUSTOM_ROCM_DEFS}\"" ++# CMAKE_DEFS="${CMAKE_DEFS} ${OLLAMA_CUSTOM_ROCM_DEFS}" ++# echo "Building custom ROCM GPU" ++# fi ++# BUILD_DIR="../build/linux/${ARCH}/rocm${ROCM_VARIANT}" ++# EXTRA_LIBS="-L${ROCM_PATH}/lib -L/opt/amdgpu/lib/x86_64-linux-gnu/ -Wl,-rpath,\$ORIGIN/../../rocm/ -lhipblas -lrocblas -lamdhip64 -lrocsolver -lamd_comgr -lhsa-runtime64 -lrocsparse -ldrm -ldrm_amdgpu" ++# build ++# ++# # Record the ROCM dependencies ++# rm -f "${BUILD_DIR}/bin/deps.txt" ++# touch "${BUILD_DIR}/bin/deps.txt" ++# for dep in $(ldd "${BUILD_DIR}/bin/ollama_llama_server" | grep "=>" | cut -f2 -d= | cut -f2 -d' ' | grep -e rocm -e amdgpu -e libtinfo ); do ++# echo "${dep}" >> "${BUILD_DIR}/bin/deps.txt" ++# done ++# # bomb out if for some reason we didn't get a few deps ++# if [ $(cat "${BUILD_DIR}/bin/deps.txt" | wc -l ) -lt 8 ] ; then ++# cat "${BUILD_DIR}/bin/deps.txt" ++# echo "ERROR: deps file short" ++# exit 1 ++# fi ++# compress ++# fi |