feat(ci): support manylinux build for cpu / cuda (#899)

add-prompt-lookup
Meng Zhang 2023-11-26 16:37:12 +08:00 committed by GitHub
parent 2212171825
commit 23a49beaa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 6 deletions

View File

@ -66,14 +66,23 @@ jobs:
if: github.event_name != 'pull_request'
needs: tests
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
binary: [aarch64-apple-darwin, x86_64-manylinux2014, x86_64-manylinux2014-cuda117]
include:
- os: macos-latest
target: aarch64-apple-darwin
binary: aarch64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary: x86_64-manylinux2014
container: quay.io/pypa/manylinux2014_x86_64
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary: x86_64-manylinux2014-cuda117
container: sameli/manylinux2014_x86_64_cuda_11.7
build_args: --features cuda
env:
SCCACHE_GHA_ENABLED: true
@ -114,17 +123,17 @@ jobs:
- run: bash ./ci/prepare_build_environment.sh
- name: Bulid release binary
run: cargo build --release --target ${{ matrix.target }} --package tabby
run: cargo build ${{ matrix.build_args }} --release --target ${{ matrix.target }} --package tabby
- name: Rename release binary
run: mv target/${{ matrix.target }}/release/tabby tabby_${{ matrix.target }}
run: mv target/${{ matrix.target }}/release/tabby tabby_${{ matrix.binary }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
retention-days: 3
name: tabby_${{ matrix.target }}
path: tabby_${{ matrix.target }}
name: tabby_${{ matrix.binary }}
path: tabby_${{ matrix.binary }}
pre-release:
if: github.event_name == 'push'

View File

@ -4,6 +4,23 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
brew install protobuf
fi
install_protobuf_centos() {
PB_REL="https://github.com/protocolbuffers/protobuf/releases"
curl -LO $PB_REL/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip
unzip protoc-3.15.8-linux-x86_64.zip -d /usr
rm protoc-3.15.8-linux-x86_64.zip
}
if [[ "$OSTYPE" == "linux"* ]]; then
sudo apt-get -y install protobuf-compiler libopenblas-dev
if command -v apt-get ; then
sudo apt-get -y install protobuf-compiler libopenblas-dev
else
# Build from manylinux2014 container
yum -y install openblas-devel perl-IPC-Cmd unzip curl
# Disable safe directory in docker
git config --system --add safe.directory "*"
install_protobuf_centos
fi
fi

View File

@ -25,6 +25,7 @@ fn main() {
}
if cfg!(feature = "cuda") {
config.define("LLAMA_CUBLAS", "ON");
config.define("CMAKE_POSITION_INDEPENDENT_CODE", "ON");
println!("cargo:rustc-link-search=native=/usr/local/cuda/lib64");
println!("cargo:rustc-link-lib=cudart");
println!("cargo:rustc-link-lib=culibos");