1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017 Dave Love <fx@gnu.org>
3 ;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2022 Ludovic Courtès <ludo@gnu.org>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu packages profiling)
22 #:use-module (guix packages)
23 #:use-module (guix gexp)
24 #:use-module ((guix licenses) #:prefix license:) ; avoid zlib, expat clashes
25 #:use-module (guix download)
26 #:use-module (guix utils)
27 #:use-module (guix build-system gnu)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages autotools)
30 #:use-module (gnu packages base) ;for "which"
31 #:use-module (gnu packages bison)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages documentation)
34 #:use-module (gnu packages fabric-management)
35 #:use-module (gnu packages flex)
36 #:use-module (gnu packages gawk)
37 #:use-module (gnu packages gcc)
38 #:use-module (gnu packages glib)
39 #:use-module (gnu packages libunwind)
40 #:use-module (gnu packages linux)
41 #:use-module (gnu packages mpi)
42 #:use-module (gnu packages ncurses)
43 #:use-module (gnu packages perl)
44 #:use-module (gnu packages perl)
45 #:use-module (gnu packages python)
46 #:use-module (gnu packages qt))
48 ;; Fixme: Separate out lib and fix resulting cycle errors; separate libpfm
49 ;; output(?); build libmsr and add that component.
57 (uri (string-append "https://icl.utk.edu/projects/papi/downloads/papi-"
60 (base32 "0zr83v51lp4ijgk997dz9fpph48prlsbml26dvb223avqr8fvmrw"))
61 (modules '((guix build utils)))
64 ;; Remove bundled software.
65 (for-each delete-file-recursively
66 '("src/libpfm-3.y" "src/libpfm4"
70 ;; Adjust include directives.
71 (substitute* "src/components/lmsensors/linux-lmsensors.c"
73 "<sensors/sensors.h>"))))))
74 (build-system gnu-build-system)
80 `(,infiniband-diags "lib")
85 (list #:tests? #f ;no check target
87 ;; These are roughly per Fedora, but elide mx (assumed to be dead, even
88 ;; Open-MX) and add and powercap -- I don't know the pros/cons of
89 ;; infiniband and infiniband_mad, but you can't use them together, and
90 ;; the umad version needs at least one patch.
91 ;; Implicit enabled components: perf_event perf_event_uncore
92 #~`("--with-perf-events" "--with-shared-lib=yes" "--with-shlib"
93 "--with-static-lib=no" "--with-shlib-tools"
94 "--with-components=appio coretemp example lustre micpower net rapl \
95 stealtime lmsensors infiniband powercap"
96 ;; So utils get rpath set correctly:
97 ,(string-append "LDFLAGS=-Xlinker -rpath -Xlinker "
99 ,(string-append "--with-pfm-prefix="
100 #$(this-package-input "libpfm4")))
103 #~(modify-phases %standard-phases
104 (add-after 'unpack 'change-directory
108 ;; Work around a mistake whereby 'configure' would always error
109 ;; out when passing '--with-static-lib=no'.
110 (substitute* "configure"
111 (("test \"\\$static_lib\" = \"no\"")
113 (add-after 'install 'extra-doc
114 (lambda* (#:key outputs #:allow-other-keys)
115 (let ((doc (string-append (assoc-ref outputs "out")
117 #$name "-" #$version)))
118 (chdir "..") ; we went into src above
119 (for-each (lambda (file)
120 (install-file file doc))
121 '("README.md" "RELEASENOTES.txt"))))))))
122 (home-page "https://icl.utk.edu/papi/")
123 (synopsis "Performance Application Programming Interface")
125 "PAPI provides the tool designer and application engineer with a consistent
126 interface and methodology for use of the performance counter hardware found in
127 most major microprocessors. PAPI enables software engineers to see, in near
128 real time, the relation between software performance and processor events.
130 In addition, PAPI provides access to a collection of components that expose
131 performance measurement opportunites across the hardware and software stack.")
133 '((release-monitoring-url
134 . "http://icl.cs.utk.edu/papi/software/")))
135 ;; See Debian papi copyright file.
136 (license (list license:bsd-3
137 license:lgpl2.1+ ;src/components/infiniband/pscanf.h
138 ;; not used in output
139 license:gpl2+ ;src/components/appio/tests/iozone/gengnuplot.sh
142 ;; NB. there's a potential name clash with libotf.
150 (uri (string-append "http://www.vi-hps.org/upload/packages/otf2/otf2-"
152 (sha256 (base32 "1ls7rz6qwnqbkifpafc95bnfh3m9xbs74in8zxlnhfbgwx11nn81"))))
153 (native-inputs (list python))
154 (outputs '("doc" ; 18MB
157 (build-system gnu-build-system)
159 `(#:configure-flags '("--enable-shared" "--disable-static")
161 (modify-phases %standard-phases
162 (add-after 'install 'licence
163 (lambda* (#:key outputs #:allow-other-keys)
164 (for-each (lambda (output)
165 (let ((doc (string-append (assoc-ref outputs output)
167 (install-file "COPYING" doc)))
170 (home-page "http://www.vi-hps.org/projects/score-p/")
171 (synopsis "Open Trace Format 2 library")
172 (description "The Open Trace Format 2 (@dfn{OTF2}) is a scalable,
173 memory-efficient event trace data format plus support library.")
174 (license license:bsd-3)))
176 (define-public opari2
183 (uri (string-append "https://www.vi-hps.org/cms/upload/packages/opari2/"
184 "opari2-" version ".tar.gz"))
186 (base32 "1xaf25lcxk4ky1kzfks40ja9mayh8pnmrzch2107c8dcjrsxsd4h"))))
187 (build-system gnu-build-system)
188 (inputs (list gfortran))
189 (native-inputs (list gawk ; for tests
191 (home-page "https://www.vi-hps.org/projects/score-p")
192 (synopsis "OpenMP runtime performance measurement instrumenter")
193 (description "OPARI2 is a source-to-source instrumentation tool for OpenMP
194 and hybrid codes. It surrounds OpenMP directives and runtime library calls
195 with calls to the POMP2 measurement interface.")
196 (license license:bsd-3)))
206 "http://apps.fz-juelich.de/scalasca/releases/cube/4.3/dist/cube-"
208 (sha256 (base32 "04irflia4rfw02093w9nx7rr98r640y4q8hisjywvd4b7r3nzhhx"))
209 (patches (search-patches "cube-nocheck.patch"))))
210 (inputs (list dbus zlib))
211 (native-inputs (list perl qtbase-5 ; native because of qmake
214 ;; FIXME: The doc is 14MB, but adding a doc output results in a cycle.
215 (outputs '("out" ;"doc"
218 (build-system gnu-build-system)
221 `("--enable-shared" "--disable-static" "--disable-silent-rules"
222 ,(string-append "LDFLAGS=-L" (assoc-ref %outputs "lib") "/lib"))
225 (modify-phases %standard-phases
226 (add-after 'configure 'rpath
227 ;; Account for moving GUI stuff
228 (lambda* (#:key outputs #:allow-other-keys)
229 (let ((wl (string-append "-Wl,-rpath=" (assoc-ref outputs "out")
231 (substitute* "build-backend/Makefile"
232 (("^cube_LDFLAGS =") (string-append "cube_LDFLAGS = " wl))
233 (("^libheatmap_plugin_la_LDFLAGS =")
234 (string-append "libheatmap_plugin_la_LDFLAGS = " wl))
235 (("^libbarplot_plugin_la_LDFLAGS =")
236 (string-append "libbarplot_plugin_la_LDFLAGS = " wl)))
238 (add-before 'install 'includes-cube
239 ;; It tries to install here before include exists.
240 (lambda* (#:key outputs #:allow-other-keys)
241 (let ((inc (string-append (assoc-ref outputs "lib") "/include")))
242 (mkdir-p (string-append inc "/cube"))
243 (mkdir-p (string-append inc "/cubew"))
245 (add-after 'install 'licence
246 (lambda* (#:key outputs #:allow-other-keys)
247 (let ((doc (string-append (assoc-ref outputs "lib")
249 (install-file "COPYING" doc)
251 ;; XXX: Commented due to cycle (see comment above.)
252 ;; (add-after 'install 'doc
254 ;; (let ((share (string-append (assoc-ref %outputs "doc")
257 ;; (rename-file (string-append %output "/share/doc")
258 ;; (string-append share "/doc")))))
259 (add-after 'install 'gui-stuff
260 ;; Get the Qt horror dependencies out of the lib closure
262 (let ((outlib (string-append (assoc-ref %outputs "out") "/lib"))
263 (lib (string-append (assoc-ref %outputs "lib") "/lib")))
265 (rename-file (string-append lib "/cube-plugins")
266 (string-append outlib "/cube-plugins"))
267 (for-each (lambda (file)
269 file (string-append outlib "/" (basename file))))
270 (append (find-files lib "libgraphwidgetcommon-plugin\\..*")
271 (find-files lib "libcube4gui\\.so.*")))
273 (add-after 'install 'move-include
274 ;; Most of the headers end up under %output for some reason,
275 ;; despite --includedir in configure.
276 (lambda* (#:key outputs #:allow-other-keys)
277 (let ((outinc (string-append (assoc-ref outputs "out")
279 (libinc (string-append (assoc-ref outputs "lib")
281 (for-each (lambda (file)
282 (let ((from (string-append outinc "/" file)))
283 (copy-recursively from libinc)
284 (delete-file-recursively from)))
288 ;; XXX: This doesn't work because cube-config, which is needed for
289 ;; building stuff, sources cube-config-frontend. We don't want that
290 ;; in the lib output because it pulls in >1GB via QT.
292 ;; (add-after 'install 'cube-config
294 ;; (let* ((lib (assoc-ref %outputs "lib"))
295 ;; (libbin (string-append lib "/bin")))
297 ;; (system (string-append "mv " (assoc-ref %outputs "out")
298 ;; "/bin/cube-config* " libbin))
299 ;; (substitute* (list (string-append libbin "/cube-config"))
300 ;; (("^prefix=.*") (string-append "prefix=" lib))
301 ;; (("^exec_prefix=\"\\$\\{prefix\\}\"")
302 ;; (string-append "exec_prefix=" lib))))))
303 (add-after 'install 'cube-config
304 (lambda* (#:key outputs #:allow-other-keys)
305 (let* ((lib (assoc-ref outputs "lib"))
306 (libbin (string-append lib "/bin")))
308 (install-file (string-append %output "/bin/cube-config") libbin)
309 (install-file (string-append %output "/bin/cube-config-backend")
311 (substitute* (list (string-append libbin "/cube-config"))
312 (("^source .*frontend.*$") "")
313 (((assoc-ref outputs "out")) lib))
315 (home-page "https://www.scalasca.org/software/cube-4.x/download.html")
316 (synopsis "Performance report explorer for parallel programs")
318 "CUBE (CUBE Uniform Behavioral Encoding) is a tool to display a variety
319 of performance metrics for parallel programs including MPI and OpenMP
320 applications. CUBE allows interactive exploration of a multidimensional
321 performance space in a scalable fashion. Scalability is achieved in two ways:
322 hierarchical decomposition of individual dimensions and aggregation across
323 different dimensions. All performance metrics are uniformly accommodated in
324 the same display and thus provide the ability to easily compare the effects of
325 different kinds of performance behavior.")
326 (license license:bsd-3)))
328 (define (make-scorep mpi)
330 (name (string-append "scorep-" (package-name mpi)))
335 "http://www.vi-hps.org/upload/packages/scorep/scorep-"
339 "0h45357djna4dn9jyxx0n36fhhms3jrf22988m9agz1aw2jfivs9"))
340 (modules '((guix build utils)))
342 ;; Remove bundled software.
344 (for-each delete-file-recursively
345 '("vendor/opari2" "vendor/cube"))
347 (build-system gnu-build-system)
352 ("libunwind" ,libunwind)
354 ("cubelib" ,cube "lib") ;for lib, include
360 cube ;for cube-config
367 (list "--enable-shared" "--disable-static"
368 (string-append "--with-opari2="
369 (assoc-ref %build-inputs "opari2"))
370 (string-append "--with-cube="
371 (assoc-ref %build-inputs "cube")))
373 #:make-flags '("V=1")
375 (modify-phases %standard-phases
376 (add-after 'install 'licence
377 (lambda* (#:key outputs #:allow-other-keys)
378 (let ((doc (string-append (assoc-ref outputs "out")
379 "/share/doc/scorep")))
380 (install-file "COPYING" doc)
382 (home-page "http://www.vi-hps.org/projects/score-p/")
383 (synopsis "Performance measurement infrastructure for parallel code")
385 "The Score-P (Scalable Performance Measurement Infrastructure for
386 Parallel Codes) measurement infrastructure is a scalable and easy-to-use tool
387 suite for profiling, event trace recording, and online analysis of
388 high-performance computing (HPC) applications.")
389 (license license:cpl1.0)))
391 (define-public scorep-openmpi (make-scorep openmpi))