Merge branch 'staging' 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>
28548efe 4;;; Copyright © 2018, 2019 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>
c3ccba92
MB
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25(define-module (gnu packages benchmark)
26 #:use-module ((guix licenses) #:prefix license:)
27 #:use-module (guix packages)
28 #:use-module (guix download)
4b444fc5 29 #:use-module (guix git-download)
4c7e8c23 30 #:use-module (guix build-system cmake)
c3ccba92 31 #:use-module (guix build-system gnu)
4c7e8c23
GB
32 #:use-module (gnu packages)
33 #:use-module (gnu packages check)
c3ccba92 34 #:use-module (gnu packages compression)
ac6fec05
MB
35 #:use-module (gnu packages linux)
36 #:use-module (gnu packages maths)
04717e94 37 #:use-module (gnu packages mpi)
aadead6f 38 #:use-module (gnu packages python)
312ec128 39 #:use-module (gnu packages python-science)
44d10b1f 40 #:use-module (gnu packages python-xyz)
04717e94
DL
41 #:use-module (gnu packages storage)
42 #:use-module (ice-9 match))
c3ccba92
MB
43
44(define-public fio
45 (package
46 (name "fio")
23d07db7 47 (version "3.17")
c3ccba92
MB
48 (source (origin
49 (method url-fetch)
2dffd9c6 50 (uri (string-append "https://brick.kernel.dk/snaps/"
b31e1561 51 "fio-" version ".tar.bz2"))
c3ccba92
MB
52 (sha256
53 (base32
23d07db7 54 "1hvh8syjz6l0q9bm5p7rf0yrmpkfcx5zj5d47mf6335w1i0h5gqf"))))
c3ccba92
MB
55 (build-system gnu-build-system)
56 (arguments
cf46d071 57 '(#:test-target "test"
c3ccba92
MB
58 #:phases
59 (modify-phases %standard-phases
ac6fec05
MB
60 (add-after
61 'unpack 'patch-paths
62 (lambda* (#:key inputs outputs #:allow-other-keys)
63 (let ((out (assoc-ref outputs "out"))
64 (gnuplot (string-append (assoc-ref inputs "gnuplot")
65 "/bin/gnuplot")))
66 (substitute* "tools/plot/fio2gnuplot"
67 (("/usr/share/fio") (string-append out "/share/fio"))
68 ;; FIXME (upstream): The 'gnuplot' executable is used inline
69 ;; in various os.system() calls mixed with *.gnuplot filenames.
70 (("; do gnuplot") (string-append "; do " gnuplot))
71 (("gnuplot mymath") (string-append gnuplot " mymath"))
72 (("gnuplot mygraph") (string-append gnuplot " mygraph")))
73 #t)))
c3ccba92
MB
74 (replace 'configure
75 (lambda* (#:key outputs #:allow-other-keys)
76 ;; The configure script doesn't understand some of the
77 ;; GNU options, so we can't use #:configure-flags.
78 (let ((out (assoc-ref outputs "out")))
1cc3e26b
TGR
79 (invoke "./configure"
80 (string-append "--prefix=" out))
81 #t)))
f125ec8e
MB
82 ;; The main `fio` executable is fairly small and self contained.
83 ;; Moving the auxiliary python and gnuplot scripts to a separate
84 ;; output saves almost 400 MiB on the closure.
85 (add-after 'install 'move-outputs
86 (lambda* (#:key outputs #:allow-other-keys)
87 (let ((oldbin (string-append (assoc-ref outputs "out") "/bin"))
88 (newbin (string-append (assoc-ref outputs "utils") "/bin")))
89 (mkdir-p newbin)
90 (for-each (lambda (file)
91 (let ((src (string-append oldbin "/" file))
92 (dst (string-append newbin "/" file)))
93 (link src dst)
94 (delete-file src)))
20d2e1fa
MB
95 '("fio2gnuplot" "fiologparser_hist.py"
96 "fiologparser.py"))
f125ec8e
MB
97 ;; Make sure numpy et.al is found.
98 (wrap-program (string-append newbin "/fiologparser_hist.py")
99 `("PYTHONPATH" ":" prefix (,(getenv "PYTHONPATH"))))
100 #t))))))
101 (outputs '("out" "utils"))
c3ccba92 102 (inputs
aadead6f
MB
103 `(("ceph" ,ceph "lib")
104 ("libaio" ,libaio)
ac6fec05
MB
105 ("gnuplot" ,gnuplot)
106 ("zlib" ,zlib)
107 ("python-numpy" ,python2-numpy)
108 ("python-pandas" ,python2-pandas)
109 ("python" ,python-2)))
c3ccba92
MB
110 (home-page "https://github.com/axboe/fio")
111 (synopsis "Flexible I/O tester")
112 (description
113 "fio is a tool that will spawn a number of threads or processes doing a
114particular type of I/O action as specified by the user. The typical use of fio
115is to write a job file matching the I/O load one wants to simulate.")
116 ;; The software is distributed under the GPL2, but a handful of components
117 ;; are covered by other licenses.
118 (license (list license:gpl2 license:gpl2+ license:bsd-2
119 license:public-domain))))
04717e94
DL
120
121;; Parameterized in anticipation of m(va)pich support
2d6f68aa 122(define (intel-mpi-benchmarks mpi)
04717e94 123 (package
2d6f68aa
LC
124 (name (string-append "intel-mpi-benchmarks"
125 (if (string=? (package-name mpi) "openmpi")
126 ""
127 (string-append "-" (package-name mpi)))))
128 (version "2019.3")
129 (source (origin
130 (method git-fetch)
131 (uri (git-reference
132 (url "https://github.com/intel/mpi-benchmarks.git")
133 (commit (string-append "IMB-v" version))))
134 (file-name (git-file-name name version))
135 (sha256
136 (base32
137 "0si5xi6ilhd3w0gbsg124589pvp094hvf366rvjjb9pi7pdk5p4i"))))
04717e94
DL
138 (build-system gnu-build-system)
139 (inputs
140 `(("mpi" ,mpi)))
141 (arguments
142 `(#:phases
143 (modify-phases %standard-phases
144 (delete 'configure)
145 (delete 'check)
04717e94
DL
146 (replace 'install
147 (lambda* (#:key outputs #:allow-other-keys)
2d6f68aa
LC
148 (define (benchmark? file stat)
149 (and (string-prefix? "IMB-" (basename file))
150 (executable-file? file)))
151
04717e94 152 (let* ((out (assoc-ref outputs "out"))
04717e94 153 (bin (string-append out "/bin")))
2d6f68aa
LC
154 (for-each (lambda (file)
155 (install-file file bin))
156 (find-files "." benchmark?))
157 #t))))
158
159 ;; The makefile doesn't express all the dependencies, it seems.
160 #:parallel-build? #t
161
162 #:make-flags '("CC=mpicc" "CXX=mpicxx")))
04717e94 163 (home-page "https://software.intel.com/en-us/articles/intel-mpi-benchmarks")
2d6f68aa 164 (synopsis "Benchmarks for the Message Passing Interface (MPI)")
04717e94
DL
165 (description
166 "This package provides benchmarks for implementations of the @dfn{Message
167Passing Interface} (MPI). It contains MPI performance measurements for
168point-to-point and global communication, and file, operations for a range of
169message sizes. The generated benchmark data fully characterize:
170
171@itemize
172@item
173Performance of a cluster system, including node performance, network latency,
174and throughput;
175@item
176Efficiency of the MPI implementation.
177@end itemize")
178 (license license:cpl1.0)))
179
2d6f68aa
LC
180(define-public intel-mpi-benchmarks/openmpi
181 (intel-mpi-benchmarks openmpi))
182
183(define-public imb-openmpi
184 (deprecated-package "imb-openmpi" intel-mpi-benchmarks/openmpi))
61e265d2
RW
185
186(define-public multitime
187 (package
188 (name "multitime")
189 (version "1.4")
190 (source (origin
191 (method url-fetch)
192 (uri (string-append "https://tratt.net/laurie/src/"
193 "multitime/releases/"
194 "multitime-" version ".tar.gz"))
195 (sha256
196 (base32
197 "0iyfsdrbyqa7a4ifrh19l9a48hgv7ld6m0d8yf9bkl12q0qw91fx"))))
198 (build-system gnu-build-system)
199 (arguments '(#:tests? #f)) ; there are no tests
200 (home-page "https://tratt.net/laurie/src/multitime/")
201 (synopsis "Time command execution over multiple executions")
202 (description
203 "The @code{time} utility is a simple and often effective way of measuring
204how long a command takes to run (wall time). Unfortunately, running a command
205once can give misleading timings. @code{multitime} is, in essence, a simple
206extension to @code{time} which runs a command multiple times and prints the
207timing means, standard deviations, mins, medians, and maxes having done so.
208This can give a much better understanding of the command's performance.")
209 (license license:expat)))
4c7e8c23
GB
210
211(define-public benchmark
212 (package
213 (name "benchmark")
214 (version "1.5.0")
215 (source (origin
216 (method git-fetch)
217 (uri (git-reference
218 (url "https://github.com/google/benchmark.git")
219 (commit (string-append "v" version))))
220 (file-name (git-file-name name version))
221 (sha256
222 (base32
223 "0r9dbg4cbk47gwmayys31a83m3y67k0kh1f6pl8i869rbd609ndh"))
224 (patches (search-patches "benchmark-unbundle-googletest.patch"))))
225 (build-system cmake-build-system)
226 (native-inputs
227 `(("googletest" ,googletest)))
228 (home-page "https://github.com/google/benchmark")
229 (synopsis "Microbenchmark support library")
230 (description
231 "Benchmark is a library to benchmark code snippets,
232similar to unit tests.")
233 (license license:asl2.0)))