Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
223 changes: 223 additions & 0 deletions .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
name: JUSTBUILD

on:
workflow_dispatch: # allows manual triggering
inputs:
create_release:
description: "Create new release"
required: true
type: boolean
push:
branches:
- master
paths:
[
".github/workflows/build-ci.yml",
"**/CMakeLists.txt",
"**/Makefile",
"**/*.h",
"**/*.hpp",
"**/*.c",
"**/*.cpp",
"**/*.cu",
"**/*.cuh",
"**/*.swift",
"**/*.m",
"**/*.metal",
]
pull_request:
types: [opened, synchronize, reopened]
paths:
[
".github/workflows/build-ci.yml",
"**/CMakeLists.txt",
"**/Makefile",
"**/*.h",
"**/*.hpp",
"**/*.c",
"**/*.cpp",
"**/*.cu",
"**/*.cuh",
"**/*.swift",
"**/*.m",
"**/*.metal",
]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true

# Fine-grant permission
# https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
#permissions:
# contents: write # for creating release
permissions: write-all

env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
#GGML_NLOOP: 3
#GGML_N_THREADS: 1
#LLAMA_LOG_COLORS: 1
#LLAMA_LOG_PREFIX: 1
#LLAMA_LOG_TIMESTAMPS: 1

jobs:
# CUDA Release

ubuntu-latest-cuda-cmake:
runs-on: ubuntu-latest

steps:
#- name: Free Disk Space (Ubuntu)
# uses: jlumbroso/free-disk-space@main
# with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
# tool-cache: true

# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
# android: true
# dotnet: true
# haskell: true
# large-packages: false
# docker-images: true
# swap-storage: false

- name: Clone
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Dependencies
id: depends
run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt-get update # Run apt-get update only once
sudo apt-get install -y build-essential libcurl4-openssl-dev ccache cuda-12-6
# sudo apt install software-properties-common
# sudo add-apt-repository ppa:ubuntu-toolchain-r/test
# sudo apt update
# sudo apt install gcc-13 g++-13
# sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13 --slave /usr/bin/g++ g++ /usr/bin/g++-13

- name: Build
id: cmake_build
run: |
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64 ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
mkdir build
cd build
cmake .. -DLLAMA_FATAL_WARNINGS=OFF -DBUILD_SHARED_LIBS=ON \
-DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES="86" \
-DCMAKE_C_FLAGS_RELEASE="-Ofast -DNDEBUG -flto -fno-finite-math-only -march=znver3" \
-DCMAKE_CXX_FLAGS_RELEASE="-Ofast -DNDEBUG -flto -march=znver3" \
-DCMAKE_CUDA_FLAGS_RELEASE="-O3 -DNDEBUG -Xcompiler=-Ofast,-march=znver3" \
-DCMAKE_LINK_FLAGS_RELEASE="-flto -threads" # Add linker flags for parallel LTO
cmake --build . --config Release -j $(nproc)

- name: Determine tag name
id: tag
shell: bash
run: |
BUILD_NUMBER="$(git rev-list --count HEAD)"
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
else
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
fi

- name: Pack artifacts
id: pack_artifacts
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
run: |
cp LICENSE ./build/bin/
# cp $(find . -name "*.so") ./build/bin/ # Not needed anymore
zip -r -j cudart-server-${{ steps.tag.outputs.name }}-rtx30-ubuntu-x64.zip ./build/bin/*

- name: Upload artifacts
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
uses: actions/upload-artifact@v4
with:
path: cudart-server-${{ steps.tag.outputs.name }}-rtx30-ubuntu-x64.zip
name: cudart-server-rtx30-ubuntu-x64.zip

# TODO: build with GGML_NO_METAL because test-backend-ops fail on "Apple Paravirtual device" and I don't know
# how to debug it.
# ref: https://github.com/ggerganov/llama.cpp/actions/runs/7131777249/job/19420981052#step:5:1124

release:
permissions: write-all


if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}

runs-on: ubuntu-latest

needs:
- ubuntu-latest-cuda-cmake
#- ubuntu-latest-vulkan-cmake

steps:
- name: Clone
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Determine tag name
id: tag
shell: bash
run: |
BUILD_NUMBER="$(git rev-list --count HEAD)"
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
else
SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
fi

- name: Download artifacts
id: download-artifact
uses: actions/download-artifact@v4
with:
path: ./artifact

- name: Move artifacts
id: move_artifacts
run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release

- name: Create release
id: create_release
uses: anzz1/action-create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.name }}

- name: Upload release
id: upload_release
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const path = require('path');
const fs = require('fs');
const release_id = '${{ steps.create_release.outputs.id }}';
for (let file of await fs.readdirSync('./artifact/release')) {
if (path.extname(file) === '.zip') {
console.log('uploadReleaseAsset', file);
await github.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release_id,
name: file,
data: await fs.readFileSync(`./artifact/release/${file}`)
});
}
}
2 changes: 1 addition & 1 deletion examples/llava/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-r ../../requirements/requirements-convert_legacy_llama.txt
--extra-index-url https://download.pytorch.org/whl/cpu
pillow~=10.2.0
pillow~=11.1.0
torch~=2.2.1
torchvision~=0.17.1
4 changes: 2 additions & 2 deletions examples/server/tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
aiohttp~=3.9.3
aiohttp~=3.11.12
pytest~=8.3.3
huggingface_hub~=0.23.2
numpy~=1.26.4
openai~=1.55.3
prometheus-client~=0.20.0
requests~=2.32.3
requests~=2.32.2
wget~=3.2
Loading
Loading