summaryrefslogtreecommitdiff
path: root/gnu/packages/rocm-tools.scm
blob: 7de025b0b370f95d99392e8ffda6470a15218acf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2023 Advanced Micro Devices, Inc.
;;; Copyright © 2026 David Elsing <david.elsing@posteo.net>
;;;
;;; This program 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.
;;;
;;; This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages rocm-tools)
  #:use-module (guix build-system cmake)
  #:use-module (guix gexp)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (gnu packages check)
  #:use-module (gnu packages elf)
  #:use-module (gnu packages libffi)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages llvm)
  #:use-module (gnu packages pciutils)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-science)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages rocm)
  #:use-module (gnu packages xdisorg))

;; The components are tightly integrated and can only be upgraded as a unit. If
;; you want to upgrade ROCm, bump this version number and the version number in
;; - rocm.scm
;; - rocm-libs.scm
;; - gdb.scm
;; and update the hashes of the affected packages.

(define %rocm-version "7.1.1")

(define-public hipify
  (package
    (name "hipify")
    (version %rocm-version)
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
              (url "https://github.com/ROCm/hipify")
              (commit (string-append "rocm-" version))))
       (file-name (git-file-name name (string-append "rocm-" version)))
       (sha256
        (base32 "153nzm292sp9m52dkjss5bf3971p5nwi38dw49pnlc1g00f4bc9m"))))
    (build-system cmake-build-system)
    (arguments
     (list
      #:build-type "Release"
      #:tests? #f ; requires CUDA
      #:configure-flags
      #~'("-DCMAKE_CXX_COMPILER=clang++")
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'remove-generated
            (lambda _
              (delete-file "bin/hipify-perl")))
          (add-before 'configure 'prepare-cmake
            (lambda _
              (substitute* "CMakeLists.txt"
                (("set.CMAKE_CXX_COMPILER.*") "")
                (("set.CMAKE_C_COMPILER.*") ""))))
          (add-after 'build 'build-hipify-perl
            (lambda _
              (invoke "./hipify-clang" "--perl" "--o-hipify-perl-dir=../source/bin")))
          (add-after 'install 'chmod
            (lambda _
              (for-each (lambda (file)
                          (chmod file #o555))
                        (find-files (string-append #$output "/bin")))))
          (add-after 'install 'patch-shebang
            (lambda _
              (patch-shebang (string-append #$output "/bin/hipify-perl")))))))
    (inputs (list clang-rocm perl))
    (synopsis "HIPIFY: Convert CUDA to HIP code")
    (description
     "HIPIFY is a set of tools that you can use to automatically
translate CUDA source code into portable HIP C++.")
    (home-page "https://github.com/ROCm/HIPIFY")
    (license license:ncsa)))