projects/guix·blob java-team · refs

606 lines · 24.2 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2017 Dave Love <[email protected]>
3;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <[email protected]>
4;;; Copyright © 2022 Ludovic Courtès <[email protected]>
5;;; Copyright © 2023 dan <[email protected]>
6;;; Copyright © 2025 Luca Cirrottola <[email protected]>
7;;; Copyright © 2025, 2026 Artyom V. Poptsov <[email protected]>
8;;; Copyright © 2026 Cayetano Santos <[email protected]>
9;;; Copyright @ 2026 Johannes Elsing <[email protected]>
10;;;
11;;; This file is part of GNU Guix.
12;;;
13;;; GNU Guix is free software; you can redistribute it and/or modify it
14;;; under the terms of the GNU General Public License as published by
15;;; the Free Software Foundation; either version 3 of the License, or (at
16;;; your option) any later version.
17;;;
18;;; GNU Guix is distributed in the hope that it will be useful, but
19;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;;; GNU General Public License for more details.
22;;;
23;;; You should have received a copy of the GNU General Public License
24;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26(define-module (gnu packages profiling)
27 #:use-module (guix packages)
28 #:use-module (guix gexp)
29 #:use-module (guix git-download)
30 #:use-module ((guix licenses) #:prefix license:) ; avoid zlib, expat clashes
31 #:use-module (guix download)
32 #:use-module (guix utils)
33 #:use-module (guix build-system cmake)
34 #:use-module (guix build-system gnu)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages autotools)
37 #:use-module (gnu packages base) ;for "which"
38 #:use-module (gnu packages bash) ;for "which"
39 #:use-module (gnu packages build-tools)
40 #:use-module (gnu packages bison)
41 #:use-module (gnu packages compression)
42 #:use-module (gnu packages documentation)
43 #:use-module (gnu packages engineering)
44 #:use-module (gnu packages fabric-management)
45 #:use-module (gnu packages compiler-tools)
46 #:use-module (gnu packages fontutils)
47 #:use-module (gnu packages freedesktop)
48 #:use-module (gnu packages gawk)
49 #:use-module (gnu packages gcc)
50 #:use-module (gnu packages gl)
51 #:use-module (gnu packages glib)
52 #:use-module (gnu packages haskell-xyz)
53 #:use-module (gnu packages libunwind)
54 #:use-module (gnu packages linux)
55 #:use-module (gnu packages llvm)
56 #:use-module (gnu packages mpi)
57 #:use-module (gnu packages ncurses)
58 #:use-module (gnu packages perl)
59 #:use-module (gnu packages protobuf)
60 #:use-module (gnu packages pkg-config)
61 #:use-module (gnu packages python)
62 #:use-module (gnu packages qt)
63 #:use-module (gnu packages xdisorg))
64
65;; Fixme: Separate out lib and fix resulting cycle errors; separate libpfm
66;; output(?); build libmsr and add that component.
67(define-public papi
68 (package
69 (name "papi")
70 (version "6.0.0.1")
71 (source
72 (origin
73 (method url-fetch)
74 (uri (string-append "https://icl.utk.edu/projects/papi/downloads/papi-"
75 version ".tar.gz"))
76 (sha256
77 (base32 "0zr83v51lp4ijgk997dz9fpph48prlsbml26dvb223avqr8fvmrw"))
78 (modules '((guix build utils)))
79 (snippet
80 '(begin
81 ;; Remove bundled software.
82 (for-each delete-file-recursively
83 '("src/libpfm-3.y" "src/libpfm4"
84 "src/perfctr-2.6.x"
85 "src/perfctr-2.7.x"))
86
87 ;; Adjust include directives.
88 (substitute* "src/components/lmsensors/linux-lmsensors.c"
89 (("<sensors.h>")
90 "<sensors/sensors.h>"))))))
91 (build-system gnu-build-system)
92 (inputs
93 (list ncurses
94 rdma-core
95 libpfm4
96 `(,lm-sensors "lib")
97 `(,infiniband-diags "lib")
98 net-tools))
99 (native-inputs
100 (list gcc-13
101 gfortran-13))
102 (arguments
103 (list #:tests? #f ;no check target
104 #:configure-flags
105 ;; These are roughly per Fedora, but elide mx (assumed to be dead, even
106 ;; Open-MX) and add and powercap -- I don't know the pros/cons of
107 ;; infiniband and infiniband_mad, but you can't use them together, and
108 ;; the umad version needs at least one patch.
109 ;; Implicit enabled components: perf_event perf_event_uncore
110 #~`("--with-perf-events" "--with-shared-lib=yes" "--with-shlib"
111 "--with-static-lib=no" "--with-shlib-tools"
112 "--with-components=appio coretemp example lustre micpower net rapl \
113stealtime lmsensors infiniband powercap"
114 ;; So utils get rpath set correctly:
115 ,(string-append "LDFLAGS=-Xlinker -rpath -Xlinker "
116 #$output "/lib")
117 ,(string-append "--with-pfm-prefix="
118 #$(this-package-input "libpfm4")))
119
120 #:phases
121 #~(modify-phases %standard-phases
122 (add-after 'unpack 'change-directory
123 (lambda _
124 (chdir "src")
125
126 ;; Work around a mistake whereby 'configure' would always error
127 ;; out when passing '--with-static-lib=no'.
128 (substitute* "configure"
129 (("test \"\\$static_lib\" = \"no\"")
130 "false"))))
131 (add-after 'install 'extra-doc
132 (lambda* (#:key outputs #:allow-other-keys)
133 (let ((doc (string-append (assoc-ref outputs "out")
134 "/share/doc/"
135 #$name "-" #$version)))
136 (chdir "..") ; we went into src above
137 (for-each (lambda (file)
138 (install-file file doc))
139 '("README.md" "RELEASENOTES.txt"))))))))
140 (home-page "https://icl.utk.edu/papi/")
141 (synopsis "Performance Application Programming Interface")
142 (description
143 "PAPI provides the tool designer and application engineer with a consistent
144interface and methodology for use of the performance counter hardware found in
145most major microprocessors. PAPI enables software engineers to see, in near
146real time, the relation between software performance and processor events.
147
148In addition, PAPI provides access to a collection of components that expose
149performance measurement opportunities across the hardware and software stack.")
150 (properties
151 '((release-monitoring-url
152 . "http://icl.cs.utk.edu/papi/software/")))
153 ;; See Debian papi copyright file.
154 (license (list license:bsd-3
155 license:lgpl2.1+ ;src/components/infiniband/pscanf.h
156 ;; not used in output
157 license:gpl2+ ;src/components/appio/tests/iozone/gengnuplot.sh
158 ))))
159
160(define-public ittapi
161 (package
162 (name "ittapi")
163 (version "3.28.2")
164 (source
165 (origin
166 (method git-fetch)
167 (uri (git-reference
168 (url "https://github.com/intel/ittapi/")
169 (commit (string-append "v" version))))
170 (file-name (git-file-name name version))
171 (sha256
172 (base32
173 "089q50ma8g3qxyxv37w3g8yxlpxah94lv06bi4r0l4p5v6w8a365"))))
174 (build-system cmake-build-system)
175 (arguments
176 (list
177 #:tests? #f ;there are no tests
178 #:configure-flags #~(list "-DITT_API_IPT_SUPPORT=ON")))
179 (native-inputs
180 (list python-minimal-wrapper))
181 (home-page
182 "https://github.com/intel/ittapi/")
183 (synopsis "Intel instrumentation and tracing APIs")
184 (description
185 "This package provides the Intel @acronym{ITT, Instrumentation and
186Tracing Technology} and @acronym{JIT, Just-In-Time} profiling APIs, to
187generate and control the collection of trace data during program execution.")
188 (license license:gpl2)))
189
190;; NB. there's a potential name clash with libotf.
191(define-public otf2
192 (package
193 (name "otf2")
194 (version "3.1.1")
195 (source
196 (origin
197 (method url-fetch)
198 (uri (string-append "https://perftools.pages.jsc.fz-juelich.de/cicd/otf2/tags/otf2-"
199 version "/otf2-" version ".tar.gz"))
200 (sha256 (base32 "0vhai3xsb1kbqy2fqcvzv9pk886p1iq5pi9mzsadfkmca4x02kjs"))))
201 (native-inputs (list python))
202 (outputs '("doc" ; 21MB
203 "lib"
204 "out"))
205 (build-system gnu-build-system)
206 (arguments
207 `(#:configure-flags '("--enable-shared" "--disable-static")
208 #:phases
209 (modify-phases %standard-phases
210 (add-after 'unpack 'normalize-pkgconfig-files-location
211 (lambda _
212 ;; Prevent lib/pkgconfig/otf2-backend.pc from referencing the
213 ;; prefix of output "out" from the "lib" store location.
214 (substitute* "otf2-build.pc.in"
215 (("^prefix=.*") "")
216 (("^exec_prefix=.*") ""))))
217 (add-after 'install 'licence
218 (lambda* (#:key outputs #:allow-other-keys)
219 (for-each (lambda (output)
220 (let ((doc (string-append (assoc-ref outputs output)
221 "/share/doc/otf2")))
222 (install-file "COPYING" doc)))
223 '("lib" "doc"))
224 #t)))))
225 (home-page "https://www.vi-hps.org/projects/score-p/")
226 (synopsis "Open Trace Format 2 library")
227 (description "The Open Trace Format 2 (@dfn{OTF2}) is a scalable,
228memory-efficient event trace data format plus support library.")
229 (license license:bsd-3)))
230
231(define-public opari2
232 (package
233 (name "opari2")
234 (version "2.0.9")
235 (source
236 (origin
237 (method url-fetch)
238 (uri (string-append "https://perftools.pages.jsc.fz-juelich.de/cicd/opari2/tags/opari2-"
239 version "/opari2-" version ".tar.gz"))
240 (sha256
241 (base32 "0yfpzxy70wp6mwi6pvvc9a6bkaal14yysiddmvx6lrn5azvkjwfm"))))
242 (build-system gnu-build-system)
243 (inputs (list gfortran))
244 (native-inputs (list gawk ; for tests
245 which))
246 (home-page "https://www.vi-hps.org/projects/score-p")
247 (synopsis "OpenMP runtime performance measurement instrumenter")
248 (description "OPARI2 is a source-to-source instrumentation tool for OpenMP
249and hybrid codes. It surrounds OpenMP directives and runtime library calls
250with calls to the POMP2 measurement interface.")
251 (license license:bsd-3)))
252
253;; Since version 4.4, CUBE has been split in three different packages: CubeW,
254;; CubeLib, CubeGUI. They are still released together, so we conventionally
255;; define cubew as the parent package for cubelib and cubegui to factorize
256;; common data.
257(define-public cubew
258 (package
259 (name "cubew")
260 (version "4.9")
261 (source
262 (origin
263 (method url-fetch)
264 (uri
265 (string-append "https://apps.fz-juelich.de/scalasca/releases/cube/"
266 version "/dist/cubew-"
267 version ".tar.gz"))
268 (sha256
269 (base32 "1pdcs8688y4nwcxshgs9773xmdajxahsbjsrfh8m7gv9qn0lxxsf"))))
270 (build-system gnu-build-system)
271 (arguments
272 (list
273 #:configure-flags
274 #~(list "--enable-shared" "--disable-static" "--disable-silent-rules"
275 (string-append "--with-frontend-zlib="
276 #$(this-package-input "zlib") "/lib")
277 (string-append "--with-backend-zlib="
278 #$(this-package-input "zlib") "/lib"))))
279 (inputs
280 (list zlib))
281 (home-page "https://www.scalasca.org/software/cube-4.x/download.html")
282 (synopsis "CUBE high performance C writer library")
283 (description
284 "CUBE (CUBE Uniform Behavioral Encoding) is a tool to display a variety
285of performance metrics for parallel programs including MPI and OpenMP
286applications. CubeW is the high performance C writer library of the CUBE
287project.")
288 (license license:bsd-3)))
289
290(define-public cubelib
291 (package/inherit cubew
292 (name "cubelib")
293 (source
294 (origin
295 (method url-fetch)
296 (uri
297 (string-append "https://apps.fz-juelich.de/scalasca/releases/cube/"
298 (package-version cubew) "/dist/cubelib-"
299 (package-version cubew) ".tar.gz"))
300 (sha256
301 (base32 "0hwl0aihn6fgpl0qhqckxc3sslb78wq6xav5ykfgfjzpyddqyrd0"))))
302 (arguments
303 (substitute-keyword-arguments arguments
304 ((#:configure-flags flags)
305 #~(append #$flags
306 (list "--with-compression=full")))
307 ((#:parallel-tests? _ #f) #f)))
308 (inputs
309 (list zlib))
310 (synopsis "CUBE C++ profile library")
311 (description
312 "CUBE (CUBE Uniform Behavioral Encoding) is a tool to display a variety
313of performance metrics for parallel programs including MPI and OpenMP
314applications. CubeLib is the general purpose C++ library and tool of the CUBE
315project.")))
316
317(define-public cubegui
318 (package/inherit cubew
319 (name "cubegui")
320 (source
321 (origin
322 (method url-fetch)
323 (uri
324 (string-append "https://apps.fz-juelich.de/scalasca/releases/cube/"
325 (package-version cubew) "/dist/cubegui-"
326 (package-version cubew) ".tar.gz"))
327 (sha256
328 (base32 "04byhf00xnn1ppca914ag4hq2kjv37lhwyh8dl369ps47mp6viqh"))))
329 (arguments
330 (list
331 #:configure-flags
332 #~(list "--enable-shared" "--disable-static" "--disable-silent-rules"
333 (string-append "CXXFLAGS=-I" #$(this-package-input "dbus")
334 "/include/dbus-1.0")
335 (string-append "LDFLAGS=-L" #$(this-package-input "dbus")
336 "/lib"))))
337 (native-inputs
338 (list qtbase))
339 (inputs
340 (list cubelib
341 dbus
342 perl))
343 (synopsis "CUBE profile explorer GUI")
344 (description
345 "CUBE (CUBE Uniform Behavioral Encoding) is a tool to display a variety
346of performance metrics for parallel programs including MPI and OpenMP
347applications. CubeGUI is the graphical explorer of the CUBE project.")))
348
349(define-public tracy-wayland
350 (package
351 (name "tracy-wayland")
352 (version "0.10")
353 (source
354 (origin
355 (method git-fetch)
356 (uri (git-reference
357 (url "https://github.com/wolfpld/tracy")
358 (commit (string-append "v" version))))
359 (sha256
360 (base32
361 "1w50bckvs1nn68amzrkyrh769dhmlhk7w00kr8ac5h9ryk349p8c"))
362 (file-name (git-file-name "tracy" version))
363 (modules '((guix build utils)))
364 (snippet
365 '(begin
366 ;; XXX: Sadly, the ImGui loaders appear to have been customized by
367 ;; the project and the build fails when using the 'imgui' Guix
368 ;; package due to a missing GL_TEXTURE_WRAP_S definition, so keep
369 ;; the bundled copy.
370
371 ;; Unbundle Zstd.
372 (delete-file-recursively "zstd")
373 ;; Adjust the include directives.
374 (substitute* (find-files "server" "\\.(c|h)pp$")
375 (("#include \".*zstd/(zstd|zdict).h\"" _ header)
376 (format #f "#include \"~a.h\"" header)))
377 ;; De-register source files from Visual Code project.
378 (substitute* "profiler/build/win32/Tracy.vcxproj"
379 ((".*Include=\"..\\\\..\\\\..\\\\zstd\\\\.*") ""))))))
380 ;; Note: There is also CMake and Meson support, but only to build the
381 ;; tracy library, not the profiler command.
382 (build-system gnu-build-system)
383 (arguments
384 (list
385 #:tests? #f ;no test for the profiler
386 #:make-flags
387 #~(list (string-append "CC=" #$(cc-for-target))
388 (string-append "CFLAGS=-lzstd"))
389 #:phases
390 #~(modify-phases %standard-phases
391 (add-before 'build 'chdir
392 (lambda _
393 (chdir "profiler/build/unix")))
394 (delete 'configure) ;the profiler has no configure script
395 (replace 'install
396 (lambda _
397 (let ((bin (string-append #$output "/bin"))
398 (tracy (string-append #$output "/bin/tracy")))
399 (mkdir-p bin)
400 (copy-file "Tracy-release" tracy)))))))
401 (inputs (list capstone
402 dbus
403 freetype
404 libxkbcommon
405 mesa
406 wayland
407 `(,zstd "lib")))
408 (native-inputs (list gcc-13 pkg-config))
409 (home-page "https://github.com/wolfpld/tracy")
410 (synopsis "Frame profiler")
411 (description
412 "A real time, nanosecond resolution, remote telemetry, hybrid frame and
413sampling profiler for games and other applications.")
414 (license license:bsd-3)))
415
416(define-public tracy
417 (package;xb
418 (inherit tracy-wayland)
419 (name "tracy")
420 (arguments
421 (substitute-keyword-arguments arguments
422 ((#:make-flags flags #~'())
423 #~(append #$flags
424 ;; The LEGACY flag indicate we want to build tracy with glfw.
425 (list "LEGACY=1")))))
426 (inputs (modify-inputs inputs
427 (delete "libxkbcommon" "wayland")
428 (prepend glfw)))
429 (synopsis "Frame profiler (X11 version)")))
430
431(define-public scalasca
432 (package
433 (name "scalasca")
434 (version "2.6.2")
435 (source
436 (origin
437 (method url-fetch)
438 (uri (string-append
439 "https://apps.fz-juelich.de/scalasca/releases/scalasca/2.6/"
440 "dist/scalasca-" version ".tar.gz"))
441 (sha256
442 (base32
443 "18022bzdlzdgngcc5zlmsakvsk9dfg14kvg4ancqfhxy13cjzrqp"))
444 ;; Remove bundled dependencies that can be replaced by inputs
445 (snippet
446 #~(begin
447 (use-modules (guix build utils))
448 (delete-file-recursively "vendor/cubew/")
449 (delete-file-recursively "vendor/otf2/")))))
450 (build-system gnu-build-system)
451 (arguments
452 (list
453 #:configure-flags
454 #~(list "--enable-shared" "--disable-static")
455 #:phases
456 #~(modify-phases %standard-phases
457 (add-after 'install 'wrap-scripts
458 ;; Use wrap-program on some outputs to resolve runtime dependency
459 ;; on coreutils, sed... without propagating these inputs.
460 (lambda* (#:key outputs #:allow-other-keys)
461 (with-directory-excursion
462 (string-append #$output "/bin")
463 (for-each
464 (lambda (file)
465 (wrap-program file
466 `("PATH" ":" prefix ,(search-path-as-string->list
467 (getenv "PATH")))))
468 (list "scalasca" "skin" "square"))))))))
469 (inputs
470 (list openmpi
471 cubew
472 otf2
473 zlib
474 libiberty
475 which ; configure and runtime dependency
476 findutils ; runtime dependency
477 gawk ; runtime dependency
478 scorep-openmpi ; runtime dependency
479 cubelib ; otherwise "ERROR: cube_dump is not available!"
480 cubegui ; needed at runtime
481 bash-minimal)) ; needed for using "wrap-program" in the recipe
482 (home-page "https://scalasca.org")
483 (synopsis "Performance analysis of parallel programs through runtime
484measurements")
485 (description
486 "Scalasca targets mainly scientific and engineering applications based on
487the programming interfaces MPI and OpenMP, including hybrid applications based
488on a combination of the two. Unlike Scalasca 1.x, the Scalasca 2.x release
489series is based on the community instrumentation and measurement infrastructure
490Score-P. This significantly improves interoperability with other performance
491analysis tool suites such as Vampir and TAU due to the usage of the two common
492data formats CUBE4 for profiles and the Open Trace Format 2 (OTF2) for event
493trace data.")
494 (license license:bsd-3)))
495
496(define-public perfetto
497 (package
498 (name "perfetto")
499 (version "53.0")
500 (source (origin
501 (method git-fetch)
502 (uri (git-reference
503 (url "https://github.com/google/perfetto")
504 (commit (string-append "v" version))))
505 (file-name (git-file-name name version))
506 (sha256
507 (base32
508 "1g2r90348pl173r3wp9k5546sdgan3pdw0002bqicaw028j3gq96"))
509 (modules '((guix build utils)))
510 (snippet
511 #~(for-each (lambda (name)
512 (unless (string-suffix? "trigger.pzc.h" name)
513 (delete-file name)))
514 (find-files "." "\\.pzc")))))
515 (build-system gnu-build-system)
516 (arguments
517 (list
518 #:phases
519 #~(modify-phases %standard-phases
520 (add-after 'unpack 'build-documentation
521 (lambda _
522 (invoke "pandoc" "docs/reference/perfetto-cli.md"
523 "--standalone" "-t" "man"
524 "-o" "perfetto.1")))
525 (add-after 'build-documentation 'remove-origin-rpath
526 (lambda _
527 (substitute* "gn/standalone/BUILD.gn"
528 ((".*-rpath=.*ORIGIN.*") ""))))
529 (replace 'configure
530 (lambda _
531 (invoke "gn" "gen"
532 (string-append
533 "--args="
534 "is_debug=false"
535 " perfetto_use_pkgconfig=true"
536 " perfetto_use_system_protobuf=true"
537 " perfetto_use_system_zlib=true"
538 " use_custom_libcxx=false"
539 " skip_buildtools_check=true"
540 " is_hermetic_clang=false"
541 " is_system_compiler=true"
542 " is_clang=false"
543 (string-append " extra_ldflags=\""
544 "-Wl,-rpath=" #$output "/lib\""))
545 "out/linux")))
546 (replace 'build
547 (lambda* (#:key parallel-build? #:allow-other-keys)
548 (invoke "ninja" "-j"
549 (number->string (if parallel-build?
550 (parallel-job-count)
551 1))
552 "-C" "out/linux"
553 "perfetto"
554 "protozero_c_plugin" ; for gen_c_protos
555 "tracebox"
556 "traced"
557 "traced_probes")))
558 (add-after 'build 'generate-headers
559 (lambda _
560 (substitute* "tools/gen_c_protos"
561 ((".*call.*ninja.*") "")
562 (("def protoc_path.*")
563 "def protoc_path(_):\n return 'protoc'\n")
564 ((".*path.*clang-format not found.*")
565 " 'BUILD.gn')\n path='clang-format'\n"))
566 (invoke "tools/gen_c_protos" "out/linux")))
567 (delete 'check)
568 (replace 'install
569 (lambda _
570 (let ((bin (string-append #$output "/bin"))
571 (include (string-append #$output "/include"))
572 (lib (string-append #$output "/lib"))
573 (doc (string-append #$output "/share/man/man1")))
574 (mkdir-p bin)
575 (mkdir-p include)
576 (mkdir-p lib)
577 (mkdir-p doc)
578 (copy-recursively "include/perfetto"
579 (string-append include "/perfetto"))
580 (for-each delete-file
581 (filter (lambda (name)
582 (or (string=? "README.md" name)
583 (string=? "BUILD.gn" name)))
584 (find-files include)))
585 (install-file "out/linux/libperfetto.so" lib)
586 (install-file "out/linux/traced" bin)
587 (install-file "out/linux/traced_probes" bin)
588 (install-file "out/linux/perfetto" bin)
589 (install-file "out/linux/tracebox" bin)
590 (install-file "perfetto.1" doc)))))))
591 (native-inputs
592 (list clang-21 ; for clang-format used by gen_c_protos
593 gn
594 ninja
595 pandoc
596 pkg-config
597 protobuf
598 python-minimal-wrapper))
599 (inputs (list zlib))
600 (home-page "https://perfetto.dev/")
601 (synopsis "Framework for client-side tracing and profiling")
602 (description "Perfetto is a framework for performance instrumentation and
603trace analysis. This package contains the library, the @code{traced} and
604@code{traced_probes} daemons as well as the @code{perfetto} command-line
605interface.")
606 (license license:asl2.0)))