Bug#1113813: llama.cpp: please make the build reproducible
Source: llama.cpp
Version: 5882+dfsg-3
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: cpu
X-Debbugs-Cc: reproducible-bugs@lists.alioth.debian.org
Hi,
Whilst working on the Reproducible Builds effort [0], we noticed that
llama.cpp could not be built reproducibly.
This is because the llama-bench.1 manual page embeds the number of
CPUs:
│ │ │ ├── ./usr/share/man/man1/llama-bench.1.gz
│ │ │ │ ├── llama-bench.1
│ │ │ │ │ @@ -63,15 +63,15 @@
│ │ │ │ │ \fB\-dt\fR, \fB\-\-defrag\-thold\fR <f>
│ │ │ │ │ (default: \fB\-1\fR)
│ │ │ │ │ .TP
│ │ │ │ │ \fB\-t\fR, \fB\-\-threads\fR <n>
│ │ │ │ │ -(default: 16)
│ │ │ │ │ +(default: 12)
│ │ │ │ │ .TP
A patch is attached that replaces this nondetermistic value with a
placeholder value; the default is still calculated at runtime.
[0] https://reproducible-builds.org/
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` lamby@debian.org / chris-lamb.co.uk
`-
--- a/debian/patches/reproducible-builds.patch 1969-12-31 16:00:00.000000000 -0800
--- b/debian/patches/reproducible-builds.patch 2025-09-02 14:32:40.264552665 -0700
@@ -0,0 +1,15 @@
+Description: Make the build reproducible
+Author: Chris Lamb <lamby@debian.org>
+Last-Update: 2025-09-02
+
+--- llama.cpp-5882+dfsg.orig/common/arg.cpp
++++ llama.cpp-5882+dfsg/common/arg.cpp
+@@ -1297,7 +1297,7 @@ common_params_context common_params_pars
+ ).set_examples({LLAMA_EXAMPLE_MAIN, LLAMA_EXAMPLE_SPECULATIVE, LLAMA_EXAMPLE_LOOKUP}));
+ add_opt(common_arg(
+ {"-t", "--threads"}, "N",
+- string_format("number of threads to use during generation (default: %d)", params.cpuparams.n_threads),
++ "number of threads to use during generation (default: <num_cpus>)",
+ [](common_params & params, int value) {
+ params.cpuparams.n_threads = value;
+ if (params.cpuparams.n_threads <= 0) {
--- a/debian/patches/series 2025-09-02 14:22:06.037488030 -0700
--- b/debian/patches/series 2025-09-02 14:32:38.842189218 -0700
@@ -3,3 +3,4 @@
cmake-Install-to-private-directories.patch
gguf-py-depends-on-the-requests-library.patch
Add-soversion-to-libraries.patch
+reproducible-builds.patch
Reply to: