Commit | Line | Data |
---|---|---|
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> |
775203e5 | 4 | ;;; Copyright © 2022 Ludovic Courtès <ludo@gnu.org> |
6a3af24f DL |
5 | ;;; |
6 | ;;; This file is part of GNU Guix. | |
7 | ;;; | |
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. | |
12 | ;;; | |
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. | |
17 | ;;; | |
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/>. | |
20 | ||
21 | (define-module (gnu packages profiling) | |
22 | #:use-module (guix packages) | |
775203e5 | 23 | #:use-module (guix gexp) |
6a3af24f DL |
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" | |
fb993719 | 31 | #:use-module (gnu packages bison) |
a66408f8 DL |
32 | #:use-module (gnu packages compression) |
33 | #:use-module (gnu packages documentation) | |
6a3af24f | 34 | #:use-module (gnu packages fabric-management) |
fb993719 | 35 | #:use-module (gnu packages flex) |
3c8d1f94 | 36 | #:use-module (gnu packages gawk) |
6a3af24f | 37 | #:use-module (gnu packages gcc) |
a66408f8 | 38 | #:use-module (gnu packages glib) |
6a3af24f DL |
39 | #:use-module (gnu packages libunwind) |
40 | #:use-module (gnu packages linux) | |
fb993719 | 41 | #:use-module (gnu packages mpi) |
a6121c0a | 42 | #:use-module (gnu packages ncurses) |
a66408f8 | 43 | #:use-module (gnu packages perl) |
fb993719 | 44 | #:use-module (gnu packages perl) |
a66408f8 DL |
45 | #:use-module (gnu packages python) |
46 | #:use-module (gnu packages qt)) | |
6a3af24f DL |
47 | |
48 | ;; Fixme: Separate out lib and fix resulting cycle errors; separate libpfm | |
49 | ;; output(?); build libmsr and add that component. | |
50 | (define-public papi | |
51 | (package | |
52 | (name "papi") | |
5754b52a | 53 | (version "6.0.0.1") |
6a3af24f DL |
54 | (source |
55 | (origin | |
56 | (method url-fetch) | |
5754b52a | 57 | (uri (string-append "https://icl.utk.edu/projects/papi/downloads/papi-" |
6a3af24f | 58 | version ".tar.gz")) |
5754b52a TGR |
59 | (sha256 |
60 | (base32 "0zr83v51lp4ijgk997dz9fpph48prlsbml26dvb223avqr8fvmrw")) | |
775203e5 LC |
61 | (modules '((guix build utils))) |
62 | (snippet | |
63 | '(begin | |
64 | ;; Remove bundled software. | |
65 | (for-each delete-file-recursively | |
66 | '("src/libpfm-3.y" "src/libpfm4" | |
67 | "src/perfctr-2.6.x" | |
68 | "src/perfctr-2.7.x")) | |
69 | ||
70 | ;; Adjust include directives. | |
71 | (substitute* "src/components/lmsensors/linux-lmsensors.c" | |
72 | (("<sensors.h>") | |
73 | "<sensors/sensors.h>")))))) | |
6a3af24f DL |
74 | (build-system gnu-build-system) |
75 | (inputs | |
8394619b | 76 | (list ncurses |
775203e5 LC |
77 | rdma-core |
78 | libpfm4 | |
79 | `(,lm-sensors "lib") | |
80 | `(,infiniband-diags "lib") | |
81 | net-tools)) | |
6a3af24f | 82 | (native-inputs |
775203e5 | 83 | (list gfortran)) |
6a3af24f | 84 | (arguments |
775203e5 LC |
85 | (list #:tests? #f ;no check target |
86 | #:configure-flags | |
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 \ | |
6a3af24f | 95 | stealtime lmsensors infiniband powercap" |
775203e5 LC |
96 | ;; So utils get rpath set correctly: |
97 | ,(string-append "LDFLAGS=-Xlinker -rpath -Xlinker " | |
98 | #$output "/lib") | |
99 | ,(string-append "--with-pfm-prefix=" | |
100 | #$(this-package-input "libpfm4"))) | |
101 | ||
102 | #:phases | |
103 | #~(modify-phases %standard-phases | |
104 | (add-after 'unpack 'change-directory | |
105 | (lambda _ | |
106 | (chdir "src") | |
107 | ||
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\"") | |
112 | "false")))) | |
113 | (add-after 'install 'extra-doc | |
114 | (lambda* (#:key outputs #:allow-other-keys) | |
115 | (let ((doc (string-append (assoc-ref outputs "out") | |
116 | "/share/doc/" | |
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")))))))) | |
211748d4 | 122 | (home-page "https://icl.utk.edu/papi/") |
6a3af24f DL |
123 | (synopsis "Performance Application Programming Interface") |
124 | (description | |
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. | |
129 | ||
130 | In addition, PAPI provides access to a collection of components that expose | |
131 | performance measurement opportunites across the hardware and software stack.") | |
895c1c20 LC |
132 | (properties |
133 | '((release-monitoring-url | |
134 | . "http://icl.cs.utk.edu/papi/software/"))) | |
6a3af24f DL |
135 | ;; See Debian papi copyright file. |
136 | (license (list license:bsd-3 | |
775203e5 | 137 | license:lgpl2.1+ ;src/components/infiniband/pscanf.h |
6a3af24f DL |
138 | ;; not used in output |
139 | license:gpl2+ ;src/components/appio/tests/iozone/gengnuplot.sh | |
6a3af24f | 140 | )))) |
a6121c0a DL |
141 | |
142 | ;; NB. there's a potential name clash with libotf. | |
143 | (define-public otf2 | |
144 | (package | |
145 | (name "otf2") | |
27114bc3 | 146 | (version "2.1.1") |
a6121c0a DL |
147 | (source |
148 | (origin | |
149 | (method url-fetch) | |
150 | (uri (string-append "http://www.vi-hps.org/upload/packages/otf2/otf2-" | |
151 | version ".tar.gz")) | |
27114bc3 | 152 | (sha256 (base32 "1ls7rz6qwnqbkifpafc95bnfh3m9xbs74in8zxlnhfbgwx11nn81")))) |
8394619b | 153 | (native-inputs (list python)) |
a6121c0a DL |
154 | (outputs '("doc" ; 18MB |
155 | "lib" | |
156 | "out")) | |
157 | (build-system gnu-build-system) | |
158 | (arguments | |
159 | `(#:configure-flags '("--enable-shared" "--disable-static") | |
160 | #:phases | |
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) | |
166 | "/share/doc/otf2"))) | |
167 | (install-file "COPYING" doc))) | |
168 | '("lib" "doc")) | |
169 | #t))))) | |
170 | (home-page "http://www.vi-hps.org/projects/score-p/") | |
171 | (synopsis "Open Trace Format 2 library") | |
fb5fedfe TGR |
172 | (description "The Open Trace Format 2 (@dfn{OTF2}) is a scalable, |
173 | memory-efficient event trace data format plus support library.") | |
a6121c0a | 174 | (license license:bsd-3))) |
3c8d1f94 DL |
175 | |
176 | (define-public opari2 | |
177 | (package | |
178 | (name "opari2") | |
2559c243 | 179 | (version "2.0.5") |
3c8d1f94 DL |
180 | (source |
181 | (origin | |
2cea4ac7 TGR |
182 | (method url-fetch) |
183 | (uri (string-append "https://www.vi-hps.org/cms/upload/packages/opari2/" | |
184 | "opari2-" version ".tar.gz")) | |
2559c243 TGR |
185 | (sha256 |
186 | (base32 "1xaf25lcxk4ky1kzfks40ja9mayh8pnmrzch2107c8dcjrsxsd4h")))) | |
3c8d1f94 | 187 | (build-system gnu-build-system) |
8394619b LC |
188 | (inputs (list gfortran)) |
189 | (native-inputs (list gawk ; for tests | |
190 | which)) | |
9f53d58a | 191 | (home-page "https://www.vi-hps.org/projects/score-p") |
3c8d1f94 DL |
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))) | |
a66408f8 DL |
197 | |
198 | (define-public cube | |
199 | (package | |
200 | (name "cube") | |
201 | (version "4.3.5") | |
202 | (source | |
203 | (origin | |
204 | (method url-fetch) | |
205 | (uri (string-append | |
206 | "http://apps.fz-juelich.de/scalasca/releases/cube/4.3/dist/cube-" | |
207 | version ".tar.gz")) | |
208 | (sha256 (base32 "04irflia4rfw02093w9nx7rr98r640y4q8hisjywvd4b7r3nzhhx")) | |
209 | (patches (search-patches "cube-nocheck.patch")))) | |
8394619b LC |
210 | (inputs (list dbus zlib)) |
211 | (native-inputs (list perl qtbase-5 ; native because of qmake | |
212 | which)) | |
a66408f8 DL |
213 | |
214 | ;; FIXME: The doc is 14MB, but adding a doc output results in a cycle. | |
215 | (outputs '("out" ;"doc" | |
216 | "lib")) | |
217 | ||
218 | (build-system gnu-build-system) | |
219 | (arguments | |
220 | `(#:configure-flags | |
221 | `("--enable-shared" "--disable-static" "--disable-silent-rules" | |
222 | ,(string-append "LDFLAGS=-L" (assoc-ref %outputs "lib") "/lib")) | |
223 | #:parallel-tests? #f | |
224 | #:phases | |
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") | |
230 | "/lib"))) | |
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))) | |
237 | #t))) | |
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")) | |
244 | #t))) | |
245 | (add-after 'install 'licence | |
246 | (lambda* (#:key outputs #:allow-other-keys) | |
247 | (let ((doc (string-append (assoc-ref outputs "lib") | |
248 | "/share/doc/cube"))) | |
249 | (install-file "COPYING" doc) | |
250 | #t))) | |
251 | ;; XXX: Commented due to cycle (see comment above.) | |
252 | ;; (add-after 'install 'doc | |
253 | ;; (lambda _ | |
254 | ;; (let ((share (string-append (assoc-ref %outputs "doc") | |
255 | ;; "/share"))) | |
256 | ;; (mkdir-p share) | |
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 | |
261 | (lambda _ | |
262 | (let ((outlib (string-append (assoc-ref %outputs "out") "/lib")) | |
263 | (lib (string-append (assoc-ref %outputs "lib") "/lib"))) | |
264 | (mkdir-p outlib) | |
265 | (rename-file (string-append lib "/cube-plugins") | |
266 | (string-append outlib "/cube-plugins")) | |
267 | (for-each (lambda (file) | |
268 | (rename-file | |
269 | file (string-append outlib "/" (basename file)))) | |
270 | (append (find-files lib "libgraphwidgetcommon-plugin\\..*") | |
271 | (find-files lib "libcube4gui\\.so.*"))) | |
272 | #t))) | |
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") | |
278 | "/include")) | |
279 | (libinc (string-append (assoc-ref outputs "lib") | |
280 | "/include"))) | |
281 | (for-each (lambda (file) | |
282 | (let ((from (string-append outinc "/" file))) | |
283 | (copy-recursively from libinc) | |
284 | (delete-file-recursively from))) | |
285 | '("cube" "cubew")) | |
286 | #t))) | |
287 | ||
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. | |
291 | ;; | |
292 | ;; (add-after 'install 'cube-config | |
293 | ;; (lambda _ | |
294 | ;; (let* ((lib (assoc-ref %outputs "lib")) | |
295 | ;; (libbin (string-append lib "/bin"))) | |
296 | ;; (mkdir-p libbin) | |
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"))) | |
307 | (mkdir-p libbin) | |
308 | (install-file (string-append %output "/bin/cube-config") libbin) | |
309 | (install-file (string-append %output "/bin/cube-config-backend") | |
310 | libbin) | |
311 | (substitute* (list (string-append libbin "/cube-config")) | |
312 | (("^source .*frontend.*$") "") | |
313 | (((assoc-ref outputs "out")) lib)) | |
314 | #t)))))) | |
20035fa7 | 315 | (home-page "https://www.scalasca.org/software/cube-4.x/download.html") |
a66408f8 DL |
316 | (synopsis "Performance report explorer for parallel programs") |
317 | (description | |
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))) | |
fb993719 DL |
327 | |
328 | (define (make-scorep mpi) | |
329 | (package | |
330 | (name (string-append "scorep-" (package-name mpi))) | |
331 | (version "3.1") | |
332 | (source (origin | |
333 | (method url-fetch) | |
334 | (uri (string-append | |
335 | "http://www.vi-hps.org/upload/packages/scorep/scorep-" | |
336 | version ".tar.gz")) | |
337 | (sha256 | |
338 | (base32 | |
339 | "0h45357djna4dn9jyxx0n36fhhms3jrf22988m9agz1aw2jfivs9")) | |
340 | (modules '((guix build utils))) | |
341 | (snippet | |
342 | ;; Remove bundled software. | |
6cbee49d MW |
343 | '(begin |
344 | (for-each delete-file-recursively | |
345 | '("vendor/opari2" "vendor/cube")) | |
346 | #t)))) | |
fb993719 DL |
347 | (build-system gnu-build-system) |
348 | (inputs | |
349 | `(("mpi" ,mpi) | |
350 | ("papi" ,papi) | |
351 | ("opari2" ,opari2) | |
352 | ("libunwind" ,libunwind) | |
353 | ("otf2" ,otf2) | |
354 | ("cubelib" ,cube "lib") ;for lib, include | |
355 | ("openmpi" ,openmpi) | |
356 | ("zlib" ,zlib))) | |
357 | (native-inputs | |
8394619b LC |
358 | (list gfortran |
359 | flex | |
360 | cube ;for cube-config | |
361 | bison | |
362 | python | |
363 | doxygen | |
364 | which)) | |
fb993719 DL |
365 | (arguments |
366 | `(#:configure-flags | |
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"))) | |
372 | #:parallel-tests? #f | |
373 | #:make-flags '("V=1") | |
374 | #:phases | |
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) | |
381 | #t)))))) | |
382 | (home-page "http://www.vi-hps.org/projects/score-p/") | |
383 | (synopsis "Performance measurement infrastructure for parallel code") | |
384 | (description | |
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))) | |
390 | ||
391 | (define-public scorep-openmpi (make-scorep openmpi)) |