| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 |
|
| 18 | (define-module (gnu packages rocm-libs)
|
| 19 | #:use-module (guix build-system cmake)
|
| 20 | #:use-module (guix build-system pyproject)
|
| 21 | #:use-module (guix gexp)
|
| 22 | #:use-module (guix git-download)
|
| 23 | #:use-module ((guix licenses) #:prefix license:)
|
| 24 | #:use-module (guix packages)
|
| 25 | #:use-module (guix utils)
|
| 26 | #:use-module (gnu packages)
|
| 27 | #:use-module (gnu packages algebra)
|
| 28 | #:use-module (gnu packages base)
|
| 29 | #:use-module (gnu packages boost)
|
| 30 | #:use-module (gnu packages check)
|
| 31 | #:use-module (gnu packages compression)
|
| 32 | #:use-module (gnu packages cpp)
|
| 33 | #:use-module (gnu packages gcc)
|
| 34 | #:use-module (gnu packages linux)
|
| 35 | #:use-module (gnu packages llvm)
|
| 36 | #:use-module (gnu packages logging)
|
| 37 | #:use-module (gnu packages machine-learning)
|
| 38 | #:use-module (gnu packages maths)
|
| 39 | #:use-module (gnu packages pkg-config)
|
| 40 | #:use-module (gnu packages pretty-print)
|
| 41 | #:use-module (gnu packages python)
|
| 42 | #:use-module (gnu packages python-build)
|
| 43 | #:use-module (gnu packages python-science)
|
| 44 | #:use-module (gnu packages python-xyz)
|
| 45 | #:use-module (gnu packages rocm)
|
| 46 | #:use-module (gnu packages rocm-tools)
|
| 47 | #:use-module (gnu packages serialization)
|
| 48 | #:use-module (gnu packages sqlite)
|
| 49 | #:use-module (srfi srfi-1))
|
| 50 |
|
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 |
|
| 58 | (define %rocm-version "7.1.1")
|
| 59 | (define %rocm-libraries-url "https://github.com/ROCm/rocm-libraries")
|
| 60 |
|
| 61 | |
| 62 | (define %rocm-libraries-commit "f322e9ab6100cc638959e2caf636043faec9124e")
|
| 63 |
|
| 64 | (define rocm-libraries-monorepo
|
| 65 | (origin
|
| 66 | (method git-fetch)
|
| 67 | (uri (git-reference
|
| 68 | (url %rocm-libraries-url)
|
| 69 | (commit (string-append "rocm-" %rocm-version))))
|
| 70 | (file-name (git-file-name "rocm-libraries" %rocm-version))
|
| 71 | (sha256 (base32 "0jyjhkg1xlvziip29wqsvh386qy72018y114cx0x3cgfd8qy1dh0"))))
|
| 72 |
|
| 73 | (define* (rocm-library-source name
|
| 74 | #:key (patches '())
|
| 75 | (location #f))
|
| 76 | (computed-file
|
| 77 | (string-append name "-" %rocm-version)
|
| 78 | (with-imported-modules '((guix build utils))
|
| 79 | #~(begin
|
| 80 | (use-modules (guix build utils))
|
| 81 | (copy-recursively
|
| 82 | (string-append #$rocm-libraries-monorepo
|
| 83 | #$(if location
|
| 84 | (string-append "/" location)
|
| 85 | (string-append "/projects/" name)))
|
| 86 | #$output)
|
| 87 | (with-directory-excursion #$output
|
| 88 | (for-each
|
| 89 | (lambda (file)
|
| 90 | (invoke (string-append #+(delayed-object patch) "/bin/patch")
|
| 91 | "--force" "--no-backup-if-mismatch"
|
| 92 | "-p1" "-i" file))
|
| 93 | '#$(map (lambda (file)
|
| 94 | (local-file (assume-valid-file-name file)))
|
| 95 | patches)))))))
|
| 96 |
|
| 97 |
|
| 98 | (define-public rocrand
|
| 99 | (package
|
| 100 | (name "rocrand")
|
| 101 | (version %rocm-version)
|
| 102 | (source (rocm-library-source "rocrand"))
|
| 103 | (build-system cmake-build-system)
|
| 104 | (arguments
|
| 105 | (list
|
| 106 | #:tests? #f |
| 107 | #:build-type "Release"
|
| 108 | #:configure-flags
|
| 109 | #~(list
|
| 110 | "-DCMAKE_CXX_COMPILER=hipcc"
|
| 111 | (string-append "-DAMDGPU_TARGETS="
|
| 112 | #$(current-amd-gpu-targets-string)))))
|
| 113 | (inputs (list rocm-hip-runtime))
|
| 114 | (native-inputs (list rocm-cmake rocm-toolchain))
|
| 115 | (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
|
| 116 | (home-page %rocm-libraries-url)
|
| 117 | (synopsis "RAND library for the HIP programming language")
|
| 118 | (description "This package contains implementations for
|
| 119 | pseudorandom and quasirandom number generation in HIP.")
|
| 120 | (license license:expat)))
|
| 121 |
|
| 122 | (define-public hiprand
|
| 123 | (package
|
| 124 | (name "hiprand")
|
| 125 | (version %rocm-version)
|
| 126 | (source (rocm-library-source "hiprand"))
|
| 127 | (build-system cmake-build-system)
|
| 128 | (arguments
|
| 129 | (list
|
| 130 | #:tests? #f |
| 131 | #:build-type "Release"
|
| 132 | #:configure-flags
|
| 133 | #~(list
|
| 134 | "-DCMAKE_CXX_COMPILER=hipcc"
|
| 135 | (string-append "-DAMDGPU_TARGETS="
|
| 136 | #$(current-amd-gpu-targets-string)))))
|
| 137 | (inputs (list rocm-hip-runtime rocrand))
|
| 138 | (native-inputs (list rocm-cmake rocm-toolchain))
|
| 139 | (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
|
| 140 | (home-page %rocm-libraries-url)
|
| 141 | (synopsis "RAND library with multiple supported backends")
|
| 142 | (description "This package contains a wrapper library for generating
|
| 143 | random numbers on GPUs, in particular via rocRAND for AMD GPUs.")
|
| 144 | (license license:expat)))
|
| 145 |
|
| 146 | (define-public hipblas-common
|
| 147 | (package
|
| 148 | (name "hipblas-common")
|
| 149 | (version %rocm-version)
|
| 150 | (source (rocm-library-source "hipblas-common"))
|
| 151 | (build-system cmake-build-system)
|
| 152 | (arguments '(#:tests? #f)) |
| 153 | (native-inputs (list rocm-cmake))
|
| 154 | (home-page %rocm-libraries-url)
|
| 155 | (synopsis "Common files shared by hipBLAS and hipBLASLt")
|
| 156 | (description "hipBLAS-common is a header-only library with common
|
| 157 | definitions for hipBLAS and hipBLASLt.")
|
| 158 | (license license:expat)))
|
| 159 |
|
| 160 | (define-public mxdatagenerator
|
| 161 | (package
|
| 162 | (name "mxdatagenerator")
|
| 163 | (version %rocm-version)
|
| 164 | (source
|
| 165 | (rocm-library-source
|
| 166 | name
|
| 167 | #:location "shared/mxdatagenerator"))
|
| 168 | (build-system cmake-build-system)
|
| 169 | (arguments
|
| 170 | (list
|
| 171 | #:tests? #f |
| 172 | #:configure-flags #~'("-DMXDATAGENERATOR_BUILD_TESTING=ON")))
|
| 173 | (native-inputs (list googletest))
|
| 174 | (home-page "https://github.com/ROCm/hipBLASLt")
|
| 175 | (synopsis "Library for generating AMD GPU kernel assembly")
|
| 176 | (description "This package contains a library for generating and analyzing
|
| 177 | AMD GPU assembly kernels.")
|
| 178 | (license (list license:expat))))
|
| 179 |
|
| 180 | (define-public rocroller
|
| 181 | (package
|
| 182 | (name "rocroller")
|
| 183 | (version %rocm-version)
|
| 184 | (source
|
| 185 | (rocm-library-source
|
| 186 | name
|
| 187 | #:location "shared/rocroller"))
|
| 188 | (build-system cmake-build-system)
|
| 189 | (arguments
|
| 190 | (list
|
| 191 | #:tests? #f |
| 192 | #:configure-flags
|
| 193 | #~(list
|
| 194 | "-DROCROLLER_ENABLE_CATCH=OFF"
|
| 195 | "-DROCROLLER_ENABLE_GEMM_CLIENT_TESTS=OFF"
|
| 196 | "-DROCROLLER_ENABLE_SLOW_TESTS=OFF"
|
| 197 | "-DROCROLLER_ENABLE_TEST_DISCOVERY=OFF"
|
| 198 | (string-append "-DCMAKE_MODULE_PATH="
|
| 199 | #$(this-package-native-input "rocm-cmake")
|
| 200 | "/share/rocmcmakebuildtools/cmake"))
|
| 201 | #:phases
|
| 202 | #~(modify-phases %standard-phases
|
| 203 | (add-after 'unpack 'fix-cmake
|
| 204 | (lambda _
|
| 205 | (substitute* "CMakeLists.txt"
|
| 206 | (("FetchContent_MakeAvailable\\(ROCmCMakeBuildTools\\)") "")))))))
|
| 207 | (inputs
|
| 208 | (list rocm-hip-runtime
|
| 209 | msgpack-cxx
|
| 210 | fmt-11
|
| 211 | spdlog))
|
| 212 | (native-inputs
|
| 213 | (list cli11
|
| 214 | googletest
|
| 215 | lapack
|
| 216 | libdivide
|
| 217 | mxdatagenerator
|
| 218 | openblas
|
| 219 | rocm-cmake
|
| 220 | rocm-toolchain
|
| 221 | yaml-cpp))
|
| 222 | (home-page %rocm-libraries-url)
|
| 223 | (synopsis "Library for generating AMD GPU kernel assembly")
|
| 224 | (description "This package contains a library for generating and analyzing
|
| 225 | AMD GPU assembly kernels.")
|
| 226 | (license (list license:expat))))
|
| 227 |
|
| 228 | (define-public origami
|
| 229 | (package
|
| 230 | (name "origami")
|
| 231 | (version %rocm-version)
|
| 232 | (source
|
| 233 | (rocm-library-source
|
| 234 | name
|
| 235 | #:location "shared/origami"))
|
| 236 | (build-system cmake-build-system)
|
| 237 | (arguments
|
| 238 | (list
|
| 239 | #:configure-flags #~'("-DROCM_FOUND=ON")
|
| 240 | #:phases
|
| 241 | #~(modify-phases %standard-phases
|
| 242 | (add-after 'unpack 'fix-cmake
|
| 243 | (lambda _
|
| 244 | (substitute* "cmake/dependencies.cmake"
|
| 245 | (("find_package\\(Git REQUIRED\\)") ""))
|
| 246 | (substitute* "cmake/origami-config.cmake.in"
|
| 247 | (("origami::origami") "roc::origami")))))))
|
| 248 | (inputs (list rocm-hip-runtime))
|
| 249 | (native-inputs
|
| 250 | (list boost
|
| 251 | googletest
|
| 252 | rocm-cmake
|
| 253 | rocm-toolchain))
|
| 254 | (home-page %rocm-libraries-url)
|
| 255 | (synopsis "Library for selecting GEMM configurations for AMD GPU kernels")
|
| 256 | (description "@code{origami} provides a method for selecting GEMM
|
| 257 | configurations deterministically based on compute and memory latencies.")
|
| 258 | (license (list license:expat))))
|
| 259 |
|
| 260 | (define-public tensile
|
| 261 | (package
|
| 262 | (name "tensile")
|
| 263 | (version %rocm-version)
|
| 264 | (source
|
| 265 | (origin
|
| 266 | (method git-fetch)
|
| 267 | (uri (git-reference
|
| 268 | (url (string-append "https://github.com/ROCm/tensile"))
|
| 269 | (commit (string-append "rocm-" version))))
|
| 270 | (file-name (git-file-name name version))
|
| 271 | (sha256
|
| 272 | (base32
|
| 273 | "1wff80vd1x1vcg3n56qlc9hdabk9svz6qk0sznycjwzbsmpfb0mr"))
|
| 274 | (patches
|
| 275 | (search-patches "tensile-copy-if-not-exist.patch"))))
|
| 276 | (build-system pyproject-build-system)
|
| 277 | (arguments
|
| 278 | (list
|
| 279 | #:test-flags
|
| 280 | #~(list "Tensile/Tests" "-m" "unit" "-k" "not test_prepAsm")
|
| 281 | #:phases
|
| 282 | #~(modify-phases %standard-phases
|
| 283 | (add-after 'unpack 'fix-rocm-directory
|
| 284 | (lambda* (#:key inputs #:allow-other-keys)
|
| 285 | (substitute* '("Tensile/Utilities/Toolchain.py")
|
| 286 | (("/opt/rocm/bin")
|
| 287 | (dirname
|
| 288 | (search-input-file inputs "/bin/clang++")))
|
| 289 | (("/opt/rocm/llvm/bin")
|
| 290 | (dirname
|
| 291 | (search-input-file inputs "/bin/clang++"))))))
|
| 292 | (add-after 'unpack 'fix-tests
|
| 293 | (lambda _
|
| 294 | (substitute* "Tensile/Tests/yaml_only/test_config.py"
|
| 295 | (("availableArchs = findAvailableArchs\\(\\)")
|
| 296 | #$(string-append
|
| 297 | "availableArchs = ['"
|
| 298 | (string-join (current-amd-gpu-targets) "', '") "']")))
|
| 299 | (setenv "TENSILE_ROCM_ASSEMBLER_PATH"
|
| 300 | (string-append (which "clang")))))
|
| 301 | |
| 302 | |
| 303 | (add-after 'install 'adjust-tensile-binaries-permissions
|
| 304 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 305 | (let ((site-packages (site-packages inputs outputs)))
|
| 306 | (with-directory-excursion (string-append site-packages
|
| 307 | "/Tensile/bin")
|
| 308 | |
| 309 | (chmod "Tensile" #o555)
|
| 310 | (chmod "TensileCreateLibrary" #o555))))))))
|
| 311 | (native-inputs
|
| 312 | (list python-filelock
|
| 313 | python-pandas
|
| 314 | python-pytest
|
| 315 | python-setuptools
|
| 316 | rocminfo
|
| 317 | rocm-hip-runtime
|
| 318 | rocm-toolchain))
|
| 319 | (propagated-inputs
|
| 320 | (list msgpack-c
|
| 321 | python-msgpack
|
| 322 | python-pyyaml
|
| 323 | python-joblib
|
| 324 | python-rich))
|
| 325 | (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
|
| 326 | (home-page %rocm-libraries-url)
|
| 327 | (synopsis "GEMM kernel generator for AMD GPUs")
|
| 328 | (description "Tensile is a tool for creating benchmark-driven
|
| 329 | backend libraries for GEMMs, GEMM-like problems (such as batched
|
| 330 | GEMM), and general N-dimensional tensor contractions on a GPU. The
|
| 331 | Tensile library is mainly used as backend library to rocBLAS. Tensile
|
| 332 | acts as the performance backbone for a wide variety of compute
|
| 333 | applications running on AMD GPUs.")
|
| 334 | (license license:expat)))
|
| 335 |
|
| 336 | (define-public rocm-validationsuite
|
| 337 | (package
|
| 338 | (name "rocm-validationsuite")
|
| 339 | (version %rocm-version)
|
| 340 | (source
|
| 341 | (origin
|
| 342 | (method git-fetch)
|
| 343 | (uri (git-reference
|
| 344 | (url "https://github.com/ROCm/rocmvalidationsuite/")
|
| 345 | (commit (string-append "rocm-" version))))
|
| 346 | (file-name (git-file-name name version))
|
| 347 | (sha256
|
| 348 | (base32
|
| 349 | "1l577sd88f4f46am6w81n7rbswx39zy602xbqrk3zqb156k14s2s"))))
|
| 350 | (build-system cmake-build-system)
|
| 351 | (inputs (list rocblas))
|
| 352 | (home-page "https://rocm.docs.amd.com/projects/ROCmValidationSuite/")
|
| 353 | (synopsis "ROCm system validation and diagnostics")
|
| 354 | (description "ROCm monitor for stress testing, detection and
|
| 355 | troubleshooting issues impacting AMD GPUS in HPC environments.")
|
| 356 | (license license:expat)))
|
| 357 |
|
| 358 | (define hipblaslt-supported-targets
|
| 359 | (list "gfx1100"
|
| 360 | "gfx1101"
|
| 361 | "gfx1102"
|
| 362 | "gfx1103"
|
| 363 | "gfx1150"
|
| 364 | "gfx1151"
|
| 365 | "gfx1200"
|
| 366 | "gfx1201"
|
| 367 | "gfx908"
|
| 368 | "gfx90a"
|
| 369 | "gfx940"
|
| 370 | "gfx941"
|
| 371 | "gfx942"
|
| 372 | "gfx950"))
|
| 373 |
|
| 374 | (define (hipblaslt-targets targets)
|
| 375 | (string-join
|
| 376 | (lset-intersection string=? hipblaslt-supported-targets targets)
|
| 377 | ";"))
|
| 378 |
|
| 379 | (define-public hipblaslt
|
| 380 | (package
|
| 381 | (name "hipblaslt")
|
| 382 | (version %rocm-version)
|
| 383 | (source
|
| 384 | (rocm-library-source
|
| 385 | "hipblaslt"
|
| 386 | #:patches (search-patches "hipblaslt-python-nanobind.patch")))
|
| 387 | (build-system cmake-build-system)
|
| 388 | (arguments
|
| 389 | (list
|
| 390 | #:tests? #f |
| 391 | #:build-type "Release"
|
| 392 | #:validate-runpath? #f |
| 393 | #:configure-flags
|
| 394 | #~(let ((targets
|
| 395 | #$(hipblaslt-targets (current-amd-gpu-targets))))
|
| 396 | (cons*
|
| 397 | (string-append "-DCMAKE_CXX_COMPILER=clang++")
|
| 398 | (string-append "-DCMAKE_C_COMPILER=clang")
|
| 399 | (string-append "-DGPU_TARGETS=" targets)
|
| 400 | |
| 401 | "-DHIPBLASLT_ENABLE_THEROCK=ON"
|
| 402 | "-DHIPBLASLT_ENABLE_BLIS=OFF"
|
| 403 | (string-append "-DCMAKE_PREFIX_PATH="
|
| 404 | #$(this-package-native-input "python-nanobind")
|
| 405 | "/lib/python"
|
| 406 | #$(version-major+minor
|
| 407 | (package-version python))
|
| 408 | "/site-packages/nanobind/cmake")
|
| 409 | "-DHIPBLASLT_BUILD_TESTING=OFF"
|
| 410 | "-DHIPBLASLT_ENABLE_ROCROLLER=OFF"
|
| 411 | (string-append "-DTENSILELITE_BUILD_PARALLEL_LEVEL="
|
| 412 | (number->string (parallel-job-count)))
|
| 413 | (if (string-null? targets) '("-DHIPBLASLT_ENABLE_DEVICE=OFF")
|
| 414 | '())))
|
| 415 | #:phases
|
| 416 | #~(modify-phases %standard-phases
|
| 417 | (add-after 'unpack 'fix-cmake
|
| 418 | (lambda* (#:key parallel-build? #:allow-other-keys)
|
| 419 | (substitute* "tensilelite/Makefile"
|
| 420 | (("AS :=.*")
|
| 421 | "AS := amdclang++\n")
|
| 422 | (("LDD :=.*")
|
| 423 | "LDD := amdclang++\n"))
|
| 424 | (substitute* "cmake/dependencies.cmake"
|
| 425 | (("find_package\\(Git REQUIRED\\)") ""))
|
| 426 | (substitute* "CMakeLists.txt"
|
| 427 | (("add_subdirectory.*origami.*")
|
| 428 | "find_package(origami REQUIRED)\n")
|
| 429 | |
| 430 | (("NOT GPU_TARGETS OR") ""))))
|
| 431 | (add-after 'fix-cmake 'setenv
|
| 432 | (lambda _
|
| 433 | (setenv "HIP_PATH" #$(this-package-input "rocm-hip-runtime")))))))
|
| 434 | (inputs
|
| 435 | (list blis
|
| 436 | hipblas-common
|
| 437 | lapack
|
| 438 | msgpack-cxx
|
| 439 | rocm-hip-runtime
|
| 440 | rocm-smi-lib
|
| 441 | `(,rocm-smi-lib "bin")
|
| 442 | rocm-toolchain
|
| 443 | roctracer))
|
| 444 | (native-inputs
|
| 445 | (list gfortran
|
| 446 | mxdatagenerator
|
| 447 | origami
|
| 448 | procps
|
| 449 | python
|
| 450 | python-distro
|
| 451 | python-joblib
|
| 452 | python-msgpack
|
| 453 | python-nanobind
|
| 454 | python-orjson
|
| 455 | python-packaging
|
| 456 | python-pyyaml
|
| 457 | python-setuptools
|
| 458 | python-simplejson
|
| 459 | python-ujson
|
| 460 | rocm-cmake
|
| 461 | rocm-toolchain
|
| 462 | rocroller))
|
| 463 | (properties
|
| 464 | |
| 465 | |
| 466 | |
| 467 | |
| 468 | `((amd-gpu-targets . ("gfx90a")) |
| 469 | (max-silent-time . ,(* 6 3600))))
|
| 470 | (home-page %rocm-libraries-url)
|
| 471 | (synopsis "Flexible library for general matrix-matrix operations")
|
| 472 | (description "hipBLASLt is a library that provides general
|
| 473 | matrix-matrix operations with a flexible API and extends
|
| 474 | functionalities beyond a traditional BLAS library.")
|
| 475 | (license (list license:expat))))
|
| 476 |
|
| 477 | (define-public rocblas
|
| 478 | (package
|
| 479 | (name "rocblas")
|
| 480 | (version %rocm-version)
|
| 481 | (source
|
| 482 | (rocm-library-source
|
| 483 | "rocblas"))
|
| 484 | (build-system cmake-build-system)
|
| 485 | (arguments
|
| 486 | (list
|
| 487 | #:tests? #f |
| 488 | #:build-type "Release"
|
| 489 | #:validate-runpath? #f
|
| 490 | #:configure-flags
|
| 491 | #~(list
|
| 492 | "-DCMAKE_CXX_COMPILER=hipcc"
|
| 493 | #$(string-append "-DAMDGPU_TARGETS=" (current-amd-gpu-targets-string))
|
| 494 | "-DBUILD_WITH_PIP=OFF")
|
| 495 | #:phases
|
| 496 | #~(modify-phases %standard-phases
|
| 497 | (add-after 'unpack 'fix-cmake
|
| 498 | (lambda _
|
| 499 | (substitute* "library/CMakeLists.txt"
|
| 500 | (("find_package\\(Git REQUIRED\\)") "")))))))
|
| 501 | (inputs
|
| 502 | (list rocm-hip-runtime
|
| 503 | hipblas-common
|
| 504 | hipblaslt
|
| 505 | msgpack-cxx
|
| 506 | python
|
| 507 | roctracer
|
| 508 | tensile))
|
| 509 | (native-inputs (list rocm-cmake rocm-toolchain))
|
| 510 | (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
|
| 511 | (home-page %rocm-libraries-url)
|
| 512 | (synopsis "BLAS implementation for ROCm")
|
| 513 | (description "rocBLAS is the ROCm Basic Linear Algebra Subprograms
|
| 514 | (BLAS) library. It is implemented in the HIP programming language.")
|
| 515 | (license (list license:expat license:bsd-3))))
|
| 516 |
|
| 517 | (define-public rocprim
|
| 518 | (package
|
| 519 | (name "rocprim")
|
| 520 | (version %rocm-version)
|
| 521 | (source
|
| 522 | (rocm-library-source
|
| 523 | "rocprim"
|
| 524 | |
| 525 | |
| 526 | #:patches (search-patches "rocprim-placement-new-delete.patch")))
|
| 527 | (build-system cmake-build-system)
|
| 528 | (arguments
|
| 529 | (list
|
| 530 | #:build-type "Release"
|
| 531 | #:tests? #f |
| 532 | #:configure-flags
|
| 533 | #~(list "-DCMAKE_CXX_COMPILER=hipcc"
|
| 534 | #$(string-append "-DAMDGPU_TARGETS="
|
| 535 | (current-amd-gpu-targets-string)))))
|
| 536 | (inputs (list rocm-hip-runtime))
|
| 537 | (native-inputs (list rocm-cmake rocm-toolchain))
|
| 538 | (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
|
| 539 | (home-page %rocm-libraries-url)
|
| 540 | (synopsis
|
| 541 | "Header-only library providing HIP parallel primitives")
|
| 542 | (description
|
| 543 | "The rocPRIM is a header-only library providing HIP parallel primitives
|
| 544 | for developing performant GPU-accelerated code on the AMD ROCm platform.")
|
| 545 | (license license:expat)))
|
| 546 |
|
| 547 | (define-public rocsparse
|
| 548 | (package
|
| 549 | (name "rocsparse")
|
| 550 | (version %rocm-version)
|
| 551 | (source
|
| 552 | (rocm-library-source
|
| 553 | "rocsparse"))
|
| 554 | (build-system cmake-build-system)
|
| 555 | (arguments
|
| 556 | (list
|
| 557 | #:tests? #f |
| 558 | #:build-type "Release"
|
| 559 | #:configure-flags
|
| 560 | #~(list
|
| 561 | "-DCMAKE_CXX_COMPILER=hipcc"
|
| 562 | #$(string-append "-DAMDGPU_TARGETS="
|
| 563 | (current-amd-gpu-targets-string)))))
|
| 564 | (inputs (list rocm-hip-runtime rocprim))
|
| 565 | (native-inputs (list rocm-cmake rocm-toolchain))
|
| 566 | (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
|
| 567 | (home-page %rocm-libraries-url)
|
| 568 | (synopsis "Sparse linear algebra library for ROCm")
|
| 569 | (description "This package exposes a sparse BLAS interface for ROCm. It
|
| 570 | is implemented in the HIP programming language.")
|
| 571 | (license (list license:expat license:bsd-3))))
|
| 572 |
|
| 573 | (define-public hipsparse
|
| 574 | (package
|
| 575 | (name "hipsparse")
|
| 576 | (version %rocm-version)
|
| 577 | (source (rocm-library-source "hipsparse"))
|
| 578 | (build-system cmake-build-system)
|
| 579 | (arguments
|
| 580 | (list
|
| 581 | #:tests? #f |
| 582 | #:build-type "Release"
|
| 583 | #:configure-flags
|
| 584 | #~(list
|
| 585 | "-DCMAKE_CXX_COMPILER=hipcc"
|
| 586 | #$(string-append "-DGPU_TARGETS=" (current-amd-gpu-targets-string)))
|
| 587 | #:phases
|
| 588 | #~(modify-phases %standard-phases
|
| 589 | (add-after 'unpack 'set-example-fpie
|
| 590 | (lambda _
|
| 591 | (substitute* "clients/samples/CMakeLists.txt"
|
| 592 | (("add_executable.*EXAMPLE_TARGET.*" all)
|
| 593 | (string-append
|
| 594 | all "target_compile_options(${EXAMPLE_TARGET}"
|
| 595 | " PRIVATE -fpie)\n"))))))))
|
| 596 | (inputs
|
| 597 | (list googletest
|
| 598 | gfortran
|
| 599 | rocm-hip-runtime
|
| 600 | rocsparse))
|
| 601 | (native-inputs (list rocm-cmake rocm-toolchain))
|
| 602 | (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
|
| 603 | (home-page %rocm-libraries-url)
|
| 604 | (synopsis "Sparse linear algebra library with multiple supported
|
| 605 | backends")
|
| 606 | (description "This package contains a wrapper library for sparse linear
|
| 607 | algebra on GPUs, in particular via rocSPARSE for AMD GPUs.")
|
| 608 | (license license:expat)))
|
| 609 |
|
| 610 | (define-public rocsolver
|
| 611 | (package
|
| 612 | (name "rocsolver")
|
| 613 | (version %rocm-version)
|
| 614 | (source (rocm-library-source "rocsolver"))
|
| 615 | (build-system cmake-build-system)
|
| 616 | (arguments
|
| 617 | (list
|
| 618 | #:tests? #f |
| 619 | #:build-type "Release"
|
| 620 | #:configure-flags
|
| 621 | #~(list
|
| 622 | "-DCMAKE_CXX_COMPILER=hipcc"
|
| 623 | #$(string-append "-DAMDGPU_TARGETS=" (current-amd-gpu-targets-string)))
|
| 624 | #:phases
|
| 625 | #~(modify-phases %standard-phases
|
| 626 | |
| 627 | (add-after 'unpack 'fix-std-templates
|
| 628 | (lambda _
|
| 629 | (substitute* "library/src/auxiliary/rocauxiliary_bdsqr_hybrid.hpp"
|
| 630 | ((" pow\\(") " std::pow("))
|
| 631 | (substitute* "library/src/include/lapack_host_functions.hpp"
|
| 632 | (("\\(isnan") "(std::isnan"))
|
| 633 | (substitute* "library/src/lapack/roclapack_syevj_heevj.hpp"
|
| 634 | (("std::norm\\((.*)\\)" _ orig)
|
| 635 | (string-append "std::norm(rocblas_complex_num(" orig "))"))))))))
|
| 636 | (inputs
|
| 637 | (list rocblas
|
| 638 | rocm-hip-runtime
|
| 639 | rocprim
|
| 640 | rocsparse))
|
| 641 | (native-inputs (list fmt rocm-cmake rocm-toolchain))
|
| 642 | (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
|
| 643 | (home-page %rocm-libraries-url)
|
| 644 | (synopsis "LAPACK implementation for ROCm")
|
| 645 | (description "rocSOLVER is a partial implementation of the LAPACK
|
| 646 | functionality for ROCm. It is written in the HIP programming language.")
|
| 647 | (license license:bsd-2)))
|
| 648 |
|
| 649 | (define-public hipsolver
|
| 650 | (package
|
| 651 | (name "hipsolver")
|
| 652 | (version %rocm-version)
|
| 653 | (source (rocm-library-source "hipsolver"))
|
| 654 | (build-system cmake-build-system)
|
| 655 | (arguments
|
| 656 | (list
|
| 657 | #:tests? #f |
| 658 | #:build-type "Release"
|
| 659 | #:configure-flags
|
| 660 | #~(list
|
| 661 | "-DCMAKE_CXX_COMPILER=hipcc"
|
| 662 | #$(string-append "-DAMDGPU_TARGETS=" (current-amd-gpu-targets-string)))
|
| 663 | #:phases
|
| 664 | #~(modify-phases %standard-phases
|
| 665 | (add-after 'unpack 'suitesparse-include
|
| 666 | (lambda _
|
| 667 | (substitute* "library/src/amd_detail/hipsolver_sparse.cpp"
|
| 668 | (("<suitesparse/cholmod\\.h>")
|
| 669 | "<cholmod.h>")))))))
|
| 670 | (inputs (list
|
| 671 | rocblas
|
| 672 | rocm-hip-runtime
|
| 673 | rocsolver
|
| 674 | rocsparse
|
| 675 | suitesparse-config
|
| 676 | suitesparse-cholmod))
|
| 677 | (native-inputs (list gfortran pkg-config rocm-cmake rocm-toolchain))
|
| 678 | (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
|
| 679 | (home-page %rocm-libraries-url)
|
| 680 | (synopsis "LAPACK library with multiple supported backends")
|
| 681 | (description "This package contains a wrapper library for LAPACK on GPUs,
|
| 682 | in particular via rocSOLVER for AMD GPUs.")
|
| 683 | (license license:expat)))
|
| 684 |
|
| 685 | (define-public hipblas
|
| 686 | (package
|
| 687 | (name "hipblas")
|
| 688 | (version %rocm-version)
|
| 689 | (source (rocm-library-source "hipblas"))
|
| 690 | (build-system cmake-build-system)
|
| 691 | (arguments
|
| 692 | (list
|
| 693 | #:tests? #f |
| 694 | #:build-type "Release"
|
| 695 | #:configure-flags
|
| 696 | #~(list
|
| 697 | "-DCMAKE_CXX_COMPILER=hipcc"
|
| 698 | #$(string-append "-DAMDGPU_TARGETS=" (current-amd-gpu-targets-string)))
|
| 699 | #:phases
|
| 700 | #~(modify-phases %standard-phases
|
| 701 | (add-after 'unpack 'patch-cmake
|
| 702 | (lambda _
|
| 703 | (substitute* "library/CMakeLists.txt"
|
| 704 | (("find_package\\(Git.*") "")
|
| 705 | (("execute_process\\(COMMAND.*GIT_EXECUTABLE.*")
|
| 706 | "set(dummy\n")
|
| 707 | (("(set\\(hipblas_VERSION_COMMIT_ID ).*" _ orig)
|
| 708 | (string-append orig #$%rocm-libraries-commit ")\n"))))))))
|
| 709 | (inputs
|
| 710 | (list hipblas-common
|
| 711 | rocblas
|
| 712 | rocm-hip-runtime
|
| 713 | rocrand
|
| 714 | rocsolver
|
| 715 | rocsparse))
|
| 716 | (native-inputs (list gfortran rocm-cmake rocm-toolchain))
|
| 717 | (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
|
| 718 | (home-page %rocm-libraries-url)
|
| 719 | (synopsis "BLAS library with multiple supported backends")
|
| 720 | (description "This package contains a wrapper library for linear algebra
|
| 721 | algorithms on GPUs, in particular via rocRAND, rocBLAS, rocSPARSE and
|
| 722 | rocSOLVER for AMD GPUs.")
|
| 723 | (license license:expat)))
|
| 724 |
|
| 725 | (define-public hipcub
|
| 726 | (package
|
| 727 | (name "hipcub")
|
| 728 | (version %rocm-version)
|
| 729 | (source (rocm-library-source "hipcub"))
|
| 730 | (build-system cmake-build-system)
|
| 731 | (arguments
|
| 732 | (list
|
| 733 | #:tests? #f
|
| 734 | #:build-type "Release"
|
| 735 | #:configure-flags
|
| 736 | #~(list
|
| 737 | "-DCMAKE_CXX_COMPILER=hipcc"
|
| 738 | #$(string-append "-DAMDGPU_TARGETS="
|
| 739 | (current-amd-gpu-targets-string)))))
|
| 740 | (inputs (list rocm-hip-runtime rocprim))
|
| 741 | (native-inputs (list rocm-cmake rocm-toolchain))
|
| 742 | (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
|
| 743 | (home-page %rocm-libraries-url)
|
| 744 | (synopsis "Parallel primitives library with multiple supported backends")
|
| 745 | (description "This package contains a wrapper library with HIP parallel
|
| 746 | primitives, in particular via rocPRIM for AMD GPUs.")
|
| 747 | (license license:bsd-3)))
|
| 748 |
|
| 749 | (define-public rocthrust
|
| 750 | (package
|
| 751 | (name "rocthrust")
|
| 752 | (version %rocm-version)
|
| 753 | (source (rocm-library-source "rocthrust"))
|
| 754 | (build-system cmake-build-system)
|
| 755 | (arguments
|
| 756 | (list
|
| 757 | #:tests? #f
|
| 758 | #:build-type "Release"
|
| 759 | #:configure-flags
|
| 760 | #~(list
|
| 761 | "-DCMAKE_CXX_COMPILER=hipcc"
|
| 762 | #$(string-append "-DAMDGPU_TARGETS="
|
| 763 | (current-amd-gpu-targets-string)))))
|
| 764 | (inputs (list rocm-hip-runtime rocprim))
|
| 765 | (native-inputs (list rocm-cmake rocm-toolchain))
|
| 766 | (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
|
| 767 | (home-page %rocm-libraries-url)
|
| 768 | (synopsis "Thrust port for HIP and ROCm")
|
| 769 | (description "@code{rocThrust} is a parallel algorithm library for ROCm,
|
| 770 | based on @code{rocPRIM}. It is a port of the CUDA Thrust library.")
|
| 771 | (license license:asl2.0)))
|
| 772 |
|
| 773 | (define-public composable-kernel
|
| 774 | (package
|
| 775 | (name "composable-kernel")
|
| 776 | (version %rocm-version)
|
| 777 | (source
|
| 778 | (rocm-library-source
|
| 779 | "composablekernel"
|
| 780 | #:patches (search-patches "composable-kernel-conditional-kernels.patch")))
|
| 781 | (build-system cmake-build-system)
|
| 782 | (arguments
|
| 783 | (list
|
| 784 | #:tests? #f
|
| 785 | #:build-type "Release"
|
| 786 | #:configure-flags
|
| 787 | #~(list
|
| 788 | "-DCMAKE_CXX_COMPILER=hipcc"
|
| 789 | "-DBUILD_TESTING=OFF"
|
| 790 | #$(string-append "-DGPU_TARGETS=" (current-amd-gpu-targets-string)))
|
| 791 | #:phases
|
| 792 | #~(modify-phases %standard-phases
|
| 793 | (add-after 'unpack 'patch-cmake
|
| 794 | (lambda _
|
| 795 | (substitute* "CMakeLists.txt"
|
| 796 | (("find_package\\(Git.*") "")
|
| 797 | (("execute_process\\(COMMAND.*GIT_EXECUTABLE.*")
|
| 798 | (string-append
|
| 799 | "set(COMMIT_ID " #$%rocm-libraries-commit ")\n"))
|
| 800 | |
| 801 | |
| 802 | ((".*(-amdgpu-early-inline-all|-amdgpu-function-calls).*") ""))))
|
| 803 | (add-after 'unpack 'setenv
|
| 804 | (lambda _
|
| 805 | (setenv "HIP_PATH" #$(this-package-input "rocm-hip-runtime")))))))
|
| 806 | (inputs (list rocm-hip-runtime))
|
| 807 | (native-inputs (list python rocm-cmake rocm-toolchain))
|
| 808 | (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
|
| 809 | (home-page %rocm-libraries-url)
|
| 810 | (synopsis "Library for writing performance-portable kernels")
|
| 811 | (description "Composable Kernel is a library which provides a tile-based
|
| 812 | programming model for writing performance-portable kernels, in particular for
|
| 813 | GPUs using the HIP programming language.")
|
| 814 | (license license:expat)))
|
| 815 |
|
| 816 | (define-public half-rocm
|
| 817 | (package
|
| 818 | (name "half-rocm")
|
| 819 | (version %rocm-version)
|
| 820 | (source
|
| 821 | (origin
|
| 822 | (method git-fetch)
|
| 823 | (uri (git-reference
|
| 824 | (url "https://github.com/ROCm/half")
|
| 825 | (commit (string-append "rocm-" version))))
|
| 826 | (file-name (git-file-name name version))
|
| 827 | (sha256
|
| 828 | (base32
|
| 829 | "0vlsmrs3aiv30j1ifks9g9cl8b1xdjv7dd706w5npjhy27j4xzr1"))))
|
| 830 | (build-system cmake-build-system)
|
| 831 | (arguments '(#:tests? #f))
|
| 832 | (native-inputs (list rocm-cmake))
|
| 833 | (home-page "https://github.com/ROCm/half")
|
| 834 | (synopsis "Half-precision floating-point library")
|
| 835 | (description "This package provides a header-only C++ library for a
|
| 836 | half-precision floating point type (IEEE 754 conformant) together with common
|
| 837 | operations on this type.")
|
| 838 | (license license:expat)))
|
| 839 |
|
| 840 | (define-public miopen
|
| 841 | (package
|
| 842 | (name "miopen")
|
| 843 | (version %rocm-version)
|
| 844 | (source
|
| 845 | (rocm-library-source
|
| 846 | "miopen"
|
| 847 | #:patches
|
| 848 | (search-patches
|
| 849 | "miopen-zstd.patch")))
|
| 850 | (build-system cmake-build-system)
|
| 851 | (arguments
|
| 852 | (list
|
| 853 | #:tests? #f |
| 854 | #:build-type "Release"
|
| 855 | #:configure-flags
|
| 856 | #~(list
|
| 857 | "-DCMAKE_CXX_COMPILER=hipcc"
|
| 858 | "-DBoost_USE_STATIC_LIBS=OFF"
|
| 859 | #$(string-append "-DAMDGPU_TARGETS=" (current-amd-gpu-targets-string)))
|
| 860 | #:phases
|
| 861 | #~(modify-phases %standard-phases
|
| 862 | (add-after 'unpack 'disable-tidy+tests
|
| 863 | (lambda _
|
| 864 | (substitute* "CMakeLists.txt"
|
| 865 | (("add_subdirectory.*test.*") "")
|
| 866 | (("set\\(MIOPEN_TIDY_ERRORS ALL\\)") ""))))
|
| 867 | (add-after 'unpack 'adjust-ck-checks
|
| 868 | (lambda _
|
| 869 | (substitute* (find-files "src" ".*mha.*\\.cpp$")
|
| 870 | (("MIOPEN_USE_COMPOSABLEKERNEL") "MIOPEN_USE_CK_MHA_OPS"))
|
| 871 | (substitute*
|
| 872 | (cons*
|
| 873 | "src/mlo_dir_conv.cpp"
|
| 874 | "src/solver/conv_ck_igemm_fwd_bias_res_add_activ_fused.cpp"
|
| 875 | "src/solver/conv_ck_igemm_fwd_bias_activ_fused.cpp"
|
| 876 | (find-files "src" ".*xdl.*\\.cpp$"))
|
| 877 | (("MIOPEN_USE_COMPOSABLEKERNEL") "MIOPEN_USE_CK_XDL_OPS")))))))
|
| 878 | (inputs
|
| 879 | (list
|
| 880 | boost
|
| 881 | composable-kernel
|
| 882 | hipblas
|
| 883 | hipblas-common
|
| 884 | hipblaslt
|
| 885 | rocblas
|
| 886 | rocm-hip-runtime
|
| 887 | rocmlir
|
| 888 | rocrand
|
| 889 | roctracer
|
| 890 | sqlite
|
| 891 | `(,zstd "lib")))
|
| 892 | (native-inputs
|
| 893 | (list
|
| 894 | eigen
|
| 895 | frugally-deep
|
| 896 | functionalplus
|
| 897 | googletest
|
| 898 | half-rocm
|
| 899 | nlohmann-json
|
| 900 | pkg-config
|
| 901 | rocm-cmake
|
| 902 | rocm-toolchain))
|
| 903 | (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
|
| 904 | (home-page %rocm-libraries-url)
|
| 905 | (synopsis "GPU library for machine learning primitives")
|
| 906 | (description "@code{MIOpen} is a library which exposes a C API to GPU
|
| 907 | machine learning primitives. This package contains the HIP version based on
|
| 908 | ROCm.")
|
| 909 | (license license:expat)))
|
| 910 |
|
| 911 | (define-public rocfft
|
| 912 | (package
|
| 913 | (name "rocfft")
|
| 914 | (version %rocm-version)
|
| 915 | (source (rocm-library-source "rocfft"))
|
| 916 | (build-system cmake-build-system)
|
| 917 | (arguments
|
| 918 | (list
|
| 919 | #:tests? #f |
| 920 | #:build-type "Release"
|
| 921 | #:configure-flags
|
| 922 | #~(list "-DCMAKE_CXX_COMPILER=hipcc"
|
| 923 | "-DCMAKE_C_COMPILER=hipcc"
|
| 924 | #$(string-append "-DAMDGPU_TARGETS="
|
| 925 | (current-amd-gpu-targets-string))
|
| 926 | "-DSQLITE_USE_SYSTEM_PACKAGE=ON")))
|
| 927 | (inputs (list rocm-hip-runtime sqlite-next)) |
| 928 | (native-inputs (list python rocm-cmake rocm-toolchain))
|
| 929 | (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
|
| 930 | (home-page %rocm-libraries-url)
|
| 931 | (synopsis "FFT library for the HIP programming language")
|
| 932 | (description "This package contains a HIP library for computing fast
|
| 933 | Fourier transforms.")
|
| 934 | (license license:expat)))
|
| 935 |
|
| 936 | (define-public hipfft
|
| 937 | (package
|
| 938 | (name "hipfft")
|
| 939 | (version %rocm-version)
|
| 940 | (source (rocm-library-source "hipfft"))
|
| 941 | (build-system cmake-build-system)
|
| 942 | (arguments
|
| 943 | (list
|
| 944 | #:tests? #f |
| 945 | #:build-type "Release"
|
| 946 | #:configure-flags
|
| 947 | #~(list
|
| 948 | "-DCMAKE_CXX_COMPILER=hipcc"
|
| 949 | #$(string-append "-DAMDGPU_TARGETS="
|
| 950 | (current-amd-gpu-targets-string)))))
|
| 951 | (inputs (list rocm-hip-runtime rocfft))
|
| 952 | (native-inputs (list rocm-cmake rocm-toolchain))
|
| 953 | (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
|
| 954 | (home-page %rocm-libraries-url)
|
| 955 | (synopsis "FFT library with multiple supported backends")
|
| 956 | (description "This package contains a wrapper library for computing fast
|
| 957 | Fourier transforms on GPUs, in particular via rocFFT for AMD GPUs.")
|
| 958 | (license license:expat)))
|