gnu: icecat: Update to 78.10.0-guix0-preview1 [security fixes].
[jackhill/guix/guix.git] / gnu / packages / profiling.scm
CommitLineData
6a3af24f
DL
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2017 Dave Love <fx@gnu.org>
2559c243 3;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
6a3af24f
DL
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"
fb993719 29 #:use-module (gnu packages bison)
a66408f8
DL
30 #:use-module (gnu packages compression)
31 #:use-module (gnu packages documentation)
6a3af24f 32 #:use-module (gnu packages fabric-management)
fb993719 33 #:use-module (gnu packages flex)
3c8d1f94 34 #:use-module (gnu packages gawk)
6a3af24f 35 #:use-module (gnu packages gcc)
a66408f8 36 #:use-module (gnu packages glib)
6a3af24f
DL
37 #:use-module (gnu packages libunwind)
38 #:use-module (gnu packages linux)
fb993719 39 #:use-module (gnu packages mpi)
a6121c0a 40 #:use-module (gnu packages ncurses)
a66408f8 41 #:use-module (gnu packages perl)
fb993719 42 #:use-module (gnu packages perl)
a66408f8
DL
43 #:use-module (gnu packages python)
44 #:use-module (gnu packages qt))
6a3af24f
DL
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
f7c870f7 69 `(#:tests? #f ; no check target
6a3af24f
DL
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 \
79stealtime 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")
ac1a9ce8
TGR
88 (invoke "autoconf")
89 #t))
6a3af24f
DL
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"
ac1a9ce8
TGR
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))
6a3af24f
DL
110 (add-after 'install 'extra-doc
111 (lambda* (#:key outputs #:allow-other-keys)
112 (let ((doc (string-append (assoc-ref outputs "out")
f7c870f7 113 "/share/doc/" ,name "-" ,version)))
6a3af24f
DL
114 (chdir "..") ; we went into src above
115 (for-each (lambda (file)
116 (install-file file doc))
ac1a9ce8 117 '("README" "RELEASENOTES.txt"))
6a3af24f 118 #t))))))
211748d4 119 (home-page "https://icl.utk.edu/papi/")
6a3af24f
DL
120 (synopsis "Performance Application Programming Interface")
121 (description
122 "PAPI provides the tool designer and application engineer with a consistent
123interface and methodology for use of the performance counter hardware found in
124most major microprocessors. PAPI enables software engineers to see, in near
125real time, the relation between software performance and processor events.
126
127In addition, PAPI provides access to a collection of components that expose
128performance 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 ))))
a6121c0a
DL
138
139;; NB. there's a potential name clash with libotf.
140(define-public otf2
141 (package
142 (name "otf2")
27114bc3 143 (version "2.1.1")
a6121c0a
DL
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"))
27114bc3 149 (sha256 (base32 "1ls7rz6qwnqbkifpafc95bnfh3m9xbs74in8zxlnhfbgwx11nn81"))))
a6121c0a
DL
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")
fb5fedfe
TGR
169 (description "The Open Trace Format 2 (@dfn{OTF2}) is a scalable,
170memory-efficient event trace data format plus support library.")
a6121c0a 171 (license license:bsd-3)))
3c8d1f94
DL
172
173(define-public opari2
174 (package
175 (name "opari2")
2559c243 176 (version "2.0.5")
3c8d1f94
DL
177 (source
178 (origin
2cea4ac7
TGR
179 (method url-fetch)
180 (uri (string-append "https://www.vi-hps.org/cms/upload/packages/opari2/"
181 "opari2-" version ".tar.gz"))
2559c243
TGR
182 (sha256
183 (base32 "1xaf25lcxk4ky1kzfks40ja9mayh8pnmrzch2107c8dcjrsxsd4h"))))
3c8d1f94
DL
184 (build-system gnu-build-system)
185 (inputs `(("gfortran" ,gfortran)))
2cea4ac7 186 (native-inputs `(("gawk" ,gawk) ; for tests
3c8d1f94 187 ("which" ,which)))
9f53d58a 188 (home-page "https://www.vi-hps.org/projects/score-p")
3c8d1f94
DL
189 (synopsis "OpenMP runtime performance measurement instrumenter")
190 (description "OPARI2 is a source-to-source instrumentation tool for OpenMP
191and hybrid codes. It surrounds OpenMP directives and runtime library calls
192with calls to the POMP2 measurement interface.")
193 (license license:bsd-3)))
a66408f8
DL
194
195(define-public cube
196 (package
197 (name "cube")
198 (version "4.3.5")
199 (source
200 (origin
201 (method url-fetch)
202 (uri (string-append
203 "http://apps.fz-juelich.de/scalasca/releases/cube/4.3/dist/cube-"
204 version ".tar.gz"))
205 (sha256 (base32 "04irflia4rfw02093w9nx7rr98r640y4q8hisjywvd4b7r3nzhhx"))
206 (patches (search-patches "cube-nocheck.patch"))))
207 (inputs `(("dbus" ,dbus)
208 ("zlib" ,zlib)))
209 (native-inputs `(("perl" ,perl)
210 ("qtbase" ,qtbase) ; native because of qmake
211 ("which" ,which)))
212
213 ;; FIXME: The doc is 14MB, but adding a doc output results in a cycle.
214 (outputs '("out" ;"doc"
215 "lib"))
216
217 (build-system gnu-build-system)
218 (arguments
219 `(#:configure-flags
220 `("--enable-shared" "--disable-static" "--disable-silent-rules"
221 ,(string-append "LDFLAGS=-L" (assoc-ref %outputs "lib") "/lib"))
222 #:parallel-tests? #f
223 #:phases
224 (modify-phases %standard-phases
225 (add-after 'configure 'rpath
226 ;; Account for moving GUI stuff
227 (lambda* (#:key outputs #:allow-other-keys)
228 (let ((wl (string-append "-Wl,-rpath=" (assoc-ref outputs "out")
229 "/lib")))
230 (substitute* "build-backend/Makefile"
231 (("^cube_LDFLAGS =") (string-append "cube_LDFLAGS = " wl))
232 (("^libheatmap_plugin_la_LDFLAGS =")
233 (string-append "libheatmap_plugin_la_LDFLAGS = " wl))
234 (("^libbarplot_plugin_la_LDFLAGS =")
235 (string-append "libbarplot_plugin_la_LDFLAGS = " wl)))
236 #t)))
237 (add-before 'install 'includes-cube
238 ;; It tries to install here before include exists.
239 (lambda* (#:key outputs #:allow-other-keys)
240 (let ((inc (string-append (assoc-ref outputs "lib") "/include")))
241 (mkdir-p (string-append inc "/cube"))
242 (mkdir-p (string-append inc "/cubew"))
243 #t)))
244 (add-after 'install 'licence
245 (lambda* (#:key outputs #:allow-other-keys)
246 (let ((doc (string-append (assoc-ref outputs "lib")
247 "/share/doc/cube")))
248 (install-file "COPYING" doc)
249 #t)))
250 ;; XXX: Commented due to cycle (see comment above.)
251 ;; (add-after 'install 'doc
252 ;; (lambda _
253 ;; (let ((share (string-append (assoc-ref %outputs "doc")
254 ;; "/share")))
255 ;; (mkdir-p share)
256 ;; (rename-file (string-append %output "/share/doc")
257 ;; (string-append share "/doc")))))
258 (add-after 'install 'gui-stuff
259 ;; Get the Qt horror dependencies out of the lib closure
260 (lambda _
261 (let ((outlib (string-append (assoc-ref %outputs "out") "/lib"))
262 (lib (string-append (assoc-ref %outputs "lib") "/lib")))
263 (mkdir-p outlib)
264 (rename-file (string-append lib "/cube-plugins")
265 (string-append outlib "/cube-plugins"))
266 (for-each (lambda (file)
267 (rename-file
268 file (string-append outlib "/" (basename file))))
269 (append (find-files lib "libgraphwidgetcommon-plugin\\..*")
270 (find-files lib "libcube4gui\\.so.*")))
271 #t)))
272 (add-after 'install 'move-include
273 ;; Most of the headers end up under %output for some reason,
274 ;; despite --includedir in configure.
275 (lambda* (#:key outputs #:allow-other-keys)
276 (let ((outinc (string-append (assoc-ref outputs "out")
277 "/include"))
278 (libinc (string-append (assoc-ref outputs "lib")
279 "/include")))
280 (for-each (lambda (file)
281 (let ((from (string-append outinc "/" file)))
282 (copy-recursively from libinc)
283 (delete-file-recursively from)))
284 '("cube" "cubew"))
285 #t)))
286
287 ;; XXX: This doesn't work because cube-config, which is needed for
288 ;; building stuff, sources cube-config-frontend. We don't want that
289 ;; in the lib output because it pulls in >1GB via QT.
290 ;;
291 ;; (add-after 'install 'cube-config
292 ;; (lambda _
293 ;; (let* ((lib (assoc-ref %outputs "lib"))
294 ;; (libbin (string-append lib "/bin")))
295 ;; (mkdir-p libbin)
296 ;; (system (string-append "mv " (assoc-ref %outputs "out")
297 ;; "/bin/cube-config* " libbin))
298 ;; (substitute* (list (string-append libbin "/cube-config"))
299 ;; (("^prefix=.*") (string-append "prefix=" lib))
300 ;; (("^exec_prefix=\"\\$\\{prefix\\}\"")
301 ;; (string-append "exec_prefix=" lib))))))
302 (add-after 'install 'cube-config
303 (lambda* (#:key outputs #:allow-other-keys)
304 (let* ((lib (assoc-ref outputs "lib"))
305 (libbin (string-append lib "/bin")))
306 (mkdir-p libbin)
307 (install-file (string-append %output "/bin/cube-config") libbin)
308 (install-file (string-append %output "/bin/cube-config-backend")
309 libbin)
310 (substitute* (list (string-append libbin "/cube-config"))
311 (("^source .*frontend.*$") "")
312 (((assoc-ref outputs "out")) lib))
313 #t))))))
20035fa7 314 (home-page "https://www.scalasca.org/software/cube-4.x/download.html")
a66408f8
DL
315 (synopsis "Performance report explorer for parallel programs")
316 (description
317 "CUBE (CUBE Uniform Behavioral Encoding) is a tool to display a variety
318of performance metrics for parallel programs including MPI and OpenMP
319applications. CUBE allows interactive exploration of a multidimensional
320performance space in a scalable fashion. Scalability is achieved in two ways:
321hierarchical decomposition of individual dimensions and aggregation across
322different dimensions. All performance metrics are uniformly accommodated in
323the same display and thus provide the ability to easily compare the effects of
324different kinds of performance behavior.")
325 (license license:bsd-3)))
fb993719
DL
326
327(define (make-scorep mpi)
328 (package
329 (name (string-append "scorep-" (package-name mpi)))
330 (version "3.1")
331 (source (origin
332 (method url-fetch)
333 (uri (string-append
334 "http://www.vi-hps.org/upload/packages/scorep/scorep-"
335 version ".tar.gz"))
336 (sha256
337 (base32
338 "0h45357djna4dn9jyxx0n36fhhms3jrf22988m9agz1aw2jfivs9"))
339 (modules '((guix build utils)))
340 (snippet
341 ;; Remove bundled software.
6cbee49d
MW
342 '(begin
343 (for-each delete-file-recursively
344 '("vendor/opari2" "vendor/cube"))
345 #t))))
fb993719
DL
346 (build-system gnu-build-system)
347 (inputs
348 `(("mpi" ,mpi)
349 ("papi" ,papi)
350 ("opari2" ,opari2)
351 ("libunwind" ,libunwind)
352 ("otf2" ,otf2)
353 ("cubelib" ,cube "lib") ;for lib, include
354 ("openmpi" ,openmpi)
355 ("zlib" ,zlib)))
356 (native-inputs
357 `(("gfortran" ,gfortran)
358 ("flex" ,flex)
359 ("cube" ,cube) ;for cube-config
360 ("bison" ,bison)
361 ("python" ,python)
362 ("doxygen" ,doxygen)
363 ("which" ,which)))
364 (arguments
365 `(#:configure-flags
366 (list "--enable-shared" "--disable-static"
367 (string-append "--with-opari2="
368 (assoc-ref %build-inputs "opari2"))
369 (string-append "--with-cube="
370 (assoc-ref %build-inputs "cube")))
371 #:parallel-tests? #f
372 #:make-flags '("V=1")
373 #:phases
374 (modify-phases %standard-phases
375 (add-after 'install 'licence
376 (lambda* (#:key outputs #:allow-other-keys)
377 (let ((doc (string-append (assoc-ref outputs "out")
378 "/share/doc/scorep")))
379 (install-file "COPYING" doc)
380 #t))))))
381 (home-page "http://www.vi-hps.org/projects/score-p/")
382 (synopsis "Performance measurement infrastructure for parallel code")
383 (description
384 "The Score-P (Scalable Performance Measurement Infrastructure for
385Parallel Codes) measurement infrastructure is a scalable and easy-to-use tool
386suite for profiling, event trace recording, and online analysis of
387high-performance computing (HPC) applications.")
388 (license license:cpl1.0)))
389
390(define-public scorep-openmpi (make-scorep openmpi))