Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency Building In Github Action #126

Merged
merged 50 commits into from
Aug 28, 2023
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
576abb1
Added a scheduled action
martindevans Aug 27, 2023
2a8b233
checking out llamasharp and llama.cpp
martindevans Aug 27, 2023
8dff3ee
Allowed compile action to be manually run
martindevans Aug 27, 2023
c836148
Added a trigger on push to cron branch
martindevans Aug 27, 2023
c0dfd16
Fixed weird characters
martindevans Aug 27, 2023
7651986
Running make
martindevans Aug 27, 2023
02625d4
Added ls
martindevans Aug 27, 2023
87cbc00
fixed artifact path
martindevans Aug 27, 2023
dd3d580
building the libllama.so target
martindevans Aug 27, 2023
937fd3c
Made job run on linux only for now
martindevans Aug 27, 2023
25ab780
Added windows build copied mostly from llama.cpp
martindevans Aug 27, 2023
4bd02fc
Removed BLAS steps
martindevans Aug 27, 2023
08349a0
No longer checking out into subfolder
martindevans Aug 27, 2023
b66be42
fixed repo name
martindevans Aug 27, 2023
5f04423
Always running artifact jobs
martindevans Aug 27, 2023
c1ae992
Changed name for windows artifacts
martindevans Aug 27, 2023
568860f
fixed file naming
martindevans Aug 27, 2023
6c3a94c
always building shared libs
martindevans Aug 27, 2023
ec43ea3
- Removed server build
martindevans Aug 27, 2023
1a07436
Added cuda build
martindevans Aug 27, 2023
578f608
cloning the right repo
martindevans Aug 27, 2023
ed0879d
always uploading cuda artifacts
martindevans Aug 27, 2023
5b2efea
added matrix for linux build, swapped to cmake
martindevans Aug 27, 2023
34a35e8
swapped path and name
martindevans Aug 27, 2023
2c10781
added an ls to display build outputs
martindevans Aug 27, 2023
75272e9
disabled windows builds for now
martindevans Aug 27, 2023
5a08f2e
grabbing libllama from correct location
martindevans Aug 27, 2023
0d7ddce
Full build on all platforms
martindevans Aug 27, 2023
8b6eb37
Packaging all deps into artifacts for nuget:
martindevans Aug 27, 2023
4001105
fixed path
martindevans Aug 27, 2023
b50f1f4
rearranged how artifacts are uploaded
martindevans Aug 27, 2023
fe4004f
Added a boolean to disable cuda compiling
martindevans Aug 27, 2023
2555f8d
disabled cublas compiling
martindevans Aug 27, 2023
ced29e9
syntax
martindevans Aug 27, 2023
40a3034
- building less extra stuff
martindevans Aug 27, 2023
2bacfc8
Fixed artifact download
martindevans Aug 27, 2023
43c8117
Added conditional compilation for cuda
martindevans Aug 27, 2023
d31130e
Fixed file names
martindevans Aug 27, 2023
644947d
Fixed noavx path
martindevans Aug 27, 2023
e76ac23
- enabled fail-fast
martindevans Aug 27, 2023
3350878
Removing individual file artifacts after they have been packaged
martindevans Aug 27, 2023
0d0e6ba
Added macos build
martindevans Aug 27, 2023
67942d4
Named stages properly
martindevans Aug 27, 2023
6a7b0c1
Removed conditional for now
martindevans Aug 27, 2023
046ef25
fixed arch
martindevans Aug 27, 2023
4c5c64d
Fixed env vars?
martindevans Aug 27, 2023
0316b68
ok that didn't fix it
martindevans Aug 27, 2023
0febfa4
- Packaging macos dylibs
martindevans Aug 27, 2023
37aeb49
creating folders
martindevans Aug 27, 2023
11b87d4
Added some options to the manual build dispatch
martindevans Aug 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
232 changes: 232 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
name: Update Binaries

on:
workflow_dispatch:
inputs:
cublas:
type: boolean
description: Build CUBLAS binaries
macos:
type: boolean
description: Build MacOS binaries
push:
branches: [cron_job]
#schedule:
# - cron: "22 22 * * 2"

jobs:
compile-linux:
name: Compile (Linux)
strategy:
fail-fast: true
matrix:
include:
- build: 'noavx'
defines: '-DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_SERVER=OFF -DLLAMA_AVX=OFF -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF -DBUILD_SHARED_LIBS=ON'
- build: 'avx2'
defines: '-DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_SERVER=OFF -DBUILD_SHARED_LIBS=ON'
- build: 'avx'
defines: '-DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_SERVER=OFF -DLLAMA_AVX2=OFF -DBUILD_SHARED_LIBS=ON'
- build: 'avx512'
defines: '-DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_SERVER=OFF -DLLAMA_AVX512=ON -DBUILD_SHARED_LIBS=ON'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: ggerganov/llama.cpp
- name: Build
id: cmake_build
run: |
mkdir build
cd build
cmake .. ${{ matrix.defines }}
cmake --build . --config Release
- uses: actions/upload-artifact@v3
with:
path: ./build/libllama.so
name: llama-bin-linux-${{ matrix.build }}-x64.so

