Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please update go module github.com/chewxy/math32 to the last #4297

Closed
HougeLangley opened this issue May 9, 2024 · 3 comments · Fixed by #4324
Closed

Please update go module github.com/chewxy/math32 to the last #4297

HougeLangley opened this issue May 9, 2024 · 3 comments · Fixed by #4324
Labels
bug Something isn't working

Comments

@HougeLangley
Copy link

What is the issue?

chewxy/math32#46 (comment)

 sipeed @ lpi4a in ~/ollama on git:main o [3:10:57] 
$ go generate ./...        
go: downloading go1.22.0 (linux/riscv64)
go: downloading github.com/google/uuid v1.0.0
go: downloading golang.org/x/crypto v0.14.0
go: downloading google.golang.org/protobuf v1.30.0
go: downloading github.com/d4l3k/go-bfloat16 v0.0.0-20211005043715-690c3bdd05f1
go: downloading github.com/mitchellh/mapstructure v1.5.0
go: downloading github.com/nlpodyssey/gopickle v0.3.0
go: downloading github.com/pdevine/tensor v0.0.0-20240228013915-64ccaa8d9ca9
go: downloading github.com/x448/float16 v0.8.4
go: downloading golang.org/x/sys v0.13.0
go: downloading golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63
go: downloading golang.org/x/sync v0.3.0
go: downloading github.com/gin-gonic/gin v1.9.1
go: downloading golang.org/x/term v0.13.0
go: downloading github.com/emirpasic/gods v1.18.1
go: downloading github.com/gin-contrib/cors v1.4.0
go: downloading github.com/containerd/console v1.0.3
go: downloading github.com/olekukonko/tablewriter v0.0.5
go: downloading github.com/spf13/cobra v1.7.0
go: downloading golang.org/x/text v0.14.0
go: downloading github.com/apache/arrow/go/arrow v0.0.0-20201229220542-30ce2eb5d4dc
go: downloading github.com/chewxy/hm v1.0.0
go: downloading github.com/chewxy/math32 v1.0.8
go: downloading github.com/google/flatbuffers v1.12.0
go: downloading github.com/pkg/errors v0.9.1
go: downloading go4.org/unsafe/assume-no-moving-gc v0.0.0-20231121144256-b99613f794b6
go: downloading gonum.org/v1/gonum v0.8.2
go: downloading gorgonia.org/vecf32 v0.9.0
go: downloading gorgonia.org/vecf64 v0.9.0
go: downloading github.com/gin-contrib/sse v0.1.0
go: downloading github.com/mattn/go-isatty v0.0.19
go: downloading golang.org/x/net v0.17.0
go: downloading github.com/mattn/go-runewidth v0.0.14
go: downloading github.com/spf13/pflag v1.0.5
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: downloading github.com/xtgo/set v1.0.0
go: downloading github.com/gogo/protobuf v1.3.2
go: downloading github.com/golang/protobuf v1.5.0
go: downloading github.com/go-playground/validator/v10 v10.14.0
go: downloading github.com/pelletier/go-toml/v2 v2.0.8
go: downloading github.com/ugorji/go/codec v1.2.11
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading github.com/rivo/uniseg v0.2.0
go: downloading github.com/gabriel-vasile/mimetype v1.4.2
go: downloading github.com/go-playground/universal-translator v0.18.1
go: downloading github.com/leodido/go-urn v1.2.4
go: downloading github.com/go-playground/locales v0.14.1
+ set -o pipefail
+ echo 'Starting linux generate script'
Starting linux generate script
+ '[' -z '' ']'
+ '[' -x /usr/local/cuda/bin/nvcc ']'
++ command -v nvcc
+ export CUDACXX=
+ CUDACXX=
+ 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'
++ dirname ./gen_linux.sh
+ source ./gen_common.sh
+ init_vars
+ case "${GOARCH}" in
++ uname -m
++ sed -e s/aarch64/arm64/g
+ ARCH=riscv64
+ LLAMACPP_DIR=../llama.cpp
+ CMAKE_DEFS=
+ CMAKE_TARGETS='--target ollama_llama_server'
+ echo ''
+ grep -- -g
+ CMAKE_DEFS='-DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off '
+ case $(uname -s) in
++ uname -s
+ LIB_EXT=so
+ WHOLE_ARCHIVE=-Wl,--whole-archive
+ NO_WHOLE_ARCHIVE=-Wl,--no-whole-archive
+ GCC_ARCH=
+ '[' -z '' ']'
+ CMAKE_CUDA_ARCHITECTURES='50;52;61;70;75;80'
+ git_module_setup
+ '[' -n '' ']'
+ '[' -d ../llama.cpp/gguf ']'
+ git submodule init
+ git submodule update --force ../llama.cpp
子模组路径 '../llama.cpp':检出 '952d03dbead16e4dbdd1d3458486340673cc2465'
+ apply_patches
+ grep ollama ../llama.cpp/CMakeLists.txt
+ echo 'add_subdirectory(../ext_server ext_server) # ollama'
++ ls -A ../patches/02-clip-log.diff ../patches/03-load_exception.diff ../patches/04-metal.diff ../patches/05-clip-fix.diff
+ '[' -n '../patches/02-clip-log.diff
../patches/03-load_exception.diff
../patches/04-metal.diff
../patches/05-clip-fix.diff' ']'
+ for patch in ../patches/*.diff
++ grep '^+++ ' ../patches/02-clip-log.diff
++ cut -f2 '-d '
++ cut -f2- -d/
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout examples/llava/clip.cpp
从索引区更新了 0 个路径
+ for patch in ../patches/*.diff
++ grep '^+++ ' ../patches/03-load_exception.diff
++ cut -f2- -d/
++ cut -f2 '-d '
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout llama.cpp
从索引区更新了 0 个路径
+ for patch in ../patches/*.diff
++ grep '^+++ ' ../patches/04-metal.diff
++ cut -f2 '-d '
++ cut -f2- -d/
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout ggml-metal.m
从索引区更新了 0 个路径
+ for patch in ../patches/*.diff
++ grep '^+++ ' ../patches/05-clip-fix.diff
++ cut -f2 '-d '
++ cut -f2- -d/
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout examples/llava/clip.cpp
从索引区更新了 0 个路径
+ for patch in ../patches/*.diff
+ cd ../llama.cpp
+ git apply ../patches/02-clip-log.diff
+ for patch in ../patches/*.diff
+ cd ../llama.cpp
+ git apply ../patches/03-load_exception.diff
+ for patch in ../patches/*.diff
+ cd ../llama.cpp
+ git apply ../patches/04-metal.diff
+ for patch in ../patches/*.diff
+ cd ../llama.cpp
+ git apply ../patches/05-clip-fix.diff
+ init_vars
+ case "${GOARCH}" in
++ uname -m
++ sed -e s/aarch64/arm64/g
+ ARCH=riscv64
+ LLAMACPP_DIR=../llama.cpp
+ CMAKE_DEFS=
+ CMAKE_TARGETS='--target ollama_llama_server'
+ echo ''
+ grep -- -g
+ CMAKE_DEFS='-DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off '
+ case $(uname -s) in
++ uname -s
+ LIB_EXT=so
+ WHOLE_ARCHIVE=-Wl,--whole-archive
+ NO_WHOLE_ARCHIVE=-Wl,--no-whole-archive
+ GCC_ARCH=
+ '[' -z '50;52;61;70;75;80' ']'
+ '[' -z '' -o '' = static ']'
+ init_vars
+ case "${GOARCH}" in
++ uname -m
++ sed -e s/aarch64/arm64/g
+ ARCH=riscv64
+ LLAMACPP_DIR=../llama.cpp
+ CMAKE_DEFS=
+ CMAKE_TARGETS='--target ollama_llama_server'
+ echo ''
+ grep -- -g
+ CMAKE_DEFS='-DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off '
+ case $(uname -s) in
++ uname -s
+ LIB_EXT=so
+ WHOLE_ARCHIVE=-Wl,--whole-archive
+ NO_WHOLE_ARCHIVE=-Wl,--no-whole-archive
+ GCC_ARCH=
+ '[' -z '50;52;61;70;75;80' ']'
+ 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 -DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off '
+ BUILD_DIR=../build/linux/riscv64_static
+ echo 'Building static library'
Building static library
+ build
+ cmake -S ../llama.cpp -B ../build/linux/riscv64_static -DBUILD_SHARED_LIBS=off -DLLAMA_NATIVE=off -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off -DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "2.40.1") 
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Warning: ccache not found - consider installing it for faster compilation or disable this warning with LLAMA_CCACHE=OFF
-- CMAKE_SYSTEM_PROCESSOR: riscv64
-- Unknown architecture
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sipeed/ollama/llm/build/linux/riscv64_static
+ cmake --build ../build/linux/riscv64_static --target llama --target ggml -j8
[ 33%] Building C object CMakeFiles/ggml.dir/ggml-alloc.c.o
[ 33%] Building C object CMakeFiles/ggml.dir/ggml-backend.c.o
[ 50%] Building CXX object CMakeFiles/ggml.dir/sgemm.cpp.o
[ 50%] Building C object CMakeFiles/ggml.dir/ggml.c.o
[ 50%] Building C object CMakeFiles/ggml.dir/ggml-quants.c.o
[ 50%] Built target ggml
[ 83%] Building CXX object CMakeFiles/llama.dir/llama.cpp.o
[ 83%] Building CXX object CMakeFiles/llama.dir/unicode.cpp.o
[ 83%] Building CXX object CMakeFiles/llama.dir/unicode-data.cpp.o
[100%] Linking CXX static library libllama.a
[100%] Built target llama
[100%] Built target ggml
+ init_vars
+ case "${GOARCH}" in
++ uname -m
++ sed -e s/aarch64/arm64/g
+ ARCH=riscv64
+ LLAMACPP_DIR=../llama.cpp
+ CMAKE_DEFS=
+ CMAKE_TARGETS='--target ollama_llama_server'
+ echo ''
+ grep -- -g
+ CMAKE_DEFS='-DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off '
+ case $(uname -s) in
++ uname -s
+ LIB_EXT=so
+ WHOLE_ARCHIVE=-Wl,--whole-archive
+ NO_WHOLE_ARCHIVE=-Wl,--no-whole-archive
+ GCC_ARCH=
+ '[' -z '50;52;61;70;75;80' ']'
+ '[' -z '' ']'
+ '[' -n '' ']'
+ COMMON_CPU_DEFS='-DCMAKE_POSITION_INDEPENDENT_CODE=on -DLLAMA_NATIVE=off'
+ '[' -z '' -o '' = cpu ']'
+ init_vars
+ case "${GOARCH}" in
++ uname -m
++ sed -e s/aarch64/arm64/g
+ ARCH=riscv64
+ LLAMACPP_DIR=../llama.cpp
+ CMAKE_DEFS=
+ CMAKE_TARGETS='--target ollama_llama_server'
+ echo ''
+ grep -- -g
+ CMAKE_DEFS='-DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off '
+ case $(uname -s) in
++ uname -s
+ LIB_EXT=so
+ WHOLE_ARCHIVE=-Wl,--whole-archive
+ NO_WHOLE_ARCHIVE=-Wl,--no-whole-archive
+ GCC_ARCH=
+ '[' -z '50;52;61;70;75;80' ']'
+ CMAKE_DEFS='-DCMAKE_POSITION_INDEPENDENT_CODE=on -DLLAMA_NATIVE=off -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off -DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off '
+ BUILD_DIR=../build/linux/riscv64/cpu
+ echo 'Building LCD CPU'
Building LCD CPU
+ build
+ cmake -S ../llama.cpp -B ../build/linux/riscv64/cpu -DCMAKE_POSITION_INDEPENDENT_CODE=on -DLLAMA_NATIVE=off -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off -DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "2.40.1") 
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Warning: ccache not found - consider installing it for faster compilation or disable this warning with LLAMA_CCACHE=OFF
-- CMAKE_SYSTEM_PROCESSOR: riscv64
-- Unknown architecture
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sipeed/ollama/llm/build/linux/riscv64/cpu
+ cmake --build ../build/linux/riscv64/cpu --target ollama_llama_server -j8
[  6%] Generating build details from Git
[  6%] Building C object CMakeFiles/ggml.dir/ggml.c.o
[ 12%] Building C object CMakeFiles/ggml.dir/ggml-alloc.c.o
[ 18%] Building C object CMakeFiles/ggml.dir/ggml-backend.c.o
[ 18%] Building C object CMakeFiles/ggml.dir/ggml-quants.c.o
-- Found Git: /usr/bin/git (found version "2.40.1") 
[ 25%] Building CXX object CMakeFiles/ggml.dir/sgemm.cpp.o
[ 31%] Building CXX object common/CMakeFiles/build_info.dir/build-info.cpp.o
[ 31%] Built target build_info
[ 31%] Built target ggml
[ 37%] Building CXX object CMakeFiles/llama.dir/llama.cpp.o
[ 43%] Building CXX object CMakeFiles/llama.dir/unicode.cpp.o
[ 43%] Building CXX object CMakeFiles/llama.dir/unicode-data.cpp.o
[ 50%] Linking CXX static library libllama.a
[ 50%] Built target llama
[ 56%] Building CXX object examples/llava/CMakeFiles/llava.dir/clip.cpp.o
[ 62%] Building CXX object examples/llava/CMakeFiles/llava.dir/llava.cpp.o
[ 56%] Building CXX object common/CMakeFiles/common.dir/common.cpp.o
[ 68%] Building CXX object common/CMakeFiles/common.dir/console.cpp.o
[ 75%] Building CXX object common/CMakeFiles/common.dir/sampling.cpp.o
[ 81%] Building CXX object common/CMakeFiles/common.dir/json-schema-to-grammar.cpp.o
[ 81%] Building CXX object common/CMakeFiles/common.dir/grammar-parser.cpp.o
[ 87%] Building CXX object common/CMakeFiles/common.dir/train.cpp.o
[ 87%] Building CXX object common/CMakeFiles/common.dir/ngram-cache.cpp.o
[ 93%] Linking CXX static library libcommon.a
[ 93%] Built target llava
[ 93%] Built target common
[ 93%] Building CXX object ext_server/CMakeFiles/ollama_llama_server.dir/server.cpp.o
[100%] Linking CXX executable ../bin/ollama_llama_server
[100%] Built target ollama_llama_server
+ compress
+ echo 'Compressing payloads to reduce overall binary size...'
Compressing payloads to reduce overall binary size...
+ pids=
+ rm -rf '../build/linux/riscv64/cpu/bin/*.gz'
+ for f in ${BUILD_DIR}/bin/*
+ pids+=' 2078'
+ '[' -d ../build/linux/riscv64/cpu/lib ']'
+ gzip -n --best -f ../build/linux/riscv64/cpu/bin/ollama_llama_server
+ echo

+ for pid in ${pids}
+ wait 2078
+ echo 'Finished compression'
Finished compression
+ '[' riscv64 == x86_64 ']'
+ '[' -z '' ']'
+ '[' -d /usr/local/cuda/lib64 ']'
+ '[' -z '' ']'
+ '[' -d /opt/cuda/targets/x86_64-linux/lib ']'
+ '[' -z '' ']'
+ CUDART_LIB_DIR=
+ '[' -d '' ']'
+ '[' -z '' ']'
+ ROCM_PATH=/opt/rocm
+ '[' -z '' ']'
+ '[' -d /usr/lib/cmake/CLBlast ']'
+ '[' -d /opt/rocm ']'
+ cleanup
+ cd ../llama.cpp/
+ git checkout CMakeLists.txt
从索引区更新了 1 个路径
++ ls -A ../patches/02-clip-log.diff ../patches/03-load_exception.diff ../patches/04-metal.diff ../patches/05-clip-fix.diff
+ '[' -n '../patches/02-clip-log.diff
../patches/03-load_exception.diff
../patches/04-metal.diff
../patches/05-clip-fix.diff' ']'
+ for patch in ../patches/*.diff
++ grep '^+++ ' ../patches/02-clip-log.diff
++ cut -f2 '-d '
++ cut -f2- -d/
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout examples/llava/clip.cpp
从索引区更新了 1 个路径
+ for patch in ../patches/*.diff
++ grep '^+++ ' ../patches/03-load_exception.diff
++ cut -f2 '-d '
++ cut -f2- -d/
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout llama.cpp
从索引区更新了 1 个路径
+ for patch in ../patches/*.diff
++ grep '^+++ ' ../patches/04-metal.diff
++ cut -f2 '-d '
++ cut -f2- -d/
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout ggml-metal.m
从索引区更新了 1 个路径
+ for patch in ../patches/*.diff
++ grep '^+++ ' ../patches/05-clip-fix.diff
++ cut -f2 '-d '
++ cut -f2- -d/
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout examples/llava/clip.cpp
从索引区更新了 0 个路径
++ cd ../build/linux/riscv64/cpu/..
++ echo cpu
+ echo 'go generate completed.  LLM runners: cpu'
go generate completed.  LLM runners: cpu

# sipeed @ lpi4a in ~/ollama on git:main o [3:27:53] 
$ go build .
# github.com/chewxy/math32
../go/pkg/mod/github.com/chewxy/math32@v1.0.8/exp.go:3:6: missing function body
../go/pkg/mod/github.com/chewxy/math32@v1.0.8/exp.go:57:6: missing function body
../go/pkg/mod/github.com/chewxy/math32@v1.0.8/sqrt.go:3:6: missing function body
../go/pkg/mod/github.com/chewxy/math32@v1.0.8/log.go:76:6: missing function body
../go/pkg/mod/github.com/chewxy/math32@v1.0.8/remainder.go:33:6: missing function body

OS

Linux

GPU

Other

CPU

Other

Ollama version

0.1.34

@HougeLangley
Copy link
Author

For now, Using this patch https://github.com/felixonmars/archriscv-packages/blob/master/ollama/riscv64.patch

go build . will get another bug

# sipeed @ lpi4a in ~/ollama on git:main x [0:23:31] 
$ go build .                                                                                                            
# github.com/ollama/ollama
/home/sipeed/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.0.linux-riscv64/pkg/tool/linux_riscv64/link: running gcc failed: exit status 1
/usr/bin/ld: /tmp/go-link-2991158597/000019.o: in function `_cgo_d85a20fb2d9c_Cfunc_llama_model_quantize':
/tmp/go-build/llm.cgo2.c:69: undefined reference to `llama_model_quantize'
/usr/bin/ld: /tmp/go-link-2991158597/000019.o: in function `_cgo_d85a20fb2d9c_Cfunc_llama_model_quantize_default_params':
/tmp/go-build/llm.cgo2.c:86: undefined reference to `llama_model_quantize_default_params'
/usr/bin/ld: /tmp/go-link-2991158597/000019.o: in function `_cgo_d85a20fb2d9c_Cfunc_llama_print_system_info':
/tmp/go-build/llm.cgo2.c:103: undefined reference to `llama_print_system_info'
collect2: 错误:ld 返回 1

@HougeLangley
Copy link
Author

Bugs still

@HougeLangley
Copy link
Author

# sipeed @ lpi4a in ~ [0:48:31] 
$ git clone https://github.com/ollama/ollama.git
正克隆到 'ollama'...
remote: Enumerating objects: 15370, done.
remote: Counting objects: 100% (2889/2889), done.
remote: Compressing objects: 100% (564/564), done.
remote: Total 15370 (delta 2609), reused 2396 (delta 2325), pack-reused 12481
接收对象中: 100% (15370/15370), 10.97 MiB | 4.25 MiB/s, 完成.
处理 delta 中: 100% (9701/9701), 完成.

# sipeed @ lpi4a in ~ [0:48:42] 
$ cd ollama 

# sipeed @ lpi4a in ~/ollama on git:main o [0:48:46] 
$ git submodule init                            
子模组 'llama.cpp'(https://github.com/ggerganov/llama.cpp.git)已对路径 'llm/llama.cpp' 注册

# sipeed @ lpi4a in ~/ollama on git:main o [0:48:51] 
$ git submodule update
正克隆到 '/home/sipeed/ollama/llm/llama.cpp'...
remote: Enumerating objects: 15604, done.
remote: Counting objects: 100% (15604/15604), done.
remote: Compressing objects: 100% (4240/4240), done.
remote: Total 15194 (delta 11352), reused 14648 (delta 10828), pack-reused 0
接收对象中: 100% (15194/15194), 14.24 MiB | 4.51 MiB/s, 完成.
处理 delta 中: 100% (11352/11352), 完成 336 个本地对象.
来自 https://github.com/ggerganov/llama.cpp
 * branch            952d03dbead16e4dbdd1d3458486340673cc2465 -> FETCH_HEAD
子模组路径 'llm/llama.cpp':检出 '952d03dbead16e4dbdd1d3458486340673cc2465'

# sipeed @ lpi4a in ~/ollama on git:main o [0:49:27] 
$ go generate ./...                                                          
go: downloading github.com/google/uuid v1.1.2
go: downloading golang.org/x/crypto v0.23.0
go: downloading golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
go: downloading golang.org/x/term v0.20.0
go: downloading github.com/pdevine/tensor v0.0.0-20240510204454-f88f4562727c
go: downloading google.golang.org/protobuf v1.34.1
go: downloading golang.org/x/sys v0.20.0
go: downloading github.com/gin-gonic/gin v1.10.0
go: downloading github.com/gin-contrib/cors v1.7.2
go: downloading golang.org/x/text v0.15.0
go: downloading github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40
go: downloading github.com/google/flatbuffers v24.3.25+incompatible
go: downloading gonum.org/v1/gonum v0.15.0
go: downloading github.com/mattn/go-isatty v0.0.20
go: downloading golang.org/x/net v0.25.0
go: downloading github.com/golang/protobuf v1.5.4
go: downloading github.com/go-playground/validator/v10 v10.20.0
go: downloading github.com/pelletier/go-toml/v2 v2.2.2
go: downloading github.com/ugorji/go/codec v1.2.12
go: downloading github.com/leodido/go-urn v1.4.0
go: downloading github.com/gabriel-vasile/mimetype v1.4.3
+ set -o pipefail
+ echo 'Starting linux generate script'
Starting linux generate script
+ '[' -z '' ']'
+ '[' -x /usr/local/cuda/bin/nvcc ']'
++ command -v nvcc
+ export CUDACXX=
+ CUDACXX=
+ 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'
++ dirname ./gen_linux.sh
+ source ./gen_common.sh
+ init_vars
+ case "${GOARCH}" in
++ uname -m
++ sed -e s/aarch64/arm64/g
+ ARCH=riscv64
+ LLAMACPP_DIR=../llama.cpp
+ CMAKE_DEFS=
+ CMAKE_TARGETS='--target ollama_llama_server'
+ echo ''
+ grep -- -g
+ CMAKE_DEFS='-DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off '
+ case $(uname -s) in
++ uname -s
+ LIB_EXT=so
+ WHOLE_ARCHIVE=-Wl,--whole-archive
+ NO_WHOLE_ARCHIVE=-Wl,--no-whole-archive
+ GCC_ARCH=
+ '[' -z '' ']'
+ CMAKE_CUDA_ARCHITECTURES='50;52;61;70;75;80'
+ git_module_setup
+ '[' -n '' ']'
+ '[' -d ../llama.cpp/gguf ']'
+ git submodule init
+ git submodule update --force ../llama.cpp
子模组路径 '../llama.cpp':检出 '952d03dbead16e4dbdd1d3458486340673cc2465'
+ apply_patches
+ grep ollama ../llama.cpp/CMakeLists.txt
+ echo 'add_subdirectory(../ext_server ext_server) # ollama'
++ ls -A ../patches/02-clip-log.diff ../patches/03-load_exception.diff ../patches/04-metal.diff ../patches/05-clip-fix.diff
+ '[' -n '../patches/02-clip-log.diff
../patches/03-load_exception.diff
../patches/04-metal.diff
../patches/05-clip-fix.diff' ']'
+ for patch in ../patches/*.diff
++ grep '^+++ ' ../patches/02-clip-log.diff
++ cut -f2 '-d '
++ cut -f2- -d/
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout examples/llava/clip.cpp
从索引区更新了 0 个路径
+ for patch in ../patches/*.diff
++ grep '^+++ ' ../patches/03-load_exception.diff
++ cut -f2 '-d '
++ cut -f2- -d/
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout llama.cpp
从索引区更新了 0 个路径
+ for patch in ../patches/*.diff
++ grep '^+++ ' ../patches/04-metal.diff
++ cut -f2 '-d '
++ cut -f2- -d/
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout ggml-metal.m
从索引区更新了 0 个路径
+ for patch in ../patches/*.diff
++ grep '^+++ ' ../patches/05-clip-fix.diff
++ cut -f2 '-d '
++ cut -f2- -d/
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout examples/llava/clip.cpp
从索引区更新了 0 个路径
+ for patch in ../patches/*.diff
+ cd ../llama.cpp
+ git apply ../patches/02-clip-log.diff
+ for patch in ../patches/*.diff
+ cd ../llama.cpp
+ git apply ../patches/03-load_exception.diff
+ for patch in ../patches/*.diff
+ cd ../llama.cpp
+ git apply ../patches/04-metal.diff
+ for patch in ../patches/*.diff
+ cd ../llama.cpp
+ git apply ../patches/05-clip-fix.diff
+ init_vars
+ case "${GOARCH}" in
++ uname -m
++ sed -e s/aarch64/arm64/g
+ ARCH=riscv64
+ LLAMACPP_DIR=../llama.cpp
+ CMAKE_DEFS=
+ CMAKE_TARGETS='--target ollama_llama_server'
+ echo ''
+ grep -- -g
+ CMAKE_DEFS='-DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off '
+ case $(uname -s) in
++ uname -s
+ LIB_EXT=so
+ WHOLE_ARCHIVE=-Wl,--whole-archive
+ NO_WHOLE_ARCHIVE=-Wl,--no-whole-archive
+ GCC_ARCH=
+ '[' -z '50;52;61;70;75;80' ']'
+ '[' -z '' -o '' = static ']'
+ init_vars
+ case "${GOARCH}" in
++ uname -m
++ sed -e s/aarch64/arm64/g
+ ARCH=riscv64
+ LLAMACPP_DIR=../llama.cpp
+ CMAKE_DEFS=
+ CMAKE_TARGETS='--target ollama_llama_server'
+ echo ''
+ grep -- -g
+ CMAKE_DEFS='-DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off '
+ case $(uname -s) in
++ uname -s
+ LIB_EXT=so
+ WHOLE_ARCHIVE=-Wl,--whole-archive
+ NO_WHOLE_ARCHIVE=-Wl,--no-whole-archive
+ GCC_ARCH=
+ '[' -z '50;52;61;70;75;80' ']'
+ 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 -DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off '
+ BUILD_DIR=../build/linux/riscv64_static
+ echo 'Building static library'
Building static library
+ build
+ cmake -S ../llama.cpp -B ../build/linux/riscv64_static -DBUILD_SHARED_LIBS=off -DLLAMA_NATIVE=off -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off -DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "2.40.1") 
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Warning: ccache not found - consider installing it for faster compilation or disable this warning with LLAMA_CCACHE=OFF
-- CMAKE_SYSTEM_PROCESSOR: riscv64
-- Unknown architecture
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sipeed/ollama/llm/build/linux/riscv64_static
+ cmake --build ../build/linux/riscv64_static --target llama --target ggml -j8
[ 16%] Building C object CMakeFiles/ggml.dir/ggml-alloc.c.o
[ 33%] Building C object CMakeFiles/ggml.dir/ggml-backend.c.o
[ 50%] Building CXX object CMakeFiles/ggml.dir/sgemm.cpp.o
[ 50%] Building C object CMakeFiles/ggml.dir/ggml.c.o
[ 50%] Building C object CMakeFiles/ggml.dir/ggml-quants.c.o
[ 50%] Built target ggml
[ 83%] Building CXX object CMakeFiles/llama.dir/unicode-data.cpp.o
[ 83%] Building CXX object CMakeFiles/llama.dir/unicode.cpp.o
[ 83%] Building CXX object CMakeFiles/llama.dir/llama.cpp.o
[100%] Linking CXX static library libllama.a
[100%] Built target llama
[100%] Built target ggml
+ init_vars
+ case "${GOARCH}" in
++ uname -m
++ sed -e s/aarch64/arm64/g
+ ARCH=riscv64
+ LLAMACPP_DIR=../llama.cpp
+ CMAKE_DEFS=
+ CMAKE_TARGETS='--target ollama_llama_server'
+ echo ''
+ grep -- -g
+ CMAKE_DEFS='-DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off '
+ case $(uname -s) in
++ uname -s
+ LIB_EXT=so
+ WHOLE_ARCHIVE=-Wl,--whole-archive
+ NO_WHOLE_ARCHIVE=-Wl,--no-whole-archive
+ GCC_ARCH=
+ '[' -z '50;52;61;70;75;80' ']'
+ '[' -z '' ']'
+ '[' -n '' ']'
+ COMMON_CPU_DEFS='-DCMAKE_POSITION_INDEPENDENT_CODE=on -DLLAMA_NATIVE=off'
+ '[' -z '' -o '' = cpu ']'
+ init_vars
+ case "${GOARCH}" in
++ uname -m
++ sed -e s/aarch64/arm64/g
+ ARCH=riscv64
+ LLAMACPP_DIR=../llama.cpp
+ CMAKE_DEFS=
+ CMAKE_TARGETS='--target ollama_llama_server'
+ echo ''
+ grep -- -g
+ CMAKE_DEFS='-DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off '
+ case $(uname -s) in
++ uname -s
+ LIB_EXT=so
+ WHOLE_ARCHIVE=-Wl,--whole-archive
+ NO_WHOLE_ARCHIVE=-Wl,--no-whole-archive
+ GCC_ARCH=
+ '[' -z '50;52;61;70;75;80' ']'
+ CMAKE_DEFS='-DCMAKE_POSITION_INDEPENDENT_CODE=on -DLLAMA_NATIVE=off -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off -DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off '
+ BUILD_DIR=../build/linux/riscv64/cpu
+ echo 'Building LCD CPU'
Building LCD CPU
+ build
+ cmake -S ../llama.cpp -B ../build/linux/riscv64/cpu -DCMAKE_POSITION_INDEPENDENT_CODE=on -DLLAMA_NATIVE=off -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off -DCMAKE_BUILD_TYPE=Release -DLLAMA_SERVER_VERBOSE=off
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "2.40.1") 
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Warning: ccache not found - consider installing it for faster compilation or disable this warning with LLAMA_CCACHE=OFF
-- CMAKE_SYSTEM_PROCESSOR: riscv64
-- Unknown architecture
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sipeed/ollama/llm/build/linux/riscv64/cpu
+ cmake --build ../build/linux/riscv64/cpu --target ollama_llama_server -j8
[  6%] Generating build details from Git
[  6%] Building C object CMakeFiles/ggml.dir/ggml.c.o
[  6%] Building C object CMakeFiles/ggml.dir/ggml-quants.c.o
[ 12%] Building C object CMakeFiles/ggml.dir/ggml-alloc.c.o
-- Found Git: /usr/bin/git (found version "2.40.1") 
[ 18%] Building CXX object CMakeFiles/ggml.dir/sgemm.cpp.o
[ 25%] Building C object CMakeFiles/ggml.dir/ggml-backend.c.o
[ 31%] Building CXX object common/CMakeFiles/build_info.dir/build-info.cpp.o
[ 31%] Built target build_info
[ 31%] Built target ggml
[ 43%] Building CXX object CMakeFiles/llama.dir/unicode-data.cpp.o
[ 43%] Building CXX object CMakeFiles/llama.dir/llama.cpp.o
[ 43%] Building CXX object CMakeFiles/llama.dir/unicode.cpp.o
[ 50%] Linking CXX static library libllama.a
[ 50%] Built target llama
[ 56%] Building CXX object examples/llava/CMakeFiles/llava.dir/clip.cpp.o
[ 56%] Building CXX object common/CMakeFiles/common.dir/common.cpp.o
[ 62%] Building CXX object examples/llava/CMakeFiles/llava.dir/llava.cpp.o
[ 62%] Building CXX object common/CMakeFiles/common.dir/grammar-parser.cpp.o
[ 68%] Building CXX object common/CMakeFiles/common.dir/console.cpp.o
[ 75%] Building CXX object common/CMakeFiles/common.dir/json-schema-to-grammar.cpp.o
[ 81%] Building CXX object common/CMakeFiles/common.dir/train.cpp.o
[ 87%] Building CXX object common/CMakeFiles/common.dir/sampling.cpp.o
[ 87%] Building CXX object common/CMakeFiles/common.dir/ngram-cache.cpp.o
[ 93%] Linking CXX static library libcommon.a
[ 93%] Built target common
[ 93%] Built target llava
[ 93%] Building CXX object ext_server/CMakeFiles/ollama_llama_server.dir/server.cpp.o
[100%] Linking CXX executable ../bin/ollama_llama_server
[100%] Built target ollama_llama_server
+ compress
+ echo 'Compressing payloads to reduce overall binary size...'
Compressing payloads to reduce overall binary size...
+ pids=
+ rm -rf '../build/linux/riscv64/cpu/bin/*.gz'
+ for f in ${BUILD_DIR}/bin/*
+ pids+=' 17748'
+ gzip -n --best -f ../build/linux/riscv64/cpu/bin/ollama_llama_server
+ '[' -d ../build/linux/riscv64/cpu/lib ']'
+ echo

+ for pid in ${pids}
+ wait 17748
+ echo 'Finished compression'
Finished compression
+ '[' riscv64 == x86_64 ']'
+ '[' -z '' ']'
+ '[' -d /usr/local/cuda/lib64 ']'
+ '[' -z '' ']'
+ '[' -d /opt/cuda/targets/x86_64-linux/lib ']'
+ '[' -z '' ']'
+ CUDART_LIB_DIR=
+ '[' -d '' ']'
+ '[' -z '' ']'
+ ROCM_PATH=/opt/rocm
+ '[' -z '' ']'
+ '[' -d /usr/lib/cmake/CLBlast ']'
+ '[' -d /opt/rocm ']'
+ cleanup
+ cd ../llama.cpp/
+ git checkout CMakeLists.txt
从索引区更新了 1 个路径
++ ls -A ../patches/02-clip-log.diff ../patches/03-load_exception.diff ../patches/04-metal.diff ../patches/05-clip-fix.diff
+ '[' -n '../patches/02-clip-log.diff
../patches/03-load_exception.diff
../patches/04-metal.diff
../patches/05-clip-fix.diff' ']'
+ for patch in ../patches/*.diff
++ grep '^+++ ' ../patches/02-clip-log.diff
++ cut -f2 '-d '
++ cut -f2- -d/
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout examples/llava/clip.cpp
从索引区更新了 1 个路径
+ for patch in ../patches/*.diff
++ grep '^+++ ' ../patches/03-load_exception.diff
++ cut -f2 '-d '
++ cut -f2- -d/
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout llama.cpp
从索引区更新了 1 个路径
+ for patch in ../patches/*.diff
++ grep '^+++ ' ../patches/04-metal.diff
++ cut -f2 '-d '
++ cut -f2- -d/
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout ggml-metal.m
从索引区更新了 1 个路径
+ for patch in ../patches/*.diff
++ grep '^+++ ' ../patches/05-clip-fix.diff
++ cut -f2 '-d '
++ cut -f2- -d/
+ for file in $(grep "^+++ " ${patch} | cut -f2 -d' ' | cut -f2- -d/)
+ cd ../llama.cpp
+ git checkout examples/llava/clip.cpp
从索引区更新了 0 个路径
++ cd ../build/linux/riscv64/cpu/..
++ echo cpu
+ echo 'go generate completed.  LLM runners: cpu'
go generate completed.  LLM runners: cpu

# sipeed @ lpi4a in ~/ollama on git:main o [1:05:33] 
$ go build .       
# github.com/chewxy/math32
../go/pkg/mod/github.com/chewxy/math32@v1.10.1/sqrt.go:3:6: missing function body
../go/pkg/mod/github.com/chewxy/math32@v1.10.1/log.go:76:6: missing function body
../go/pkg/mod/github.com/chewxy/math32@v1.10.1/exp.go:3:6: missing function body
../go/pkg/mod/github.com/chewxy/math32@v1.10.1/exp.go:57:6: missing function body
../go/pkg/mod/github.com/chewxy/math32@v1.10.1/remainder.go:33:6: missing function body

# sipeed @ lpi4a in ~/ollama on git:main o [1:07:32] C:1
$ go get -u github.com/chewxy/math32@7caa3bb
go: downloading github.com/chewxy/math32 v1.10.2-0.20240509203351-7caa3bba2ee1
go: upgraded github.com/chewxy/math32 v1.10.1 => v1.10.2-0.20240509203351-7caa3bba2ee1

# sipeed @ lpi4a in ~/ollama on git:main x [1:07:50] 
$ go build .                                
# github.com/ollama/ollama
/home/sipeed/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.0.linux-riscv64/pkg/tool/linux_riscv64/link: running gcc failed: exit status 1
/usr/bin/ld: /tmp/go-link-2984308571/000019.o: in function `_cgo_d85a20fb2d9c_Cfunc_llama_model_quantize':
/tmp/go-build/llm.cgo2.c:69: undefined reference to `llama_model_quantize'
/usr/bin/ld: /tmp/go-link-2984308571/000019.o: in function `_cgo_d85a20fb2d9c_Cfunc_llama_model_quantize_default_params':
/tmp/go-build/llm.cgo2.c:86: undefined reference to `llama_model_quantize_default_params'
/usr/bin/ld: /tmp/go-link-2984308571/000019.o: in function `_cgo_d85a20fb2d9c_Cfunc_llama_print_system_info':
/tmp/go-build/llm.cgo2.c:103: undefined reference to `llama_print_system_info'
collect2: 错误:ld 返回 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant