Skip to content

Commit

Permalink
test builds
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusDunn committed Jan 17, 2024
1 parent 9cb679c commit 4f03195
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ updates:
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: github-actions
directory: /
schedule:
interval: "weekly"
22 changes: 21 additions & 1 deletion .github/workflows/llama-cpp-rs-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,24 @@ jobs:
- name: Fmt
run: cargo fmt
- name: Test
run: cargo test
run: cargo test
arm64:
name: Check that it builds on various targets
runs-on: ubuntu-latest
strategy:
matrix:
target: [ linux/arm64, linux/amd64 ]
steps:
- name: checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Setup QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3
with:
platforms: arm64,amd64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226
- name: Build
uses: docker/build-push-action@v5
with:
file: test-build.Dockerfile
platforms: ${{ matrix.target }}
17 changes: 14 additions & 3 deletions llama-cpp-2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,24 @@ A wrapper around the [llama-cpp](https://github.com/ggerganov/llama.cpp/) librar

# Info

This is part of the project powering all the LLMs at [utilityai], it is tighly coupled llama.cpp and mimics its API as closly as possible while being safe in order to stay up to date.
This is part of the project powering all the LLMs at [utilityai], it is tightly coupled llama.cpp and mimics its API as
closly as possible while being safe in order to stay up to date.

# Dependencies

This uses bindgen to build the bindings to llama.cpp. This means that you need to have clang installed on your system.

If this is a problem for you, open an issue, and we can look into including the bindings.

See [bindgen](https://rust-lang.github.io/rust-bindgen/requirements.html) for more information.

# Disclaimer

This is not a simple library to use. In an ideal work a nice abstraction would be written on top of this crate to provide an ergonomic API - the benfits of this crate over raw bindings is safety and not much else.
This is not a simple library to use. In an ideal work a nice abstraction would be written on top of this crate to
provide an ergonomic API - the benefits of this crate over raw bindings is safety and not much else.

We compensate for this shortcoming (we hope) by providing lots of examples and good documentation. Testing is a work in progress.
We compensate for this shortcoming (we hope) by providing lots of examples and good documentation. Testing is a work in
progress.

# Contributing

Expand Down
12 changes: 12 additions & 0 deletions llama-cpp-sys-2/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ fn main() {

println!("cargo:rustc-link-search=native=/usr/local/cuda/lib64");

if cfg!(target_arch = "aarch64") {
ggml_cuda
.flag_if_supported("-mfp16-format=ieee")
.flag_if_supported("-mno-unaligned-access");
llama_cpp
.flag_if_supported("-mfp16-format=ieee")
.flag_if_supported("-mno-unaligned-access");
ggml_cuda
.flag_if_supported("-mfp16-format=ieee")
.flag_if_supported("-mno-unaligned-access");
}

ggml_cuda
.cuda(true)
.std("c++11")
Expand Down
11 changes: 11 additions & 0 deletions test-build.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Builds the project in a docker container This is used to test arm and x86 builds using github actions + docker.
# This also requires us to declare all the dependencies in the dockerfile usful as documentation.
FROM rust:bookworm AS builder
# Install requirements for bindgen: https://rust-lang.github.io/rust-bindgen/requirements.html
RUN apt update && apt install -y llvm-dev libclang-dev clang
COPY . .
RUN cargo build --release --example simple

FROM debian:bookworm-slim
COPY --from=builder /target/release/examples/simple /usr/local/bin/simple
ENTRYPOINT ["/usr/local/bin/simple"]

0 comments on commit 4f03195

Please sign in to comment.