compile-windows:
name: Compile (Windows)
strategy:
fail-fast: true
matrix:
include:
- build: 'noavx'
defines: '-DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_SERVER=OFF -DLLAMA_AVX=OFF -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF -DBUILD_SHARED_LIBS=ON'
- build: 'avx2'
defines: '-DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_SERVER=OFF -DBUILD_SHARED_LIBS=ON'
- build: 'avx'
defines: '-DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_SERVER=OFF -DLLAMA_AVX2=OFF -DBUILD_SHARED_LIBS=ON'
- build: 'avx512'
defines: '-DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_SERVER=OFF -DLLAMA_AVX512=ON -DBUILD_SHARED_LIBS=ON'
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
repository: ggerganov/llama.cpp

- name: Build
id: cmake_build
run: |
mkdir build
cd build
cmake .. ${{ matrix.defines }}
cmake --build . --config Release

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: .\build\bin\Release\llama.dll
name: llama-bin-win-${{ matrix.build }}-x64.dll

compile-windows-cublas:
if: ${{ github.event.inputs.cublas }}
name: Compile (cublas)
runs-on: windows-latest
strategy:
matrix:
cuda: ['12.1.0', '11.7.1']
steps:
- name: Clone
id: checkout
uses: actions/checkout@v3
with:
repository: ggerganov/llama.cpp

- uses: Jimver/cuda-toolkit@v0.2.10
id: cuda-toolkit
with:
cuda: ${{ matrix.cuda }}

- name: Build
id: cmake_build
run: |
mkdir build
cd build
cmake .. -DLLAMA_CUBLAS=ON -DBUILD_SHARED_LIBS=ON
cmake --build . --config Release

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: .\build\bin\Release\llama.dll
name: llama-bin-win-cublas-cu${{ matrix.cuda }}-x64.dll

compile-macos:
if: ${{ github.event.inputs.macos }}
name: Compile (MacOS)
runs-on: macos-latest
strategy:
fail-fast: true
matrix:
include:
- build: 'arm64'
arch: 'arm64'
- build: 'x86_64'
arch: 'x86_64'

steps:
- uses: actions/checkout@v3
with:
repository: ggerganov/llama.cpp

- name: Dependencies
continue-on-error: true
run: |
brew update

- name: Build
id: cmake_build
run: |
mkdir build
cd build
cmake -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_SERVER=OFF -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} ..
cmake --build . --config Release

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: ./build/libllama.dylib
name: llama-bin-macos-${{ matrix.arch }}.dylib

build-deps:
runs-on: ubuntu-latest
name: "Gather Binaries"
if: ${{ always() }}
needs: [
"compile-linux",
"compile-macos",
"compile-windows",
"compile-windows-cublas"
]
steps:
- uses: actions/download-artifact@v3
with:
path: artifacts

- name: Rearrange Files
run: |
ls -R

mkdir deps

mkdir deps/linux
mkdir deps/linux/noavx
cp artifacts/llama-bin-linux-noavx-x64.so/libllama.so deps/linux/noavx/libllama.so
mkdir deps/linux/avx
cp artifacts/llama-bin-linux-avx-x64.so/libllama.so deps/linux/avx/libllama.so
mkdir deps/linux/avx2
cp artifacts/llama-bin-linux-avx2-x64.so/libllama.so deps/linux/avx2/libllama.so
mkdir deps/linux/avx512
cp artifacts/llama-bin-linux-avx512-x64.so/libllama.so deps/linux/avx512/libllama.so

mkdir deps/win
mkdir deps/win/noavx
cp artifacts/llama-bin-win-noavx-x64.dll/llama.dll deps/win/noavx/libllama.dll
mkdir deps/win/avx
cp artifacts/llama-bin-win-avx-x64.dll/llama.dll deps/win/avx/libllama.dll
mkdir deps/win/avx2
cp artifacts/llama-bin-win-avx2-x64.dll/llama.dll deps/win/avx2/libllama.dll
mkdir deps/win/avx512
cp artifacts/llama-bin-win-avx512-x64.dll/llama.dll deps/win/avx512/libllama.dll

- name: Rearrange MacOS files
if: ${{ github.event.inputs.macos }}
run: |
mkdir deps/macos-arm64
mkdir deps/macos-x86_64
cp artifacts/llama-bin-macos-arm64.dylib/libllama.dylib deps/macos-arm64/libllama.dylib
cp artifacts/llama-bin-macos-x86_64.dylib/libllama.dylib deps/macos-x86_64/libllama.dylib

- name: Rearrange CUDA files
if: ${{ github.event.inputs.cublas }}
run: |
mkdir deps/win/cu12.1.0
mkdir deps/win/cu11.7.1
cp artifacts/llama-bin-win-cublas-cu11.7.1-x64.dll/llama.dll cu11.7.1/libllama.dll
cp artifacts/llama-bin-win-cublas-cu12.1.0-x64.dll/llama.dll cu12.1.0/libllama.dll

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
path: deps/
name: deps
- name: Upload artifacts (CUDA12)
if: ${{ github.event.inputs.cublas }}
uses: actions/upload-artifact@v3
with:
path: cu12.1.0/
name: cu12.1.0
- name: Upload artifacts (CUDA11)
if: ${{ github.event.inputs.cublas }}
uses: actions/upload-artifact@v3
with:
path: cu11.7.1/
name: cu11.7.1

- name: Remove Artifacts
uses: geekyeggo/delete-artifact@v2
with:
name: |
llama-*
Loading