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