]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
Introduce CUDA backend and Vulkan filter
authorMathieu Baudier <redacted>
Sun, 17 Aug 2025 06:32:04 +0000 (08:32 +0200)
committerMathieu Baudier <redacted>
Sun, 17 Aug 2025 07:37:11 +0000 (09:37 +0200)
debian/control
debian/libggml-backend-cuda.install [new file with mode: 0644]
debian/rules

index 9fdf9ff7e5a1101faa597bcad2ad5e51597dfc68..5d183fdc94ff573df0c661fc76ad7bd6228984f3 100644 (file)
@@ -8,10 +8,12 @@ Vcs-Git: https://git.djapps.eu/pkg/ggml/sources/ggml
 Homepage: https://github.com/ggml-org/ggml
 Build-Depends: cmake,
                debhelper-compat (= 13),
-               libblas-dev,
+               libopenblas-openmp-dev,
+               libopenblas64-openmp-dev [amd64 arm64],
                pkgconf,
-               libvulkan-dev,
-               glslc,
+               libvulkan-dev            <!pkg.ggml.novulkan>,
+               glslc                    <!pkg.ggml.novulkan>,
+               nvidia-cuda-toolkit-gcc  <!pkg.ggml.nocuda>,
 Rules-Requires-Root: no
 
 Package: libggml-base0
@@ -26,7 +28,7 @@ Description: Tensor library for machine learning (base)
 Package: libggml0
 Architecture: any
 Multi-Arch: same
-Depends: libggml-base0,
+Depends: libggml-base0 (= ${binary:Version}),
          ${misc:Depends},
          ${shlibs:Depends},
 Description: Tensor library for machine learning (loader)
@@ -48,7 +50,7 @@ Description: Tensor library for machine learning (development files)
 Package: libggml-backend-cpu
 Architecture: any
 Multi-Arch: same
-Depends: libggml-base0,
+Depends: libggml-base0 (= ${binary:Version}),
          ${misc:Depends},
          ${shlibs:Depends}
 Description: Tensor library for machine learning (CPU backend)
@@ -63,7 +65,9 @@ Description: Tensor library for machine learning (CPU backend)
 Package: libggml-backend-blas
 Architecture: any
 Multi-Arch: same
-Depends: libggml-base0,
+Depends: libggml-base0 (= ${binary:Version}),
+         libopenblas0-openmp,
+         libopenblas64-0-openmp [amd64 arm64],
          ${misc:Depends},
          ${shlibs:Depends}
 Recommends: libopenblas0 | libblis4 | libmkl-rt | libblas3
@@ -84,10 +88,23 @@ Description: Tensor library for machine learning (RPC backend)
 Package: libggml-backend-vulkan
 Architecture: any
 Multi-Arch: same
-Depends: libggml-base0,
+Depends: libggml-base0 (= ${binary:Version}),
          ${misc:Depends},
          ${shlibs:Depends}
+Build-Profiles: <!pkg.ggml.novulkan>
 Description: Tensor library for machine learning (Vulkan backend)
  The ggml Vulkan backend provides hardware acceleration of the
  computations based on the Vulkan API. This is typically used
  to leverage GPU parallel computations capabilities.
+
+Package: libggml-backend-cuda
+Architecture: any
+Multi-Arch: same
+Depends: libggml-base0 (= ${binary:Version}),
+         ${misc:Depends},
+         ${shlibs:Depends}
+Build-Profiles: <!pkg.ggml.nocuda>
+Description: Tensor library for machine learning (CUDA backend)
+ The ggml CUDA backend provides hardware acceleration of the
+ computations based on the CUDA API. This is typically used
+ to leverage Nvidia GPU parallel computations capabilities.
diff --git a/debian/libggml-backend-cuda.install b/debian/libggml-backend-cuda.install
new file mode 100644 (file)
index 0000000..bfd525d
--- /dev/null
@@ -0,0 +1 @@
+/usr/libexec/*/ggml/libggml-cuda.so
index ef3dc9d785c269f5fdd2dfce40e14a016586e57b..ee1f3c97c1065c1aeaf7231c172940b073d86ee3 100755 (executable)
@@ -15,11 +15,24 @@ CMAKE_OPTS  = -DGGML_NATIVE=OFF \
 
 CMAKE_OPTS += -DGGML_CPU_ALL_VARIANTS=ON \
               -DGGML_BLAS=ON \
-              -DGGML_VULKAN=ON \
+              -DGGML_BLAS_VENDOR=OpenBLAS \
               -DGGML_RPC=ON \
 
+ifeq ($(filter pkg.ggml.novulkan,$(DEB_BUILD_PROFILES)),)
+CMAKE_OPTS += -DGGML_VULKAN=ON
+endif
+
+ifeq ($(filter pkg.ggml.nocuda,$(DEB_BUILD_PROFILES)),)
+CMAKE_OPTS += -DGGML_CUDA=ON \
+              -DGGML_CUDA_FORCE_MMQ=ON \
+              -DGGML_CUDA_FA_ALL_QUANTS=OFF \
+              -DCUDAToolkit_ROOT=/usr
+endif
+
+# Use build/ for output, so that it is in the .gitignore of upstream
 %:
-       dh $@ --buildsystem=cmake
+       dh $@ --buildsystem=cmake \
+        --builddirectory=build/$(DEB_HOST_MULTIARCH)
 
 override_dh_auto_configure:
        dh_auto_configure -- $(CMAKE_OPTS)