Skip to content

Commit

Permalink
feat(ci): support manylinux build for cpu / cuda (#899)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys committed Nov 26, 2023
1 parent d7340c9 commit e24c365
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,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
Expand Down Expand Up @@ -111,17 +120,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 != 'pull_request'
Expand Down
19 changes: 18 additions & 1 deletion ci/prepare_build_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions crates/llama-cpp-bindings/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit e24c365

Please sign in to comment.