projects/guix·blob javascript-team · refs

94 lines · 3.6 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2023 Advanced Micro Devices, Inc.
3;;; Copyright © 2026 David Elsing <[email protected]>
4;;;
5;;; This program is free software; you can redistribute it and/or modify it
6;;; under the terms of the GNU General Public License as published by
7;;; the Free Software Foundation; either version 3 of the License, or (at
8;;; your option) any later version.
9;;;
10;;; This program is distributed in the hope that it will be useful, but
11;;; WITHOUT ANY WARRANTY; without even the implied warranty of
12;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13;;; GNU General Public License for more details.
14;;;
15;;; You should have received a copy of the GNU General Public License
16;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18(define-module (gnu packages rocm-tools)
19 #:use-module (guix build-system cmake)
20 #:use-module (guix gexp)
21 #:use-module (guix git-download)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix packages)
24 #:use-module (gnu packages check)
25 #:use-module (gnu packages elf)
26 #:use-module (gnu packages libffi)
27 #:use-module (gnu packages linux)
28 #:use-module (gnu packages llvm)
29 #:use-module (gnu packages pciutils)
30 #:use-module (gnu packages perl)
31 #:use-module (gnu packages pkg-config)
32 #:use-module (gnu packages python)
33 #:use-module (gnu packages python-science)
34 #:use-module (gnu packages python-xyz)
35 #:use-module (gnu packages rocm)
36 #:use-module (gnu packages xdisorg))
37
38;; The components are tightly integrated and can only be upgraded as a unit. If
39;; you want to upgrade ROCm, bump this version number and the version number in
40;; - rocm.scm
41;; - rocm-libs.scm
42;; - gdb.scm
43;; and update the hashes of the affected packages.
44
45(define %rocm-version "7.1.1")
46
47(define-public hipify
48 (package
49 (name "hipify")
50 (version %rocm-version)
51 (source
52 (origin
53 (method git-fetch)
54 (uri (git-reference
55 (url "https://github.com/ROCm/hipify")
56 (commit (string-append "rocm-" version))))
57 (file-name (git-file-name name (string-append "rocm-" version)))
58 (sha256
59 (base32 "153nzm292sp9m52dkjss5bf3971p5nwi38dw49pnlc1g00f4bc9m"))))
60 (build-system cmake-build-system)
61 (arguments
62 (list
63 #:build-type "Release"
64 #:tests? #f ; requires CUDA
65 #:configure-flags
66 #~'("-DCMAKE_CXX_COMPILER=clang++")
67 #:phases
68 #~(modify-phases %standard-phases
69 (add-after 'unpack 'remove-generated
70 (lambda _
71 (delete-file "bin/hipify-perl")))
72 (add-before 'configure 'prepare-cmake
73 (lambda _
74 (substitute* "CMakeLists.txt"
75 (("set.CMAKE_CXX_COMPILER.*") "")
76 (("set.CMAKE_C_COMPILER.*") ""))))
77 (add-after 'build 'build-hipify-perl
78 (lambda _
79 (invoke "./hipify-clang" "--perl" "--o-hipify-perl-dir=../source/bin")))
80 (add-after 'install 'chmod
81 (lambda _
82 (for-each (lambda (file)
83 (chmod file #o555))
84 (find-files (string-append #$output "/bin")))))
85 (add-after 'install 'patch-shebang
86 (lambda _
87 (patch-shebang (string-append #$output "/bin/hipify-perl")))))))
88 (inputs (list clang-rocm perl))
89 (synopsis "HIPIFY: Convert CUDA to HIP code")
90 (description
91 "HIPIFY is a set of tools that you can use to automatically
92translate CUDA source code into portable HIP C++.")
93 (home-page "https://github.com/ROCm/HIPIFY")
94 (license license:ncsa)))