Skip to content

Commit ffd1c33

Browse files
author
Daniele Briggi
committed
feat(windows-cuda): make CUDA for Windows
1 parent 82e79e9 commit ffd1c33

File tree

2 files changed

+33
-24
lines changed

2 files changed

+33
-24
lines changed

.github/workflows/main.yml

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,34 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
include:
18-
- name: linux-vulkan
19-
os: ubuntu-latest
20-
arch: x86_64
21-
make: LLAMA="-DGGML_BACKEND_DL=ON -DGGML_NATIVE=OFF -DGGML_CPU_ALL_VARIANTS=ON -DGGML_VULKAN=ON"
22-
- name: macos
23-
os: macos-latest
24-
- name: windows
18+
# - name: linux-vulkan
19+
# os: ubuntu-latest
20+
# arch: x86_64
21+
# make: LLAMA="-DGGML_BACKEND_DL=ON -DGGML_NATIVE=OFF -DGGML_CPU_ALL_VARIANTS=ON -DGGML_VULKAN=ON"
22+
# - name: macos
23+
# os: macos-latest
24+
# - name: windows
25+
# os: windows-latest
26+
# arch: x86_64
27+
- name: windows-cuda
2528
os: windows-latest
2629
arch: x86_64
27-
- name: android
28-
os: ubuntu-latest
29-
arch: arm64-v8a
30-
make: PLATFORM=android ARCH=arm64-v8a
31-
- name: android
32-
os: ubuntu-latest
33-
arch: x86_64
34-
make: PLATFORM=android ARCH=x86_64
35-
sqlite-amalgamation-zip: https://sqlite.org/2025/sqlite-amalgamation-3490100.zip
36-
- name: ios
37-
os: macos-latest
38-
make: PLATFORM=ios
39-
- name: isim
40-
os: macos-latest
41-
make: PLATFORM=isim
30+
make: LLAMA="-DGGML_BACKEND_DL=ON -DGGML_NATIVE=OFF -DGGML_CPU=OFF -DGGML_CUDA=ON"
31+
# - name: android
32+
# os: ubuntu-latest
33+
# arch: arm64-v8a
34+
# make: PLATFORM=android ARCH=arm64-v8a
35+
# - name: android
36+
# os: ubuntu-latest
37+
# arch: x86_64
38+
# make: PLATFORM=android ARCH=x86_64
39+
# sqlite-amalgamation-zip: https://sqlite.org/2025/sqlite-amalgamation-3490100.zip
40+
# - name: ios
41+
# os: macos-latest
42+
# make: PLATFORM=ios
43+
# - name: isim
44+
# os: macos-latest
45+
# make: PLATFORM=isim
4246

4347
defaults:
4448
run:
@@ -57,6 +61,7 @@ jobs:
5761
install: >-
5862
mingw-w64-x86_64-cc
5963
mingw-w64-x86_64-cmake
64+
mingw-w64-x86_64-cuda
6065
make
6166
6267
- name: linux install dependencies
@@ -89,7 +94,7 @@ jobs:
8994
shell: msys2 {0}
9095

9196
- name: windows build sqlite-ai
92-
if: matrix.name == 'windows'
97+
if: matrix.name == 'windows' || matrix.name == 'windows-cuda'
9398
run: make extension ${{ matrix.make && matrix.make || ''}}
9499
shell: msys2 {0}
95100

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ MINIAUDIO_LIBS = $(BUILD_MINIAUDIO)/libminiaudio.a
6262
ifeq ($(PLATFORM),windows)
6363
TARGET := $(DIST_DIR)/ai.dll
6464
LDFLAGS = -L./$(BUILD_LLAMA)/common -L./$(BUILD_LLAMA)/ggml/src -L./$(BUILD_LLAMA)/src -L./$(BUILD_WHISPER)/src -L./$(BUILD_MINIAUDIO) -l:libllama.a -l:libwhisper.a -l:libminiaudio.a -l:libcommon.a -l:ggml.a -l:ggml-cpu.a -l:ggml-base.a -fopenmp -static-libgcc -static-libstdc++ -shared -lbcrypt
65+
CXXFLAGS += -std=c++17
66+
LLAMA_OPTIONS += -DCMAKE_CXX_STANDARD=17
67+
WHISPER_OPTIONS += -DCMAKE_CXX_STANDARD=17
68+
MINIAUDIO_OPTIONS += -DCMAKE_CXX_STANDARD=17
6569
# Create .def file for Windows
6670
DEF_FILE := $(BUILD_DIR)/ai.def
6771
STRIP = strip --strip-unneeded $@
@@ -128,7 +132,7 @@ else ifeq ($(PLATFORM),isim)
128132
WHISPER_OPTIONS += -DBUILD_SHARED_LIBS=OFF -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0 -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DWHISPER_COREML=ON
129133
else # linux
130134
TARGET := $(DIST_DIR)/ai.so
131-
# using -DGGML_CPU_ALL_VARIANTS=ON
135+
# Using -DGGML_CPU_ALL_VARIANTS=ON, `-lggml-cpu` is not needed
132136
LDFLAGS := $(filter-out -lggml-cpu,$(LDFLAGS))
133137
LDFLAGS += -shared -L./$(BUILD_LLAMA)/bin -Wl,-rpath,./$(BUILD_LLAMA)/bin -Wl,-rpath,./$(BUILD_LLAMA)/common -Wl,-rpath,./$(BUILD_LLAMA)/ggml/src -Wl,-rpath,./$(BUILD_LLAMA)/src -Wl,-rpath,./$(BUILD_WHISPER)/src
134138
# Add miniaudio Linux-specific flags (as per miniaudio docs)

0 commit comments

Comments
 (0)