From: Mathieu Baudier Date: Sun, 17 Aug 2025 06:32:04 +0000 (+0200) Subject: Introduce CUDA backend and Vulkan filter X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=f45909730e233b0c2f2d66b5c94312bf4aa75901;p=pkg%2Fggml%2Fsources%2Fggml Introduce CUDA backend and Vulkan filter --- diff --git a/debian/control b/debian/control index 9fdf9ff7..5d183fdc 100644 --- a/debian/control +++ b/debian/control @@ -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 , + glslc , + nvidia-cuda-toolkit-gcc , 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: 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: +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 index 00000000..bfd525d7 --- /dev/null +++ b/debian/libggml-backend-cuda.install @@ -0,0 +1 @@ +/usr/libexec/*/ggml/libggml-cuda.so diff --git a/debian/rules b/debian/rules index ef3dc9d7..ee1f3c97 100755 --- a/debian/rules +++ b/debian/rules @@ -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)