From cd72682396ff03e0f510f4559dd1b4a31d1d7f39 Mon Sep 17 00:00:00 2001 From: James Ravenscroft Date: Mon, 8 May 2023 11:38:25 +0100 Subject: [PATCH] update workflows with cuda build --- .github/workflows/build-commit.yml | 11 +++++++++++ .github/workflows/docker-image.yml | 21 ++++++++++++++++++--- Dockerfile.cuda | 29 +++++++++++++++++++++++++++++ Dockerfile => Dockerfile.default | 0 4 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 Dockerfile.cuda rename Dockerfile => Dockerfile.default (100%) diff --git a/.github/workflows/build-commit.yml b/.github/workflows/build-commit.yml index f549e80..af5f90d 100644 --- a/.github/workflows/build-commit.yml +++ b/.github/workflows/build-commit.yml @@ -75,6 +75,17 @@ jobs: # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix runs-on: ubuntu-latest + strategy: + matrix: + include: + - build: 'avx2' + defines: '' + - build: 'avx' + defines: '-DLLAMA_AVX2=OFF' + - build: 'avx512' + defines: '-DLLAMA_AVX512=ON' + + steps: - uses: actions/checkout@v3 with: diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 331e73c..bf1ccd4 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -13,6 +13,12 @@ jobs: runs-on: ubuntu-latest + strategy: + matrix: + config: + - {tag: "", dockerfile: "./Dockerfile.default"} + - {tags: "-cuda", dockerfile: "./Dockerfile.cuda"} + steps: - name: Checkout @@ -49,10 +55,19 @@ jobs: - name: Build and push release uses: docker/build-push-action@v4 - if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/') && matrix.config.tag == "" with: push: true tags: ghcr.io/ravenscroftj/turbopilot:${{ github.ref_name }}, ghcr.io/ravenscroftj/turbopilot:latest context: ${{github.workspace}} - platforms: linux/amd64,linux/arm64 - \ No newline at end of file + platforms: linux/amd64,linux/arm64 + + + - name: Build and push release (CUDA) + uses: docker/build-push-action@v4 + if: startsWith(github.ref, 'refs/tags/') && matrix.config.tag != "" + with: + push: true + tags: ghcr.io/ravenscroftj/turbopilot:${{ github.ref_name }} + context: ${{github.workspace}} + platforms: linux/amd64,linux/arm64 diff --git a/Dockerfile.cuda b/Dockerfile.cuda new file mode 100644 index 0000000..ac72a88 --- /dev/null +++ b/Dockerfile.cuda @@ -0,0 +1,29 @@ +FROM nvidia/cuda:11.7.1-devel-ubuntu22.04 AS build + +RUN apt-get update && apt-get install -y build-essential cmake libboost-dev + +ADD ./ggml /build/ggml + +RUN mkdir /build/ggml/build + +WORKDIR /build/ggml/build + +RUN cmake -DGGML_CUBLAS=ON -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc .. +RUN make codegen-serve + +FROM nvidia/cuda:11.7.1-cudnn8-runtime-ubuntu22.04 AS runtime + + +WORKDIR /app + +COPY --from=build /build/ggml/build/bin/codegen-serve /app/codegen-serve + +ENV THREADS=4 + +ENV MODEL="/models/codegen-2B-multi-ggml-4bit-quant.bin" + +COPY ./run.sh /app/ + +EXPOSE 18080 + +CMD /app/run.sh \ No newline at end of file diff --git a/Dockerfile b/Dockerfile.default similarity index 100% rename from Dockerfile rename to Dockerfile.default