diff --git a/gnu/local.mk b/gnu/local.mk index 1b24c27c80..ef58b76d8b 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -604,6 +604,7 @@ GNU_SYSTEM_MODULES = \ %D%/packages/regex.scm \ %D%/packages/robotics.scm \ %D%/packages/rocm.scm \ + %D%/packages/rocm-apps.scm \ %D%/packages/rocm-libs.scm \ %D%/packages/rocm-tools.scm \ %D%/packages/rpc.scm \ @@ -2359,6 +2360,7 @@ dist_patch_DATA = \ %D%/packages/patches/rlwrap-no-rbgen.patch \ %D%/packages/patches/rng-tools-revert-build-randstat.patch \ %D%/packages/patches/rocclr-5.6.0-enable-gfx800.patch \ + %D%/packages/patches/rochpl-supported-distros.patch \ %D%/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch \ %D%/packages/patches/rocm-bandwidth-test-fix-external-packages-search.patch \ %D%/packages/patches/rocm-bandwidth-test-fix-hsa-include-file-lookup.patch \ diff --git a/gnu/packages/patches/rochpl-supported-distros.patch b/gnu/packages/patches/rochpl-supported-distros.patch new file mode 100644 index 0000000000..4b22840b67 --- /dev/null +++ b/gnu/packages/patches/rochpl-supported-distros.patch @@ -0,0 +1,27 @@ +Do not bail out when not running on a "supported distro": it will usually work +fine on Guix System. + +diff --git a/scripts/mpirun_rochpl.in b/scripts/mpirun_rochpl.in +index 968e5a2..685a69e 100755 +--- a/scripts/mpirun_rochpl.in ++++ b/scripts/mpirun_rochpl.in +@@ -50,7 +50,6 @@ supported_distro( ) + true + ;; + *) printf "This script is currently supported on Debian, Linuxmint, Ubuntu, CentOS, RHEL, Fedora and SLES\n" +- exit 2 + ;; + esac + } +diff --git a/scripts/run_rochpl.in b/scripts/run_rochpl.in +index e30c8bb..890cfe1 100755 +--- a/scripts/run_rochpl.in ++++ b/scripts/run_rochpl.in +@@ -50,7 +50,6 @@ supported_distro( ) + true + ;; + *) printf "This script is currently supported on Debian, Linuxmint, Ubuntu, CentOS, RHEL, Fedora and SLES\n" +- exit 2 + ;; + esac + } diff --git a/gnu/packages/rocm-apps.scm b/gnu/packages/rocm-apps.scm new file mode 100644 index 0000000000..f8fbfaa297 --- /dev/null +++ b/gnu/packages/rocm-apps.scm @@ -0,0 +1,109 @@ +;;; Copyright © 2023 Advanced Micro Devices, Inc. +;;; Copyright © 2025-2026 Ludovic Courtès +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu packages rocm-apps) + #:use-module (guix gexp) + #:use-module (guix build-system cmake) + #:use-module (guix git-download) + #:use-module (guix packages) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (gnu packages) + #:use-module (gnu packages llvm) + #:use-module (gnu packages mpi) + #:use-module (gnu packages rocm) + #:use-module (gnu packages rocm-libs) + #:use-module (gnu packages version-control)) + +(define-public rochpl + (package + (name "rochpl") + (version "7.0.2") + (home-page "https://github.com/ROCm/rocHPL") + (source + (origin + (method git-fetch) + (uri (git-reference + (url home-page) + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0i3aqd2jnd4ivcpqli75kr9019fcraylxxv9laixmyx9gfxv20f0")) + (patches (search-patches "rochpl-supported-distros.patch")))) + (build-system cmake-build-system) + (arguments + (list + #:configure-flags + #~(list (string-append "-DGPU_TARGETS=" + #$(current-amd-gpu-targets-string)) + + ;; "find_package(ROCM)" is deprecated since 6.4 so most likely + ;; the reference to 'ROCM_FOUND' is incorrect. + "-DROCM_FOUND=ON" + + (string-append "-DROCM_PATH=" + #$(this-package-input "rocm-hip-runtime")) + (string-append "-DHPL_MPI_DIR=" + #$(this-package-input "openmpi-rocm"))) + #:tests? #f ;no tests + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'avoid-native-optimizations + (lambda _ + (substitute* "CMakeLists.txt" + (("-march=native") + "")))) + (add-after 'unpack 'set-default-data-file-name + (lambda _ + ;; Set the default 'HPL.dat' file name in 'run_rochpl' & co. + (substitute* (find-files "scripts" "\\.in") + (("filename=HPL\\.dat") + (string-append "filename=" #$output + "/share/rochpl/HPL.dat"))))) + (add-after 'install 'move-files-where-they-belong + (lambda _ + ;; Move files from the top level to the relevant directories. + (let ((datadir (string-append #$output "/share/rochpl"))) + (for-each (lambda (program) + (rename-file + (string-append #$output "/" program) + (string-append #$output "/bin/" + program))) + '("mpirun_rochpl" "run_rochpl")) + + (mkdir-p datadir) + (rename-file (string-append #$output "/HPL.dat") + (string-append datadir "/HPL.dat")))))))) + (native-inputs + (list rocm-cmake lld-rocm llvm-rocm git-minimal/pinned)) + (inputs + (list rocm-device-libs + rocm-hip-runtime + rocr-runtime + rocblas + libomp-rocm + openmpi-rocm)) + (synopsis "Linear algebra benchmark for AMD GPUs") + (description + "rocHPL is a benchmark based on the @acronym{HPL, high-performance +LINPACK} benchmark, a reference linear-algebra benchmark, implemented on top +of AMD's Radeon Open Compute (ROCm) platform. rocHPL is created using the HIP +programming language and optimized for AMD's discrete GPUs.") + (properties + `((amd-gpu-targets . ,%default-amd-gpu-targets) + (tunable? . #t))) + (license (list license:bsd-4 license:bsd-3))))