Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / benchmark.scm
CommitLineData
c3ccba92 1;;; GNU Guix --- Functional package management for GNU
ac6fec05 2;;; Copyright © 2016, 2017 Marius Bakke <mbakke@fastmail.com>
04717e94 3;;; Copyright © 2017 Dave Love <fx@gnu.org>
828b4a91 4;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
61e265d2 5;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
4b444fc5 6;;; Copyright © 2019 Eric Bavier <bavier@member.fsf.org>
4c7e8c23 7;;; Copyright © 2019 Gábor Boskovits <boskovits@gmail.com>
2d6f68aa 8;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
176dd26b 9;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
d1ecb3bd 10;;; Copyright © 2020 malte Frank Gerdes <malte.f.gerdes@gmail.com>
8999d2b4 11;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
b9ab9fee 12;;; Copyright © 2020 Greg Hogan <code@greghogan.com>
fb8baf0c 13;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
c3ccba92
MB
14;;;
15;;; This file is part of GNU Guix.
16;;;
17;;; GNU Guix is free software; you can redistribute it and/or modify it
18;;; under the terms of the GNU General Public License as published by
19;;; the Free Software Foundation; either version 3 of the License, or (at
20;;; your option) any later version.
21;;;
22;;; GNU Guix is distributed in the hope that it will be useful, but
23;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25;;; GNU General Public License for more details.
26;;;
27;;; You should have received a copy of the GNU General Public License
28;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29
30(define-module (gnu packages benchmark)
31 #:use-module ((guix licenses) #:prefix license:)
32 #:use-module (guix packages)
33 #:use-module (guix download)
4b444fc5 34 #:use-module (guix git-download)
4c7e8c23 35 #:use-module (guix build-system cmake)
c3ccba92 36 #:use-module (guix build-system gnu)
5795f566 37 #:use-module (guix build-system python)
4c7e8c23
GB
38 #:use-module (gnu packages)
39 #:use-module (gnu packages check)
c3ccba92 40 #:use-module (gnu packages compression)
ac6fec05
MB
41 #:use-module (gnu packages linux)
42 #:use-module (gnu packages maths)
04717e94 43 #:use-module (gnu packages mpi)
176dd26b 44 #:use-module (gnu packages perl)
aadead6f 45 #:use-module (gnu packages python)
312ec128 46 #:use-module (gnu packages python-science)
5795f566 47 #:use-module (gnu packages python-web)
44d10b1f 48 #:use-module (gnu packages python-xyz)
04717e94
DL
49 #:use-module (gnu packages storage)
50 #:use-module (ice-9 match))
c3ccba92
MB
51
52(define-public fio
53 (package
54 (name "fio")
828b4a91 55 (version "3.26")
c3ccba92
MB
56 (source (origin
57 (method url-fetch)
2dffd9c6 58 (uri (string-append "https://brick.kernel.dk/snaps/"
b31e1561 59 "fio-" version ".tar.bz2"))
c3ccba92
MB
60 (sha256
61 (base32
828b4a91 62 "1114h60vw63bim872an33xpvjfib6sc9dwj9xvk0yw41xjzfpp06"))))
c3ccba92
MB
63 (build-system gnu-build-system)
64 (arguments
cf46d071 65 '(#:test-target "test"
c3ccba92
MB
66 #:phases
67 (modify-phases %standard-phases
ac6fec05
MB
68 (add-after
69 'unpack 'patch-paths
70 (lambda* (#:key inputs outputs #:allow-other-keys)
71 (let ((out (assoc-ref outputs "out"))
72 (gnuplot (string-append (assoc-ref inputs "gnuplot")
73 "/bin/gnuplot")))
74 (substitute* "tools/plot/fio2gnuplot"
75 (("/usr/share/fio") (string-append out "/share/fio"))
76 ;; FIXME (upstream): The 'gnuplot' executable is used inline
77 ;; in various os.system() calls mixed with *.gnuplot filenames.
78 (("; do gnuplot") (string-append "; do " gnuplot))
79 (("gnuplot mymath") (string-append gnuplot " mymath"))
80 (("gnuplot mygraph") (string-append gnuplot " mygraph")))
81 #t)))
c3ccba92
MB
82 (replace 'configure
83 (lambda* (#:key outputs #:allow-other-keys)
84 ;; The configure script doesn't understand some of the
85 ;; GNU options, so we can't use #:configure-flags.
86 (let ((out (assoc-ref outputs "out")))
1cc3e26b
TGR
87 (invoke "./configure"
88 (string-append "--prefix=" out))
89 #t)))
f125ec8e
MB
90 ;; The main `fio` executable is fairly small and self contained.
91 ;; Moving the auxiliary python and gnuplot scripts to a separate
92 ;; output saves almost 400 MiB on the closure.
93 (add-after 'install 'move-outputs
94 (lambda* (#:key outputs #:allow-other-keys)
95 (let ((oldbin (string-append (assoc-ref outputs "out") "/bin"))
96 (newbin (string-append (assoc-ref outputs "utils") "/bin")))
97 (mkdir-p newbin)
98 (for-each (lambda (file)
99 (let ((src (string-append oldbin "/" file))
100 (dst (string-append newbin "/" file)))
101 (link src dst)
102 (delete-file src)))
20d2e1fa
MB
103 '("fio2gnuplot" "fiologparser_hist.py"
104 "fiologparser.py"))
f125ec8e
MB
105 ;; Make sure numpy et.al is found.
106 (wrap-program (string-append newbin "/fiologparser_hist.py")
d42245d4 107 `("GUIX_PYTHONPATH" ":" prefix (,(getenv "GUIX_PYTHONPATH"))))
f125ec8e
MB
108 #t))))))
109 (outputs '("out" "utils"))
c3ccba92 110 (inputs
aadead6f
MB
111 `(("ceph" ,ceph "lib")
112 ("libaio" ,libaio)
ac6fec05
MB
113 ("gnuplot" ,gnuplot)
114 ("zlib" ,zlib)
115 ("python-numpy" ,python2-numpy)
116 ("python-pandas" ,python2-pandas)
117 ("python" ,python-2)))
c3ccba92
MB
118 (home-page "https://github.com/axboe/fio")
119 (synopsis "Flexible I/O tester")
120 (description
121 "fio is a tool that will spawn a number of threads or processes doing a
122particular type of I/O action as specified by the user. The typical use of fio
123is to write a job file matching the I/O load one wants to simulate.")
124 ;; The software is distributed under the GPL2, but a handful of components
125 ;; are covered by other licenses.
126 (license (list license:gpl2 license:gpl2+ license:bsd-2
127 license:public-domain))))
04717e94
DL
128
129;; Parameterized in anticipation of m(va)pich support
2d6f68aa 130(define (intel-mpi-benchmarks mpi)
04717e94 131 (package
2d6f68aa
LC
132 (name (string-append "intel-mpi-benchmarks"
133 (if (string=? (package-name mpi) "openmpi")
134 ""
135 (string-append "-" (package-name mpi)))))
b9ab9fee 136 (version "2019.6")
2d6f68aa
LC
137 (source (origin
138 (method git-fetch)
139 (uri (git-reference
b0e7b699 140 (url "https://github.com/intel/mpi-benchmarks")
2d6f68aa
LC
141 (commit (string-append "IMB-v" version))))
142 (file-name (git-file-name name version))
143 (sha256
144 (base32
b9ab9fee
GH
145 "02hxbk9g9nl59bk5qcfl3djj7b58vsqys340m1xdbyqwcrbnahh9"))
146 (modules '((guix build utils)))
147 (snippet
148 '(begin
149 ;; Some source configuration files in the original tarball
150 ;; have inappropriate execute permissions, which interferes
151 ;; with the install phase below.
152 (for-each (lambda (file) (chmod file #o444))
153 (find-files "WINDOWS" "."))
154 #t))))
04717e94
DL
155 (build-system gnu-build-system)
156 (inputs
157 `(("mpi" ,mpi)))
158 (arguments
159 `(#:phases
160 (modify-phases %standard-phases
161 (delete 'configure)
162 (delete 'check)
04717e94
DL
163 (replace 'install
164 (lambda* (#:key outputs #:allow-other-keys)
2d6f68aa
LC
165 (define (benchmark? file stat)
166 (and (string-prefix? "IMB-" (basename file))
167 (executable-file? file)))
168
04717e94 169 (let* ((out (assoc-ref outputs "out"))
04717e94 170 (bin (string-append out "/bin")))
2d6f68aa
LC
171 (for-each (lambda (file)
172 (install-file file bin))
173 (find-files "." benchmark?))
174 #t))))
175
176 ;; The makefile doesn't express all the dependencies, it seems.
177 #:parallel-build? #t
178
179 #:make-flags '("CC=mpicc" "CXX=mpicxx")))
04717e94 180 (home-page "https://software.intel.com/en-us/articles/intel-mpi-benchmarks")
2d6f68aa 181 (synopsis "Benchmarks for the Message Passing Interface (MPI)")
04717e94
DL
182 (description
183 "This package provides benchmarks for implementations of the @dfn{Message
184Passing Interface} (MPI). It contains MPI performance measurements for
185point-to-point and global communication, and file, operations for a range of
186message sizes. The generated benchmark data fully characterize:
187
188@itemize
189@item
190Performance of a cluster system, including node performance, network latency,
191and throughput;
192@item
193Efficiency of the MPI implementation.
194@end itemize")
195 (license license:cpl1.0)))
196
2d6f68aa
LC
197(define-public intel-mpi-benchmarks/openmpi
198 (intel-mpi-benchmarks openmpi))
199
200(define-public imb-openmpi
201 (deprecated-package "imb-openmpi" intel-mpi-benchmarks/openmpi))
61e265d2
RW
202
203(define-public multitime
204 (package
205 (name "multitime")
206 (version "1.4")
207 (source (origin
208 (method url-fetch)
209 (uri (string-append "https://tratt.net/laurie/src/"
210 "multitime/releases/"
211 "multitime-" version ".tar.gz"))
212 (sha256
213 (base32
214 "0iyfsdrbyqa7a4ifrh19l9a48hgv7ld6m0d8yf9bkl12q0qw91fx"))))
215 (build-system gnu-build-system)
216 (arguments '(#:tests? #f)) ; there are no tests
217 (home-page "https://tratt.net/laurie/src/multitime/")
218 (synopsis "Time command execution over multiple executions")
219 (description
220 "The @code{time} utility is a simple and often effective way of measuring
221how long a command takes to run (wall time). Unfortunately, running a command
222once can give misleading timings. @code{multitime} is, in essence, a simple
223extension to @code{time} which runs a command multiple times and prints the
224timing means, standard deviations, mins, medians, and maxes having done so.
225This can give a much better understanding of the command's performance.")
226 (license license:expat)))
4c7e8c23
GB
227
228(define-public benchmark
229 (package
230 (name "benchmark")
0e801d35 231 (version "1.5.3")
4c7e8c23
GB
232 (source (origin
233 (method git-fetch)
234 (uri (git-reference
b0e7b699 235 (url "https://github.com/google/benchmark")
4c7e8c23
GB
236 (commit (string-append "v" version))))
237 (file-name (git-file-name name version))
238 (sha256
239 (base32
0e801d35 240 "1hls0aqqj5cfldn9jfpvzjhpxkhrydrz9crp477rwllwjsybdxw7"))))
4c7e8c23
GB
241 (build-system cmake-build-system)
242 (native-inputs
d1ecb3bd
MFG
243 `(("googletest-source" ,(package-source googletest))
244 ("googletest" ,googletest)))
245 (arguments
246 `(#:phases
247 (modify-phases %standard-phases
248 (add-after 'unpack 'unpack-googletest
249 (lambda* (#:key inputs #:allow-other-keys)
250 (copy-recursively (assoc-ref inputs "googletest-source")
251 "googletest")
252 #t)))))
4c7e8c23
GB
253 (home-page "https://github.com/google/benchmark")
254 (synopsis "Microbenchmark support library")
255 (description
d1ecb3bd
MFG
256 "Benchmark is a library to benchmark code snippets, similar to unit
257tests.")
4c7e8c23 258 (license license:asl2.0)))
176dd26b
VL
259
260(define-public bonnie++
261 (package
262 (name "bonnie++")
263 (version "1.98")
264 (source (origin
265 (method url-fetch)
266 (uri (string-append "https://www.coker.com.au/bonnie++/bonnie++-"
267 version ".tgz"))
268 (sha256
269 (base32
270 "010bmlmi0nrlp3aq7p624sfaj5a65lswnyyxk3cnz1bqig0cn2vf"))))
271 (build-system gnu-build-system)
272 (native-inputs
273 `(("perl" ,perl)))
274 (arguments '(#:tests? #f)) ; there are no tests
275 (home-page "https://doc.coker.com.au/projects/bonnie/")
276 (synopsis "Hard drive and file system benchmark suite")
277 (description
278 "Bonnie++ is a benchmark suite that is aimed at performing a number of
279simple tests of hard drive and file system performance. Bonnie++ allows you to
280benchmark how your file systems perform with respect to data read and write
281speed, the number of seeks that can be performed per second, and the number of
282file metadata operations that can be performed per second.")
283 (license license:gpl2))) ;GPL 2 only, see copyright.txt
5795f566
MC
284
285(define-public python-locust
286 (package
287 (name "python-locust")
8999d2b4 288 (version "1.4.3")
5795f566
MC
289 (source
290 (origin
291 (method url-fetch)
292 (uri (pypi-uri "locust" version))
293 (sha256
294 (base32
8999d2b4 295 "0vmw151xcaznd2j85n96iyv9fniss0bkk91xn4maw2gwzym424xk"))))
5795f566
MC
296 (build-system python-build-system)
297 (arguments
298 `(#:phases
299 (modify-phases %standard-phases
300 (add-before 'check 'extend-PATH
301 ;; Add the 'locust' script to PATH, which is used in the test
302 ;; suite.
303 (lambda* (#:key outputs #:allow-other-keys)
304 (let ((out (assoc-ref outputs "out")))
305 (setenv "PATH" (string-append out "/bin:"
8999d2b4 306 (getenv "PATH"))))))
5795f566
MC
307 (replace 'check
308 (lambda _
309 (invoke "python" "-m" "pytest"
310 "-k" (string-join
311 (list
312 ;; These tests return "non-zero exit status 1".
313 "not test_default_headless_spawn_options"
314 "not test_default_headless_spawn_options_with_shape"
315 "not test_headless_spawn_options_wo_run_time"
8999d2b4
MC
316 ;; These tests depend on networking.
317 "not test_html_report_option"
5795f566
MC
318 "not test_web_options"
319 ;; This test fails because of the warning "System open
320 ;; file limit '1024' is below minimum setting '10000'".
8999d2b4
MC
321 "not test_skip_logging"
322 ;; On some (slow?) machines, the following tests
323 ;; fail, with the processes returning exit code
324 ;; -15 instead of the expected 42 and 0,
325 ;; respectively (see:
326 ;; https://github.com/locustio/locust/issues/1708).
327 "not test_custom_exit_code"
328 "not test_webserver") " and ")))))))
5795f566
MC
329 (propagated-inputs
330 `(("python-configargparse" ,python-configargparse)
331 ("python-flask" ,python-flask)
332 ("python-flask-basicauth" ,python-flask-basicauth)
333 ("python-gevent" ,python-gevent)
334 ("python-geventhttpclient" ,python-geventhttpclient)
335 ("python-msgpack" ,python-msgpack)
336 ("python-psutil" ,python-psutil)
337 ("python-pyzmq" ,python-pyzmq)
338 ("python-requests" ,python-requests)
339 ("python-werkzeug" ,python-werkzeug)))
340 (native-inputs
341 `(("python-mock" ,python-mock)
342 ("python-pyquery" ,python-pyquery)
343 ("python-pytest" ,python-pytest))) ;for more easily skipping tests
344 (home-page "https://locust.io/")
345 (synopsis "Distributed load testing framework")
346 (description "Locust is a performance testing tool that aims to be easy to
347use, scriptable and scalable. The test scenarios are described in plain
348Python. It provides a web-based user interface to visualize the results in
349real-time, but can also be run non-interactively. Locust is primarily geared
350toward testing HTTP-based applications or services, but it can be customized to
8999d2b4
MC
351test any system or protocol.
352
353Note: Locust will complain if the available open file descriptors limit for
354the user is too low. To raise such limit on a Guix System, refer to
355@samp{info guix --index-search=pam-limits-service}.")
5795f566 356 (license license:expat)))
fb8baf0c
AI
357
358(define-public interbench
359 (package
360 (name "interbench")
361 (version "0.31")
362 (source
363 (origin
364 (method git-fetch)
365 (uri (git-reference
366 (url "https://github.com/ckolivas/interbench")
367 (commit (string-append "v" version))))
368 (file-name (git-file-name name version))
369 (sha256
370 (base32
371 "0ifnw8vnkcgrksx7g5d9ii4kjppqnk32lvrybdybmibyvag6zfdc"))))
372 (build-system gnu-build-system)
373 (arguments
374 `(#:tests? #f ; no tests
375 #:phases
376 (modify-phases %standard-phases
377 (add-after 'unpack 'fix-broken-makefile
378 (lambda _
379 ;; Remove erroneous "-lm" target
380 (substitute* "Makefile"
381 (("hackbench.o -lm") "hackbench.o"))))
382 (delete 'configure)
383 (replace 'install
384 (lambda* (#:key outputs #:allow-other-keys)
385 (let ((out (assoc-ref outputs "out")))
386 (install-file "interbench" (string-append out "/bin"))
387 (install-file "interbench.8" (string-append out "/share/man/man8"))))))))
388 (home-page "http://users.on.net/~ckolivas/interbench/")
389 (synopsis "Interactivity benchmark")
390 (description "interbench is designed to benchmark interactivity on Linux.
391It is designed to measure the effect of changes in Linux kernel design or
392system configuration changes such as CPU, I/O scheduler and filesystem changes
393and options. With careful benchmarking, different hardware can be compared.")
394 (license license:gpl2+)))