projects/guix·blob java-team · refs

110 lines · 4.4 KiB

1;;; Copyright © 2023 Advanced Micro Devices, Inc.
2;;; Copyright © 2025-2026 Ludovic Courtès <[email protected]>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (gnu packages rocm-apps)
20 #:use-module (guix gexp)
21 #:use-module (guix build-system cmake)
22 #:use-module (guix git-download)
23 #:use-module (guix packages)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages llvm)
27 #:use-module (gnu packages mpi)
28 #:use-module (gnu packages rocm)
29 #:use-module (gnu packages rocm-libs)
30 #:use-module (gnu packages version-control))
31
32(define-public rochpl
33 (package
34 (name "rochpl")
35 (version "7.0.2")
36 (home-page "https://github.com/ROCm/rocHPL")
37 (source
38 (origin
39 (method git-fetch)
40 (uri (git-reference
41 (url home-page)
42 (commit (string-append "v" version))))
43 (file-name (git-file-name name version))
44 (sha256
45 (base32 "0i3aqd2jnd4ivcpqli75kr9019fcraylxxv9laixmyx9gfxv20f0"))
46 (patches (search-patches "rochpl-supported-distros.patch"))))
47 (build-system cmake-build-system)
48 (arguments
49 (list
50 #:configure-flags
51 #~(list (string-append "-DGPU_TARGETS="
52 #$(current-amd-gpu-targets-string))
53
54 ;; "find_package(ROCM)" is deprecated since 6.4 so most likely
55 ;; the reference to 'ROCM_FOUND' is incorrect.
56 "-DROCM_FOUND=ON"
57
58 (string-append "-DHIP_ROOT_DIR="
59 #$(this-package-native-input "rocm-toolchain"))
60 (string-append "-DROCM_PATH="
61 #$(this-package-input "rocm-hip-runtime"))
62 (string-append "-DHPL_MPI_DIR="
63 #$(this-package-input "openmpi-rocm")))
64 #:tests? #f ;no tests
65 #:phases
66 #~(modify-phases %standard-phases
67 (add-after 'unpack 'avoid-native-optimizations
68 (lambda _
69 (substitute* "CMakeLists.txt"
70 (("-march=native")
71 ""))))
72 (add-after 'unpack 'set-default-data-file-name
73 (lambda _
74 ;; Set the default 'HPL.dat' file name in 'run_rochpl' & co.
75 (substitute* (find-files "scripts" "\\.in")
76 (("filename=HPL\\.dat")
77 (string-append "filename=" #$output
78 "/share/rochpl/HPL.dat")))))
79 (add-after 'install 'move-files-where-they-belong
80 (lambda _
81 ;; Move files from the top level to the relevant directories.
82 (let ((datadir (string-append #$output "/share/rochpl")))
83 (for-each (lambda (program)
84 (rename-file
85 (string-append #$output "/" program)
86 (string-append #$output "/bin/"
87 program)))
88 '("mpirun_rochpl" "run_rochpl"))
89
90 (mkdir-p datadir)
91 (rename-file (string-append #$output "/HPL.dat")
92 (string-append datadir "/HPL.dat"))))))))
93 (native-inputs
94 (list rocm-toolchain rocm-cmake git-minimal/pinned))
95 (inputs
96 (list rocm-hip-runtime
97 rocblas
98 libomp-rocm
99 openmpi-rocm))
100 (synopsis "Linear algebra benchmark for AMD GPUs")
101 (description
102 "rocHPL is a benchmark based on the @acronym{HPL, high-performance
103LINPACK} benchmark, a reference linear-algebra benchmark, implemented on top
104of AMD's Radeon Open Compute (ROCm) platform. rocHPL is created using the HIP
105programming language and optimized for AMD's discrete GPUs.")
106 (properties
107 `((amd-gpu-targets . ,%default-amd-gpu-targets)
108 (tunable? . #t)))
109 (license (list license:bsd-4 license:bsd-3))))
110