gnu: dovecot: Update to 2.3.6.
[jackhill/guix/guix.git] / gnu / packages / profiling.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017 Dave Love <fx@gnu.org>
3 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages profiling)
21 #:use-module (guix packages)
22 #:use-module ((guix licenses) #:prefix license:) ; avoid zlib, expat clashes
23 #:use-module (guix download)
24 #:use-module (guix utils)
25 #:use-module (guix build-system gnu)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages autotools)
28 #:use-module (gnu packages base) ;for "which"
29 #:use-module (gnu packages bison)
30 #:use-module (gnu packages compression)
31 #:use-module (gnu packages documentation)
32 #:use-module (gnu packages fabric-management)
33 #:use-module (gnu packages flex)
34 #:use-module (gnu packages gawk)
35 #:use-module (gnu packages gcc)
36 #:use-module (gnu packages glib)
37 #:use-module (gnu packages libunwind)
38 #:use-module (gnu packages linux)
39 #:use-module (gnu packages mpi)
40 #:use-module (gnu packages ncurses)
41 #:use-module (gnu packages perl)
42 #:use-module (gnu packages perl)
43 #:use-module (gnu packages python)
44 #:use-module (gnu packages qt))
45
46 ;; Fixme: Separate out lib and fix resulting cycle errors; separate libpfm
47 ;; output(?); build libmsr and add that component.
48 (define-public papi
49 (package
50 (name "papi")
51 (version "5.5.1")
52 (source
53 (origin
54 (method url-fetch)
55 (uri (string-append "http://icl.utk.edu/projects/papi/downloads/papi-"
56 version ".tar.gz"))
57 (sha256 (base32 "1m62s8fkjjgq04ayf18jcxc33rqfd7nrkdw1gr54q5pn4cijrp29"))))
58 (build-system gnu-build-system)
59 (inputs
60 `(("ncurses" ,ncurses)
61 ("lm-sensors" ,lm-sensors "lib")
62 ("rdma-core" ,rdma-core)
63 ("infiniband-diags" ,infiniband-diags "lib")
64 ("net-tools" ,net-tools)))
65 (native-inputs
66 `(("autoconf" ,autoconf)
67 ("gfortran" ,gfortran)))
68 (arguments
69 `(#:tests? #f ; no check target
70 #:configure-flags
71 ;; These are roughly per Fedora, but elide mx (assumed to be dead, even
72 ;; Open-MX) and add and powercap -- I don't know the pros/cons of
73 ;; infiniband and infiniband_mad, but you can't use them together, and
74 ;; the umad version needs at least one patch.
75 ;; Implicit enabled components: perf_event perf_event_uncore
76 `("--with-perf-events" "--with-shared-lib=yes" "--with-shlib"
77 "--with-static-lib=no"
78 "--with-components=appio coretemp example lustre micpower net rapl \
79 stealtime lmsensors infiniband powercap"
80 ;; So utils get rpath set correctly:
81 ,(string-append "LDFLAGS=-Xlinker -rpath -Xlinker "
82 (assoc-ref %outputs "out") "/lib"))
83 #:phases
84 (modify-phases %standard-phases
85 (add-before 'configure 'autoconf
86 (lambda _
87 (chdir "src")
88 (invoke "autoconf")
89 #t))
90 ;; Amalgamating with the following clause gives double substitution.
91 (add-before 'patch-source-shebangs 'patch-components
92 (lambda _
93 (with-directory-excursion "src/components"
94 (substitute* '("lmsensors/configure" "infiniband_umad/configure")
95 (("/bin/sh") (which "sh"))))
96 #t))
97 (add-after 'configure 'components
98 (lambda* (#:key inputs #:allow-other-keys)
99 (with-directory-excursion "components"
100 (with-directory-excursion "infiniband_umad"
101 (invoke "./configure"))
102 (with-directory-excursion "lmsensors"
103 (let ((base (assoc-ref inputs "lm-sensors")))
104 (invoke "./configure"
105 (string-append "--with-sensors_incdir="
106 base "/include/sensors")
107 (string-append "--with-sensors_libdir="
108 base "/lib")))))
109 #t))
110 (add-after 'install 'extra-doc
111 (lambda* (#:key outputs #:allow-other-keys)
112 (let ((doc (string-append (assoc-ref outputs "out")
113 "/share/doc/" ,name "-" ,version)))
114 (chdir "..") ; we went into src above
115 (for-each (lambda (file)
116 (install-file file doc))
117 '("README" "RELEASENOTES.txt"))
118 #t))))))
119 (home-page "https://icl.utk.edu/papi/")
120 (synopsis "Performance Application Programming Interface")
121 (description
122 "PAPI provides the tool designer and application engineer with a consistent
123 interface and methodology for use of the performance counter hardware found in
124 most major microprocessors. PAPI enables software engineers to see, in near
125 real time, the relation between software performance and processor events.
126
127 In addition, PAPI provides access to a collection of components that expose
128 performance measurement opportunites across the hardware and software stack.")
129 ;; See Debian papi copyright file.
130 (license (list license:bsd-3
131 license:lgpl2.1+ ;src/components/infiniband/pscanf.h
132 ;; not used in output
133 license:gpl2+ ;src/components/appio/tests/iozone/gengnuplot.sh
134 ;src/libpfm-3.y/*/multiplex*
135 ;; "BSD-like": src/libpfm-3.y/*, src/libpfm4/*
136 ;; lgpl2.1+: src/perfctr-2.*/*
137 ))))
138
139 ;; NB. there's a potential name clash with libotf.
140 (define-public otf2
141 (package
142 (name "otf2")
143 (version "2.1.1")
144 (source
145 (origin
146 (method url-fetch)
147 (uri (string-append "http://www.vi-hps.org/upload/packages/otf2/otf2-"
148 version ".tar.gz"))
149 (sha256 (base32 "1ls7rz6qwnqbkifpafc95bnfh3m9xbs74in8zxlnhfbgwx11nn81"))))
150 (native-inputs `(("python" ,python)))
151 (outputs '("doc" ; 18MB
152 "lib"
153 "out"))
154 (build-system gnu-build-system)
155 (arguments
156 `(#:configure-flags '("--enable-shared" "--disable-static")
157 #:phases
158 (modify-phases %standard-phases
159 (add-after 'install 'licence
160 (lambda* (#:key outputs #:allow-other-keys)
161 (for-each (lambda (output)
162 (let ((doc (string-append (assoc-ref outputs output)
163 "/share/doc/otf2")))
164 (install-file "COPYING" doc)))
165 '("lib" "doc"))
166 #t)))))
167 (home-page "http://www.vi-hps.org/projects/score-p/")
168 (synopsis "Open Trace Format 2 library")
169 (description "The Open Trace Format 2 (@dfn{OTF2}) is a scalable,
170 memory-efficient event trace data format plus support library.")
171 (license license:bsd-3)))
172
173 (define-public opari2
174 (package
175 (name "opari2")
176 (version "2.0.4")
177 (source
178 (origin
179 (method url-fetch)
180 (uri (string-append "https://www.vi-hps.org/cms/upload/packages/opari2/"
181 "opari2-" version ".tar.gz"))
182 (sha256 (base32 "0cd1l30x8hygvbh6yay7mn483vjq3z4b7wnsffs80rznj93k57pn"))))
183 (build-system gnu-build-system)
184 (inputs `(("gfortran" ,gfortran)))
185 (native-inputs `(("gawk" ,gawk) ; for tests
186 ("which" ,which)))
187 (home-page "https://www.vi-hps.org/projects/score-p")
188 (synopsis "OpenMP runtime performance measurement instrumenter")
189 (description "OPARI2 is a source-to-source instrumentation tool for OpenMP
190 and hybrid codes. It surrounds OpenMP directives and runtime library calls
191 with calls to the POMP2 measurement interface.")
192 (license license:bsd-3)))
193
194 (define-public cube
195 (package
196 (name "cube")
197 (version "4.3.5")
198 (source
199 (origin
200 (method url-fetch)
201 (uri (string-append
202 "http://apps.fz-juelich.de/scalasca/releases/cube/4.3/dist/cube-"
203 version ".tar.gz"))
204 (sha256 (base32 "04irflia4rfw02093w9nx7rr98r640y4q8hisjywvd4b7r3nzhhx"))
205 (patches (search-patches "cube-nocheck.patch"))))
206 (inputs `(("dbus" ,dbus)
207 ("zlib" ,zlib)))
208 (native-inputs `(("perl" ,perl)
209 ("qtbase" ,qtbase) ; native because of qmake
210 ("which" ,which)))
211
212 ;; FIXME: The doc is 14MB, but adding a doc output results in a cycle.
213 (outputs '("out" ;"doc"
214 "lib"))
215
216 (build-system gnu-build-system)
217 (arguments
218 `(#:configure-flags
219 `("--enable-shared" "--disable-static" "--disable-silent-rules"
220 ,(string-append "LDFLAGS=-L" (assoc-ref %outputs "lib") "/lib"))
221 #:parallel-tests? #f
222 #:phases
223 (modify-phases %standard-phases
224 (add-after 'configure 'rpath
225 ;; Account for moving GUI stuff
226 (lambda* (#:key outputs #:allow-other-keys)
227 (let ((wl (string-append "-Wl,-rpath=" (assoc-ref outputs "out")
228 "/lib")))
229 (substitute* "build-backend/Makefile"
230 (("^cube_LDFLAGS =") (string-append "cube_LDFLAGS = " wl))
231 (("^libheatmap_plugin_la_LDFLAGS =")
232 (string-append "libheatmap_plugin_la_LDFLAGS = " wl))
233 (("^libbarplot_plugin_la_LDFLAGS =")
234 (string-append "libbarplot_plugin_la_LDFLAGS = " wl)))
235 #t)))
236 (add-before 'install 'includes-cube
237 ;; It tries to install here before include exists.
238 (lambda* (#:key outputs #:allow-other-keys)
239 (let ((inc (string-append (assoc-ref outputs "lib") "/include")))
240 (mkdir-p (string-append inc "/cube"))
241 (mkdir-p (string-append inc "/cubew"))
242 #t)))
243 (add-after 'install 'licence
244 (lambda* (#:key outputs #:allow-other-keys)
245 (let ((doc (string-append (assoc-ref outputs "lib")
246 "/share/doc/cube")))
247 (install-file "COPYING" doc)
248 #t)))
249 ;; XXX: Commented due to cycle (see comment above.)
250 ;; (add-after 'install 'doc
251 ;; (lambda _
252 ;; (let ((share (string-append (assoc-ref %outputs "doc")
253 ;; "/share")))
254 ;; (mkdir-p share)
255 ;; (rename-file (string-append %output "/share/doc")
256 ;; (string-append share "/doc")))))
257 (add-after 'install 'gui-stuff
258 ;; Get the Qt horror dependencies out of the lib closure
259 (lambda _
260 (let ((outlib (string-append (assoc-ref %outputs "out") "/lib"))
261 (lib (string-append (assoc-ref %outputs "lib") "/lib")))
262 (mkdir-p outlib)
263 (rename-file (string-append lib "/cube-plugins")
264 (string-append outlib "/cube-plugins"))
265 (for-each (lambda (file)
266 (rename-file
267 file (string-append outlib "/" (basename file))))
268 (append (find-files lib "libgraphwidgetcommon-plugin\\..*")
269 (find-files lib "libcube4gui\\.so.*")))
270 #t)))
271 (add-after 'install 'move-include
272 ;; Most of the headers end up under %output for some reason,
273 ;; despite --includedir in configure.
274 (lambda* (#:key outputs #:allow-other-keys)
275 (let ((outinc (string-append (assoc-ref outputs "out")
276 "/include"))
277 (libinc (string-append (assoc-ref outputs "lib")
278 "/include")))
279 (for-each (lambda (file)
280 (let ((from (string-append outinc "/" file)))
281 (copy-recursively from libinc)
282 (delete-file-recursively from)))
283 '("cube" "cubew"))
284 #t)))
285
286 ;; XXX: This doesn't work because cube-config, which is needed for
287 ;; building stuff, sources cube-config-frontend. We don't want that
288 ;; in the lib output because it pulls in >1GB via QT.
289 ;;
290 ;; (add-after 'install 'cube-config
291 ;; (lambda _
292 ;; (let* ((lib (assoc-ref %outputs "lib"))
293 ;; (libbin (string-append lib "/bin")))
294 ;; (mkdir-p libbin)
295 ;; (system (string-append "mv " (assoc-ref %outputs "out")
296 ;; "/bin/cube-config* " libbin))
297 ;; (substitute* (list (string-append libbin "/cube-config"))
298 ;; (("^prefix=.*") (string-append "prefix=" lib))
299 ;; (("^exec_prefix=\"\\$\\{prefix\\}\"")
300 ;; (string-append "exec_prefix=" lib))))))
301 (add-after 'install 'cube-config
302 (lambda* (#:key outputs #:allow-other-keys)
303 (let* ((lib (assoc-ref outputs "lib"))
304 (libbin (string-append lib "/bin")))
305 (mkdir-p libbin)
306 (install-file (string-append %output "/bin/cube-config") libbin)
307 (install-file (string-append %output "/bin/cube-config-backend")
308 libbin)
309 (substitute* (list (string-append libbin "/cube-config"))
310 (("^source .*frontend.*$") "")
311 (((assoc-ref outputs "out")) lib))
312 #t))))))
313 (home-page "http://www.scalasca.org/software/cube-4.x/download.html")
314 (synopsis "Performance report explorer for parallel programs")
315 (description
316 "CUBE (CUBE Uniform Behavioral Encoding) is a tool to display a variety
317 of performance metrics for parallel programs including MPI and OpenMP
318 applications. CUBE allows interactive exploration of a multidimensional
319 performance space in a scalable fashion. Scalability is achieved in two ways:
320 hierarchical decomposition of individual dimensions and aggregation across
321 different dimensions. All performance metrics are uniformly accommodated in
322 the same display and thus provide the ability to easily compare the effects of
323 different kinds of performance behavior.")
324 (license license:bsd-3)))
325
326 (define (make-scorep mpi)
327 (package
328 (name (string-append "scorep-" (package-name mpi)))
329 (version "3.1")
330 (source (origin
331 (method url-fetch)
332 (uri (string-append
333 "http://www.vi-hps.org/upload/packages/scorep/scorep-"
334 version ".tar.gz"))
335 (sha256
336 (base32
337 "0h45357djna4dn9jyxx0n36fhhms3jrf22988m9agz1aw2jfivs9"))
338 (modules '((guix build utils)))
339 (snippet
340 ;; Remove bundled software.
341 '(begin
342 (for-each delete-file-recursively
343 '("vendor/opari2" "vendor/cube"))
344 #t))))
345 (build-system gnu-build-system)
346 (inputs
347 `(("mpi" ,mpi)
348 ("papi" ,papi)
349 ("opari2" ,opari2)
350 ("libunwind" ,libunwind)
351 ("otf2" ,otf2)
352 ("cubelib" ,cube "lib") ;for lib, include
353 ("openmpi" ,openmpi)
354 ("zlib" ,zlib)))
355 (native-inputs
356 `(("gfortran" ,gfortran)
357 ("flex" ,flex)
358 ("cube" ,cube) ;for cube-config
359 ("bison" ,bison)
360 ("python" ,python)
361 ("doxygen" ,doxygen)
362 ("which" ,which)))
363 (arguments
364 `(#:configure-flags
365 (list "--enable-shared" "--disable-static"
366 (string-append "--with-opari2="
367 (assoc-ref %build-inputs "opari2"))
368 (string-append "--with-cube="
369 (assoc-ref %build-inputs "cube")))
370 #:parallel-tests? #f
371 #:make-flags '("V=1")
372 #:phases
373 (modify-phases %standard-phases
374 (add-after 'install 'licence
375 (lambda* (#:key outputs #:allow-other-keys)
376 (let ((doc (string-append (assoc-ref outputs "out")
377 "/share/doc/scorep")))
378 (install-file "COPYING" doc)
379 #t))))))
380 (home-page "http://www.vi-hps.org/projects/score-p/")
381 (synopsis "Performance measurement infrastructure for parallel code")
382 (description
383 "The Score-P (Scalable Performance Measurement Infrastructure for
384 Parallel Codes) measurement infrastructure is a scalable and easy-to-use tool
385 suite for profiling, event trace recording, and online analysis of
386 high-performance computing (HPC) applications.")
387 (license license:cpl1.0)))
388
389 (define-public scorep-openmpi (make-scorep openmpi))