fix sync script

This commit is contained in:
jmorganca 2024-05-18 23:50:50 -07:00
parent 86f453252b
commit 4a5633e4bc
5 changed files with 15 additions and 10 deletions

BIN
ggml-metal.o Normal file

Binary file not shown.

View File

@ -47,7 +47,7 @@ Install the [CUDA toolkit v11.3.1](https://developer.nvidia.com/cuda-11-3-1-down
Build `ggml-cuda.dll`: Build `ggml-cuda.dll`:
```shell ```shell
./cuda.sh ./build_cuda.sh
``` ```
Then build the package with the `cuda` tag: Then build the package with the `cuda` tag:
@ -63,7 +63,7 @@ Install [ROCm 5.7.1](https://rocm.docs.amd.com/en/docs-5.7.1/) and [Strawberry P
Then, build `ggml-hipblas.dll`: Then, build `ggml-hipblas.dll`:
```shell ```shell
./hipblas.sh ./build_hipblas.sh
``` ```
Then build the package with the `rocm` tag: Then build the package with the `rocm` tag:

View File

@ -3,8 +3,13 @@
# Set the source directory # Set the source directory
src_dir=$1 src_dir=$1
if [ -z "$src_dir" ]; then
echo "Usage: $0 LLAMA_CPP_DIR"
exit 1
fi
# Set the destination directory (current directory) # Set the destination directory (current directory)
dst_dir="." dst_dir=./llama
# llama.cpp # llama.cpp
cp $src_dir/unicode.cpp $dst_dir/unicode.cpp cp $src_dir/unicode.cpp $dst_dir/unicode.cpp
@ -40,20 +45,20 @@ cp $src_dir/ggml-cuda/*.cu $dst_dir/ggml-cuda/
cp $src_dir/ggml-cuda/*.cuh $dst_dir/ggml-cuda/ cp $src_dir/ggml-cuda/*.cuh $dst_dir/ggml-cuda/
# apply patches # apply patches
for patch in patches/*.patch; do for patch in $dst_dir/patches/*.patch; do
git apply "$patch" git apply "$patch"
done done
# add license # add license
sha1=$(git -C $src_dir rev-parse @) sha1=$(git -C $src_dir rev-parse @)
tempdir=$(mktemp) TEMP_LICENSE=$(mktemp)
cleanup() { cleanup() {
rm -f $tempdir rm -f $TEMP_LICENSE
} }
trap cleanup 0 trap cleanup 0
cat <<EOF | sed 's/ *$//' >$tempdir cat <<EOF | sed 's/ *$//' >$TEMP_LICENSE
/** /**
* llama.cpp - git $sha1 * llama.cpp - git $sha1
* *
@ -67,13 +72,13 @@ for IN in $dst_dir/*.{c,h,cpp,m,metal,cu}; do
continue continue
fi fi
TMP=$(mktemp) TMP=$(mktemp)
cat $tempdir $IN >$TMP cat $TEMP_LICENSE $IN >$TMP
mv $TMP $IN mv $TMP $IN
done done
# ggml-metal # ggml-metal
sed -i '' '1s;^;//go:build darwin,arm64\n\n;' ggml-metal.m sed -i '' '1s;^;// go:build darwin,arm64\n\n;' $dst_dir/ggml-metal.m
sed -e '/#include "ggml-common.h"/r ggml-common.h' -e '/#include "ggml-common.h"/d' < ggml-metal.metal > temp.metal sed -e '/#include "ggml-common.h"/r ggml-common.h' -e '/#include "ggml-common.h"/d' < $dst_dir/ggml-metal.metal > temp.metal
TEMP_ASSEMBLY=$(mktemp) TEMP_ASSEMBLY=$(mktemp)
echo ".section __DATA, __ggml_metallib" > $TEMP_ASSEMBLY echo ".section __DATA, __ggml_metallib" > $TEMP_ASSEMBLY
echo ".globl _ggml_metallib_start" >> $TEMP_ASSEMBLY echo ".globl _ggml_metallib_start" >> $TEMP_ASSEMBLY