projects/guix·blob javascript-team · refs

121 lines · 5.0 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 linux)
27 #:use-module (gnu packages llvm)
28 #:use-module (gnu packages mpi)
29 #:use-module (gnu packages rocm)
30 #:use-module (gnu packages rocm-libs)
31 #:use-module (gnu packages version-control))
32
33(define-public rochpl
34 (package
35 (name "rochpl")
36 (version "7.0.2")
37 (home-page "https://github.com/ROCm/rocHPL")
38 (source
39 (origin
40 (method git-fetch)
41 (uri (git-reference
42 (url home-page)
43 (commit (string-append "v" version))))
44 (file-name (git-file-name name version))
45 (sha256
46 (base32 "0i3aqd2jnd4ivcpqli75kr9019fcraylxxv9laixmyx9gfxv20f0"))
47 (patches (search-patches "rochpl-supported-distros.patch"))))
48 (build-system cmake-build-system)
49 (arguments
50 (list
51 #:configure-flags
52 #~(list (string-append "-DGPU_TARGETS="
53 #$(current-amd-gpu-targets-string))
54
55 ;; "find_package(ROCM)" is deprecated since 6.4 so most likely
56 ;; the reference to 'ROCM_FOUND' is incorrect.
57 "-DROCM_FOUND=ON"
58
59 (string-append "-DHIP_ROOT_DIR="
60 #$(this-package-native-input "rocm-toolchain"))
61 (string-append "-DROCM_PATH="
62 #$(this-package-input "rocm-hip-runtime"))
63 (string-append "-DHPL_MPI_DIR="
64 #$(this-package-input "openmpi-rocm")))
65 #:tests? #f ;no tests
66 #:phases
67 #~(modify-phases %standard-phases
68 (add-after 'unpack 'avoid-native-optimizations
69 (lambda _
70 (substitute* "CMakeLists.txt"
71 (("-march=native")
72 ""))))
73 (add-after 'unpack 'record-file-names-in-scripts
74 (lambda* (#:key inputs #:allow-other-keys)
75 (substitute* (find-files "scripts" "\\.in")
76 ;; Set the default 'HPL.dat' file name in 'run_rochpl' & co.
77 (("filename=HPL\\.dat")
78 (string-append "filename=" #$output
79 "/share/rochpl/HPL.dat"))
80 ;; Record command names too.
81 (("^rochpl_runscript=.*")
82 (string-append "rochpl_runscript="
83 #$output "/bin/run_rochpl\n"))
84 (("\\$\\{rocm_dir\\}/bin/rocm-smi")
85 (search-input-file inputs "/bin/rocm-smi"))
86 (("lscpu")
87 (search-input-file inputs "/bin/lscpu")))))
88 (add-after 'install 'move-files-where-they-belong
89 (lambda _
90 ;; Move files from the top level to the relevant directories.
91 (let ((datadir (string-append #$output "/share/rochpl")))
92 (for-each (lambda (program)
93 (rename-file
94 (string-append #$output "/" program)
95 (string-append #$output "/bin/"
96 program)))
97 '("mpirun_rochpl" "run_rochpl"))
98
99 (mkdir-p datadir)
100 (rename-file (string-append #$output "/HPL.dat")
101 (string-append datadir "/HPL.dat"))))))))
102 (native-inputs
103 (list rocm-toolchain rocm-cmake git-minimal/pinned))
104 (inputs
105 (list rocm-hip-runtime
106 rocblas
107 (list rocm-smi-lib "bin") ;for 'rocm-smi'
108 util-linux ;for 'lscpu'
109 libomp-rocm
110 openmpi-rocm))
111 (synopsis "Linear algebra benchmark for AMD GPUs")
112 (description
113 "rocHPL is a benchmark based on the @acronym{HPL, high-performance
114LINPACK} benchmark, a reference linear-algebra benchmark, implemented on top
115of AMD's Radeon Open Compute (ROCm) platform. rocHPL is created using the HIP
116programming language and optimized for AMD's discrete GPUs.")
117 (properties
118 `((amd-gpu-targets . ,%default-amd-gpu-targets)
119 (tunable? . #t)))
120 (license (list license:bsd-4 license:bsd-3))))
121