Skip to content

Commit

Permalink
Merge branch 'main' into sync-llama-cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Jan 19, 2025
2 parents f4fb6b5 + f084d66 commit 3ce570c
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ on:
jobs:
build-linux-x86_64:
runs-on: ubuntu-22.04
container: nvidia/cuda:12.6.2-devel-ubuntu22.04
steps:
- name: Upgrade git
run: apt-get update && apt-get install -y git
- uses: actions/checkout@v4
with:
submodules: "true"
Expand Down Expand Up @@ -55,7 +58,10 @@ jobs:

build-linux-arm64:
runs-on: ubuntu-22.04-arm
container: nvidia/cuda:12.6.2-devel-ubuntu22.04
steps:
- name: Upgrade git
run: apt-get update && apt-get install -y git
- uses: actions/checkout@v4
with:
submodules: "true"
Expand Down
2 changes: 1 addition & 1 deletion lib/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export interface Module {
LlamaContext: LlamaContext
}

export type LibVariant = 'default' | 'vulkan'
export type LibVariant = 'default' | 'vulkan' | 'cuda'

const setupEnv = (variant?: string) => {
const postfix = variant ? `-${variant}` : ''
Expand Down
21 changes: 21 additions & 0 deletions scripts/build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,28 @@ ARCH=${ARCH:-${1:-$(uname -m)}}
if [ $ARCH == "x86_64" ]; then
yarn clean && yarn build-native
yarn clean && yarn build-native --CDLLAMA_VULKAN=1 --CDVARIANT=vulkan

# Check CUDA is available
if [ -f /usr/local/cuda/bin/nvcc ]; then
yarn clean && yarn build-native \
--CDLLAMA_CUDA=1 \
--CDVARIANT=cuda \
--CDCMAKE_CUDA_ARCHITECTURES=89 # > GeForce RTX 40 series
else
echo "CUDA is not available, skipping CUDA build"
fi
else
yarn clean && yarn build-native --CDGGML_NATIVE=OFF
yarn clean && yarn build-native --CDGGML_NATIVE=OFF --CDLLAMA_VULKAN=1 --CDVULKAN_SDK="$(realpath 'externals/arm64-Vulkan-SDK')" --CDVARIANT=vulkan

# Check CUDA is available
if [ -f /usr/local/cuda/bin/nvcc ]; then
yarn clean && yarn build-native \
--CDLLAMA_CUDA=1 \
--CDVARIANT=cuda \
--CDGGML_NATIVE=OFF \
--CDCMAKE_CUDA_ARCHITECTURES=87 # > Jetson Orin series
else
echo "CUDA is not available, skipping CUDA build"
fi
fi
5 changes: 4 additions & 1 deletion scripts/prepare-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ export DEBIAN_FRONTEND=noninteractive

ARCH=${ARCH:-${1:-$(uname -m)}}

run_as_root apt-get update
run_as_root apt-get install -qy lsb-release wget

if [ $ARCH == "x86_64" ]; then
DISTRO=$(lsb_release -c -s)
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | run_as_root tee /etc/apt/trusted.gpg.d/lunarg.asc
run_as_root wget -qO /etc/apt/sources.list.d/lunarg-vulkan-1.3.280-$DISTRO.list https://packages.lunarg.com/vulkan/1.3.280/lunarg-vulkan-1.3.280-$DISTRO.list
run_as_root apt-get update
run_as_root apt-get install -qy vulkan-sdk
run_as_root apt-get install -qy vulkan-sdk cmake pkg-config build-essential libx11-xcb-dev libxkbcommon-dev libwayland-dev libxrandr-dev
else
run_as_root apt-get update
run_as_root apt-get install -qy curl gnupg2
Expand Down

0 comments on commit 3ce570c

Please sign in to comment.