| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 |
|
| 21 | (define-module (gnu packages rocm)
|
| 22 | #:use-module ((guix licenses) #:prefix license:)
|
| 23 | #:use-module (guix packages)
|
| 24 | #:use-module (guix download)
|
| 25 | #:use-module (guix gexp)
|
| 26 | #:use-module (guix utils)
|
| 27 | #:use-module (guix git-download)
|
| 28 | #:use-module (guix build-system cmake)
|
| 29 | #:use-module (guix amd-gpu)
|
| 30 | #:use-module (gnu packages)
|
| 31 | #:use-module (gnu packages base)
|
| 32 | #:use-module (gnu packages boost)
|
| 33 | #:use-module (gnu packages check)
|
| 34 | #:use-module (gnu packages cpp)
|
| 35 | #:use-module (gnu packages curl)
|
| 36 | #:use-module (gnu packages elf)
|
| 37 | #:use-module (gnu packages gcc)
|
| 38 | #:use-module (gnu packages gl)
|
| 39 | #:use-module (gnu packages instrumentation)
|
| 40 | #:use-module (gnu packages linux)
|
| 41 | #:use-module (gnu packages llvm)
|
| 42 | #:use-module (gnu packages logging)
|
| 43 | #:use-module (gnu packages opencl)
|
| 44 | #:use-module (gnu packages pkg-config)
|
| 45 | #:use-module (gnu packages pretty-print)
|
| 46 | #:use-module (gnu packages python)
|
| 47 | #:use-module (gnu packages python-build)
|
| 48 | #:use-module (gnu packages python-xyz)
|
| 49 | #:use-module (gnu packages version-control)
|
| 50 | #:use-module (gnu packages vim)
|
| 51 | #:use-module (gnu packages perl)
|
| 52 | #:use-module (gnu packages profiling)
|
| 53 | #:use-module (gnu packages xdisorg)
|
| 54 | #:use-module (gnu packages xml)
|
| 55 | #:use-module (gnu packages xorg)
|
| 56 | #:use-module (gnu packages libffi)
|
| 57 | #:use-module (ice-9 match)
|
| 58 | #:re-export (%default-amd-gpu-targets
|
| 59 | current-amd-gpu-targets
|
| 60 | current-amd-gpu-targets-string))
|
| 61 |
|
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 |
|
| 69 | (define %rocm-version "7.1.1")
|
| 70 |
|
| 71 | |
| 72 |
|
| 73 | (define %rocm-systems-url "https://github.com/ROCm/rocm-systems")
|
| 74 | (define %rocm-systems-origin
|
| 75 | (origin
|
| 76 | (method git-fetch)
|
| 77 | (uri (git-reference
|
| 78 | (url (string-append %rocm-systems-url))
|
| 79 | (commit (string-append "rocm-" %rocm-version))))
|
| 80 | (file-name (git-file-name "rocm-systems" %rocm-version))
|
| 81 | (sha256
|
| 82 | (base32
|
| 83 | "056dwpkddjj5gq4xys1vbca0znq4qlhqnfdsgp1y9c5y9avqfkxx"))
|
| 84 | (patches
|
| 85 | (search-patches
|
| 86 | "rocclr-5.6.0-enable-gfx800.patch"
|
| 87 | "rocm-opencl-runtime-4.3-noclinfo.patch"))))
|
| 88 |
|
| 89 | (define-public rocr-runtime
|
| 90 | (package
|
| 91 | (name "rocr-runtime")
|
| 92 | (version %rocm-version)
|
| 93 | (source %rocm-systems-origin)
|
| 94 | (build-system cmake-build-system)
|
| 95 | (arguments
|
| 96 | (list
|
| 97 | #:tests? #f |
| 98 | #:build-type "Release"
|
| 99 | #:phases
|
| 100 | #~(modify-phases %standard-phases
|
| 101 | (add-after 'unpack 'chdir
|
| 102 | (lambda _
|
| 103 | (chdir "projects/rocr-runtime")))
|
| 104 | (add-after 'unpack 'add-rocm-device-lib-path
|
| 105 | (lambda _
|
| 106 | (setenv "ROCM_PATH"
|
| 107 | #$(this-package-input "rocm-device-libs")))))))
|
| 108 | (inputs
|
| 109 | (list libdrm
|
| 110 | libelf-shared
|
| 111 | clang-rocm
|
| 112 | lld-rocm
|
| 113 | numactl
|
| 114 | rocm-device-libs
|
| 115 | rocprofiler-register))
|
| 116 | (native-inputs (list pkg-config xxd))
|
| 117 | (home-page %rocm-systems-url)
|
| 118 | (synopsis "ROCm Platform Runtime")
|
| 119 | (description "User-mode API interfaces and libraries necessary for host
|
| 120 | applications to launch compute kernels to available HSA ROCm kernel agents.")
|
| 121 | (license license:ncsa)))
|
| 122 |
|
| 123 | (define-public rocm-opencl-runtime
|
| 124 | (package
|
| 125 | (name "rocm-opencl-runtime")
|
| 126 | (version %rocm-version)
|
| 127 | (home-page %rocm-systems-url)
|
| 128 | (source %rocm-systems-origin)
|
| 129 | (build-system cmake-build-system)
|
| 130 | (arguments
|
| 131 | (list
|
| 132 | #:tests? #f |
| 133 | #:build-type "Release"
|
| 134 | #:configure-flags
|
| 135 | #~(list
|
| 136 | (string-append "-DAMD_OPENCL_PATH=" #$(package-source this-package))
|
| 137 | "-DCLR_BUILD_OCL=ON"
|
| 138 | (string-append "-DROCM_PATH=" #$output)
|
| 139 | |
| 140 | |
| 141 | "-DBUILD_ICD=OFF"
|
| 142 | |
| 143 | "-DFILE_REORG_BACKWARD_COMPATIBILITY=OFF")
|
| 144 | #:phases
|
| 145 | #~(modify-phases %standard-phases
|
| 146 | (add-after 'unpack 'chdir
|
| 147 | (lambda _
|
| 148 | (chdir "projects/clr")))
|
| 149 | (add-after 'chdir 'no-os-release
|
| 150 | (lambda _
|
| 151 | (substitute* "opencl/packaging/CMakeLists.txt"
|
| 152 | (("/etc/os-release") "/dev/null"))))
|
| 153 | (add-after 'install 'create-icd
|
| 154 | |
| 155 | |
| 156 | (lambda* (#:key outputs #:allow-other-keys)
|
| 157 | (let* ((vendors (string-append #$output "/etc/OpenCL/vendors"))
|
| 158 | (sopath (string-append #$output "/lib/libamdocl64.so")))
|
| 159 | (mkdir-p vendors)
|
| 160 | (with-output-to-file (string-append vendors "/amdocl64.icd")
|
| 161 | (lambda _ (display sopath)))))))))
|
| 162 | (inputs
|
| 163 | (list glew
|
| 164 | mesa
|
| 165 | numactl
|
| 166 | opencl-headers
|
| 167 | opencl-icd-loader
|
| 168 | libffi
|
| 169 | rocm-comgr
|
| 170 | rocr-runtime))
|
| 171 | (synopsis "ROCm OpenCL Runtime")
|
| 172 | (description "OpenCL 2.0 compatible language runtime, supporting offline
|
| 173 | and in-process/in-memory compilation.")
|
| 174 | (license license:expat)))
|
| 175 |
|
| 176 | |
| 177 | |
| 178 | |
| 179 | (define-public rocm-hip-runtime
|
| 180 | (package
|
| 181 | (name "rocm-hip-runtime")
|
| 182 | (version %rocm-version)
|
| 183 | (home-page %rocm-systems-url)
|
| 184 | (source %rocm-systems-origin)
|
| 185 | (build-system cmake-build-system)
|
| 186 | (arguments
|
| 187 | (list
|
| 188 | #:tests? #f |
| 189 | #:build-type "Release"
|
| 190 | #:configure-flags
|
| 191 | #~(list
|
| 192 | (string-append "-DAMD_OPENCL_PATH=" #$(package-source this-package))
|
| 193 | "-DCLR_BUILD_HIP=ON"
|
| 194 | "-DCLR_BUILD_OCL=OFF"
|
| 195 | (string-append "-DROCM_PATH=" #$output)
|
| 196 | "-DHIP_PLATFORM=amd"
|
| 197 | (string-append
|
| 198 | "-DHIPCC_BIN_DIR=" #$(this-package-native-input "rocm-hipcc") "/bin")
|
| 199 | (string-append
|
| 200 | "-DHIP_COMMON_DIR=" #$(package-source this-package) "/projects/hip")
|
| 201 | |
| 202 | "-DUSE_PROF_API=OFF")
|
| 203 | #:phases
|
| 204 | #~(modify-phases %standard-phases
|
| 205 | (add-after 'unpack 'chdir
|
| 206 | (lambda _
|
| 207 | (chdir "projects/clr")))
|
| 208 | (add-after 'chdir 'no-os-release
|
| 209 | (lambda _
|
| 210 | (substitute* '("hipamd/packaging/CMakeLists.txt"
|
| 211 | "hipamd/CMakeLists.txt")
|
| 212 | (("/etc/os-release") "/dev/null"))))
|
| 213 | (add-after 'chdir 'less-cmake-warnings
|
| 214 | (lambda _
|
| 215 | (substitute* "rocclr/cmake/ROCclrLC.cmake"
|
| 216 | (("2\\.9") "3.0"))))
|
| 217 | (add-after 'chdir 'fix-clang-location-for-embed-pch
|
| 218 | (lambda _
|
| 219 | (substitute* "hipamd/src/CMakeLists.txt"
|
| 220 | |
| 221 | (("\\$\\{HIP_LLVM_ROOT\\}")
|
| 222 | (string-append "${HIP_LLVM_ROOT} "
|
| 223 | #$(this-package-native-input "clang-rocm"))))
|
| 224 | (substitute* "hipamd/src/hip_embed_pch.sh"
|
| 225 | (("\\$5") "$6")
|
| 226 | (("LLVM_DIR=\"\\$4\"")
|
| 227 | "LLVM_DIR=\"$4\"; CLANG_DIR=\"$5\";")
|
| 228 | (("\\$LLVM_DIR/bin/clang")
|
| 229 | (string-append "$CLANG_DIR/bin/clang")))))
|
| 230 | |
| 231 | |
| 232 | |
| 233 | |
| 234 | (add-after 'chdir 'disable-hipcc-installation
|
| 235 | (lambda _
|
| 236 | (substitute* "hipamd/CMakeLists.txt"
|
| 237 | (("if \\(NOT \\$\\{HIPCC_BIN_DIR\\} STREQUAL \"\"\\)")
|
| 238 | "if (FALSE)"))
|
| 239 | (substitute* "hipamd/hip-config.cmake.in"
|
| 240 | (("\\$\\{hip_HIPCC_EXECUTABLE\\}")
|
| 241 | "hipcc")
|
| 242 | (("\\$\\{hip_HIPCONFIG_EXECUTABLE\\}")
|
| 243 | "hipconfig"))))
|
| 244 | |
| 245 | (add-after 'install 'adjust-cmake-helpers
|
| 246 | (lambda _
|
| 247 | (substitute* (string-append #$output "/bin/hipcc_cmake_linker_helper")
|
| 248 | (("\\$HIP_PATH/bin/hipconfig")
|
| 249 | "hipconfig")
|
| 250 | (("\\$HIP_PATH/bin/hipcc")
|
| 251 | "hipcc")))))))
|
| 252 | (inputs
|
| 253 | (list glew
|
| 254 | mesa
|
| 255 | numactl
|
| 256 | perl
|
| 257 | opencl-headers
|
| 258 | rocr-runtime
|
| 259 | rocm-device-libs
|
| 260 | rocprofiler-register
|
| 261 | libffi))
|
| 262 | (native-inputs (list rocm-hipcc clang-rocm))
|
| 263 | (propagated-inputs
|
| 264 | (list rocm-comgr rocminfo))
|
| 265 | (synopsis "ROCm HIP Runtime")
|
| 266 | (description "HIP language runtime, allowing execution of HIP kernels
|
| 267 | on AMD hardware, with library support for in-process/in-memory
|
| 268 | compilation (hipclr) of HIP kernel code, and its execution on AMD hardware.")
|
| 269 | (license license:expat)))
|
| 270 |
|
| 271 | (define-public rocminfo
|
| 272 | (package
|
| 273 | (name "rocminfo")
|
| 274 | (version %rocm-version)
|
| 275 | (source %rocm-systems-origin)
|
| 276 | (build-system cmake-build-system)
|
| 277 | (arguments
|
| 278 | (list
|
| 279 | #:tests? #f |
| 280 | #:phases
|
| 281 | #~(modify-phases %standard-phases
|
| 282 | (add-after 'unpack 'chdir
|
| 283 | (lambda _
|
| 284 | (chdir "projects/rocminfo")))
|
| 285 | (add-after 'chdir 'patch-binary-paths
|
| 286 | (lambda* (#:key inputs #:allow-other-keys)
|
| 287 | (substitute* "rocminfo.cc"
|
| 288 | (("lsmod")
|
| 289 | (search-input-file inputs "bin/lsmod"))
|
| 290 | (("grep")
|
| 291 | (search-input-file inputs "bin/grep"))))))))
|
| 292 | (inputs
|
| 293 | (list rocr-runtime kmod python))
|
| 294 | (home-page %rocm-systems-url)
|
| 295 | (synopsis "ROCm Application for Reporting System Info")
|
| 296 | (description "List @acronym{HSA,Heterogeneous System Architecture} Agents
|
| 297 | available to ROCm and show their properties.")
|
| 298 | (license license:ncsa)))
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 | |
| 303 |
|
| 304 | (define-public rocm-cmake
|
| 305 | (package
|
| 306 | (name "rocm-cmake")
|
| 307 | (version %rocm-version)
|
| 308 | (source (origin
|
| 309 | (method git-fetch)
|
| 310 | (uri (git-reference
|
| 311 | (url "https://github.com/ROCm/rocm-cmake/")
|
| 312 | (commit (string-append "rocm-" version))))
|
| 313 | (file-name (git-file-name name version))
|
| 314 | (sha256
|
| 315 | (base32
|
| 316 | "19jyymisxiikphzmq6h8vy5cg0r5dz3lxr5wvdf44frb8wxr8vla"))))
|
| 317 | (build-system cmake-build-system)
|
| 318 | (arguments `(#:tests? #f)) |
| 319 | (native-inputs (list git-minimal/pinned))
|
| 320 | (home-page "https://rocm.docs.amd.com/projects/ROCmCMakeBuildTools/")
|
| 321 | (synopsis "ROCm cmake modules")
|
| 322 | (description "ROCm cmake modules provides cmake modules for common build
|
| 323 | tasks needed for the ROCM software stack.")
|
| 324 | (license license:ncsa)))
|
| 325 |
|
| 326 | (define-public rocm-hip-cpu
|
| 327 | |
| 328 | (let ((commit "e112c935057434897bb12d9ab3910380a8bd5f58")
|
| 329 | (release "0"))
|
| 330 | (package
|
| 331 | (name "rocm-hip-cpu")
|
| 332 | (version "0.1.4142") |
| 333 | (source
|
| 334 | (origin
|
| 335 | (method git-fetch)
|
| 336 | (uri (git-reference
|
| 337 | (url "https://github.com/ROCm/HIP-CPU/")
|
| 338 | (commit commit)))
|
| 339 | (file-name (git-file-name name version))
|
| 340 | (sha256
|
| 341 | (base32
|
| 342 | "1rbih56kfry7scvww54dwx8ph11ddzc5bf4ww1vs1vmhi3r05gpa"))))
|
| 343 | (build-system cmake-build-system)
|
| 344 | (arguments
|
| 345 | (list
|
| 346 | #:configure-flags #~(list "-DBUILD_EXAMPLES=ON")))
|
| 347 | (home-page "https://github.com/ROCm/HIP-CPU/")
|
| 348 | (synopsis "Implementation of HIP that works on CPUs")
|
| 349 | (description "The HIP CPU Runtime is a header-only library that allows
|
| 350 | CPUs to execute unmodified HIP code. It is generic and does not assume a
|
| 351 | particular CPU vendor or architecture.")
|
| 352 | (license license:expat))))
|
| 353 |
|
| 354 | (define-public rocm-bandwidth-test
|
| 355 | (package
|
| 356 | (name "rocm-bandwidth-test")
|
| 357 | (version %rocm-version)
|
| 358 | (source (origin
|
| 359 | (method git-fetch)
|
| 360 | (uri (git-reference
|
| 361 | (url "https://github.com/ROCm/rocm_bandwidth_test")
|
| 362 | (commit (string-append "rocm-" version))))
|
| 363 | (file-name (git-file-name name version))
|
| 364 | (sha256
|
| 365 | (base32
|
| 366 | "03icj943x9qhilw112qbp8lc974f949qz0hc7gn1iv8q9zn2pcp8"))
|
| 367 | (patches
|
| 368 | (search-patches
|
| 369 | "rocm-bandwidth-test-take-default-gpus-from-environment.patch"
|
| 370 | "rocm-bandwidth-test-fix-hsa-include-file-lookup.patch"
|
| 371 | "rocm-bandwidth-test-fix-external-packages-search.patch"))))
|
| 372 | (build-system cmake-build-system)
|
| 373 | (arguments
|
| 374 | (list
|
| 375 | #:tests? #f
|
| 376 | #:build-type "Release"
|
| 377 | #:configure-flags
|
| 378 | #~(list
|
| 379 | "-DAMD_APP_TREAT_WARNINGS_AS_ERRORS=FALSE"
|
| 380 | "-DAMD_APP_ROCM_BUILD_PACKAGE=ON"
|
| 381 | |
| 382 | |
| 383 | |
| 384 | "-DAMD_APP_ROCM_BUILD_TRY_RPATH=OFF"
|
| 385 | |
| 386 | |
| 387 | "-DAMD_WORK_BENCH_PLUGIN_ADD_INSTALL_PREFIX_TO_RPATH=TRUE"
|
| 388 | |
| 389 | |
| 390 | |
| 391 | |
| 392 | "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE"
|
| 393 | (string-append "-DROCM_PATH=" #$output)
|
| 394 | "-DUSE_LOCAL_FMT_LIB=ON"
|
| 395 | "-DUSE_LOCAL_NLOHMANN_JSON=ON"
|
| 396 | "-DUSE_LOCAL_SPDLOG=ON"
|
| 397 | "-DUSE_LOCAL_BOOST=ON"
|
| 398 | "-DUSE_LOCAL_CLI11=ON"
|
| 399 | "-DUSE_LOCAL_CATCH2=ON")
|
| 400 | #:phases
|
| 401 | #~(modify-phases %standard-phases
|
| 402 | (add-after 'unpack 'patch-out-bogus-git-requirement
|
| 403 | (lambda _
|
| 404 | (substitute* "CMakeLists.txt"
|
| 405 | (("find_package\\(Git QUIET\\)")
|
| 406 | "set(GIT_FOUND ON)"))))
|
| 407 | |
| 408 | |
| 409 | |
| 410 | |
| 411 | |
| 412 | |
| 413 | (add-after 'unpack 'inject-amdgpu-targets
|
| 414 | (lambda _
|
| 415 | (substitute* "plugins/tb/transferbench/CMakeLists.txt"
|
| 416 | (("set\\(DEFAULT_GPUS[^)]*\\)")
|
| 417 | (string-append "set(DEFAULT_GPUS "
|
| 418 | #$(string-join (current-amd-gpu-targets))
|
| 419 | ")" )))))
|
| 420 | |
| 421 | (add-after 'unpack 'fix-use-link-path
|
| 422 | (lambda _
|
| 423 | (substitute* (find-files "." "CMakeLists\\.txt$|\\.cmake$")
|
| 424 | |
| 425 | |
| 426 | (("INSTALL_RPATH_USE_LINK_PATH FALSE")
|
| 427 | "INSTALL_RPATH_USE_LINK_PATH TRUE"))))
|
| 428 | |
| 429 | |
| 430 | |
| 431 | (add-after 'unpack 'remove-hardcoded-patchelf
|
| 432 | (lambda _
|
| 433 | (substitute* "plugins/tb/transferbench/build_libamd_tb.sh"
|
| 434 | (("command -v patchelf") "false"))))
|
| 435 | |
| 436 | |
| 437 | |
| 438 | |
| 439 | |
| 440 | |
| 441 | |
| 442 | |
| 443 | |
| 444 | (add-after 'unpack 'dont-use-lld-for-executables
|
| 445 | (lambda _
|
| 446 | (substitute* "cmake/build_utils.cmake"
|
| 447 | (("find_program\\(LD_LLD_PATH ld\\.lld\\)")
|
| 448 | "#find_program(LD_LLD_PATH ld.lld)"))))
|
| 449 | |
| 450 | |
| 451 | |
| 452 | |
| 453 | (add-after 'unpack 'remove-dubious-rpath
|
| 454 | (lambda _
|
| 455 | (substitute* (find-files "." "CMakeLists\\.txt$|\\.cmake$")
|
| 456 | ((":\\\\\\$ORIGIN(/\\.\\./lib)?/llvm/lib") "")))))))
|
| 457 | (inputs (list rocm-hip-runtime
|
| 458 | numactl
|
| 459 | curl
|
| 460 | fmt-12
|
| 461 | spdlog
|
| 462 | boost
|
| 463 | catch2))
|
| 464 | (native-inputs
|
| 465 | (list cli11
|
| 466 | nlohmann-json
|
| 467 | rocm-cmake
|
| 468 | rocm-toolchain))
|
| 469 | (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
|
| 470 | (home-page "https://github.com/ROCm/rocm_bandwidth_test")
|
| 471 | (synopsis "Bandwidth test for ROCm")
|
| 472 | (description "RocBandwidthTest is designed to capture the performance
|
| 473 | characteristics of buffer copying and kernel read/write operations. The help
|
| 474 | screen of the benchmark shows various options one can use in initiating
|
| 475 | cop/read/writer operations. In addition one can also query the topology of
|
| 476 | the system in terms of memory pools and their agents.")
|
| 477 | (license license:expat)))
|
| 478 |
|
| 479 | |
| 480 | |
| 481 | (define (make-esmi-source version hash)
|
| 482 | (origin
|
| 483 | (method git-fetch)
|
| 484 | (uri (git-reference
|
| 485 | (url "https://github.com/amd/esmi_ib_library.git")
|
| 486 | (commit version)))
|
| 487 | (file-name (git-file-name "esmi_ib_library" version))
|
| 488 | (sha256 hash)))
|
| 489 |
|
| 490 | (define %e-smi-version-for-rocm "esmi_pkg_ver-4.2")
|
| 491 | (define e-smi-for-amd-smi
|
| 492 | (make-esmi-source
|
| 493 | %e-smi-version-for-rocm
|
| 494 | (base32 "0z7yarzf1yzmbjicamcagxj0w1zlnwpg7qa51vp46fq075xpscbk")))
|
| 495 |
|
| 496 | (define-public amd-smi
|
| 497 | (package
|
| 498 | (name "amd-smi")
|
| 499 | (version "26.2.0")
|
| 500 | (source (origin
|
| 501 | (method git-fetch)
|
| 502 | (uri (git-reference
|
| 503 | (url "https://github.com/ROCm/amdsmi")
|
| 504 | (commit (string-append "rocm-" %rocm-version))))
|
| 505 | (file-name (git-file-name name version))
|
| 506 | (sha256
|
| 507 | (base32
|
| 508 | "10qjisjz4shsznh61in6zjjzsag49mdzj1ahclsyxhh5qvxvfrq4"))
|
| 509 | (patches
|
| 510 | (search-patches "amd-smi-python.patch"
|
| 511 | "amd-smi-newer-libdrm.patch"))))
|
| 512 | (build-system cmake-build-system)
|
| 513 | (arguments (list
|
| 514 | #:tests? #f |
| 515 | #:configure-flags
|
| 516 | #~(list
|
| 517 | "-DBUILD_SHARED_LIBS=ON"
|
| 518 | |
| 519 | |
| 520 | "-DENABLE_ESMI_LIB=ON"
|
| 521 | "-DBUILD_CLI=ON")
|
| 522 | #:phases
|
| 523 | #~(modify-phases %standard-phases
|
| 524 | (add-after 'unpack 'add-e-smi
|
| 525 | (lambda* _
|
| 526 | (copy-recursively
|
| 527 | #$(this-package-input
|
| 528 | (origin-file-name e-smi-for-amd-smi))
|
| 529 | "esmi_ib_library")
|
| 530 | |
| 531 | (substitute* "CMakeLists.txt"
|
| 532 | (("# Update to latest tags if not matched")
|
| 533 | (format #f "set(latest_esmi_tag ~s)"
|
| 534 | #$%e-smi-version-for-rocm)))))
|
| 535 | (add-after 'add-e-smi 'patch-dlopen
|
| 536 | (lambda* (#:key inputs #:allow-other-keys)
|
| 537 | (substitute* (find-files "src" "\\.cc$")
|
| 538 | (("libdrm.so.2")
|
| 539 | (search-input-file inputs "/lib/libdrm.so.2"))
|
| 540 | (("libdrm_amdgpu.so")
|
| 541 | (search-input-file inputs "/lib/libdrm_amdgpu.so")))))
|
| 542 | (add-after 'add-e-smi 'patch-python
|
| 543 | (lambda* _
|
| 544 | (substitute* (find-files "py-interface" "\\.py$")
|
| 545 | (("/opt/rocm") #$output)))))))
|
| 546 | (inputs (list libdrm
|
| 547 | python
|
| 548 | e-smi-for-amd-smi))
|
| 549 | (native-inputs (list pkg-config))
|
| 550 | (home-page "https://github.com/ROCm/amdsmi")
|
| 551 | (synopsis "ROCm library and application for managing AMD devices")
|
| 552 | (description "The AMD @acronym{SMI,System Management Interface} allows
|
| 553 | managing and monitoring AMD devices, particularly in high-performance
|
| 554 | computing environments. It provides a user-space interface that allows
|
| 555 | applications to control GPU operations, monitor performance, and retrieve
|
| 556 | information about the system's drivers and GPUs. It also provides a
|
| 557 | command-line tool, @command{amd-smi}, which can be used to do the same.")
|
| 558 | (license (list license:expat license:ncsa))))
|
| 559 |
|
| 560 | (define-public rocprofiler
|
| 561 | (package
|
| 562 | (name "rocprofiler")
|
| 563 | (version %rocm-version)
|
| 564 | (home-page %rocm-systems-url)
|
| 565 | (source %rocm-systems-origin)
|
| 566 | (build-system cmake-build-system)
|
| 567 | (arguments
|
| 568 | (list
|
| 569 | #:tests? #f |
| 570 | #:build-type "Release"
|
| 571 | #:configure-flags
|
| 572 | #~(list
|
| 573 | "-DROCPROFILER_BUILD_PLUGIN_PERFETTO=OFF"
|
| 574 | (string-append "-DCMAKE_CXX_COMPILER=clang++")
|
| 575 | (string-append "-DCMAKE_C_COMPILER=clang")
|
| 576 | "-DROCPROFILER_LD_AQLPROFILE=ON")
|
| 577 | #:phases
|
| 578 | #~(modify-phases %standard-phases
|
| 579 | (add-after 'unpack 'chdir
|
| 580 | (lambda _
|
| 581 | (chdir "projects/rocprofiler")))
|
| 582 | (add-after 'chdir 'disable-tests
|
| 583 | (lambda _
|
| 584 | (substitute* "CMakeLists.txt"
|
| 585 | (("set.*ROCPROFILER_BUILD_(TESTS|CI).*") ""))))
|
| 586 | (add-after 'chdir 'disable-git
|
| 587 | (lambda _
|
| 588 | (substitute* "plugin/perfetto/CMakeLists.txt"
|
| 589 | (("rocprofiler_checkout_git_submodule") "message"))))
|
| 590 | (add-after 'chdir 'fix-experimental
|
| 591 | (lambda _
|
| 592 | (substitute* (find-files "." "\\.(h|cpp)$")
|
| 593 | (("experimental(/|::)") ""))))
|
| 594 | (add-after 'chdir 'fix-script-path
|
| 595 | (lambda _
|
| 596 | (substitute* "bin/rocprofv2"
|
| 597 | (("ROCM_DIR=.*")
|
| 598 | (string-append "ROCM_DIR=" #$output "\n"))
|
| 599 | (("LD_LIBRARY_PATH=.*")
|
| 600 | (string-append
|
| 601 | "LD_LIBRARY_PATH=" #$(this-package-input "aqlprofile") "/lib"
|
| 602 | ":$LD_LIBRARY_PATH\n")))))
|
| 603 | (add-after 'install 'remove-rocprof
|
| 604 | (lambda _
|
| 605 | (delete-file (string-append #$output "/bin/rocprof")))))))
|
| 606 | (propagated-inputs (list roctracer))
|
| 607 | (inputs
|
| 608 | (list aqlprofile
|
| 609 | barectf
|
| 610 | elfutils
|
| 611 | libffi
|
| 612 | libpciaccess
|
| 613 | numactl
|
| 614 | rocm-hip-runtime))
|
| 615 | (native-inputs
|
| 616 | (list perfetto
|
| 617 | python
|
| 618 | python-cppheaderparser
|
| 619 | python-lxml
|
| 620 | python-pyyaml
|
| 621 | python-setuptools
|
| 622 | rocm-cmake
|
| 623 | rocm-toolchain))
|
| 624 | (synopsis "ROC profiler library")
|
| 625 | (description "ROC profiler library. Profiling with perf-counters
|
| 626 | and derived metrics.")
|
| 627 | (license license:expat)))
|
| 628 |
|
| 629 | (define-public rocprofiler-register
|
| 630 | (package
|
| 631 | (name "rocprofiler-register")
|
| 632 | (version %rocm-version)
|
| 633 | (source %rocm-systems-origin)
|
| 634 | (build-system cmake-build-system)
|
| 635 | (arguments
|
| 636 | (list
|
| 637 | #:configure-flags
|
| 638 | #~(list
|
| 639 | "-DROCPROFILER_REGISTER_BUILD_GLOG=OFF"
|
| 640 | "-DROCPROFILER_REGISTER_BUILD_FMT=OFF"
|
| 641 | "-DROCPROFILER_REGISTER_BUILD_TESTS=ON")
|
| 642 | #:phases
|
| 643 | '(modify-phases %standard-phases
|
| 644 | (add-after 'unpack 'chdir
|
| 645 | (lambda _
|
| 646 | (chdir "projects/rocprofiler-register")))
|
| 647 | (add-after 'chdir 'patch-cmake
|
| 648 | (lambda _
|
| 649 | (substitute* "CMakeLists.txt"
|
| 650 | (("find_package\\(Git.*") ""))
|
| 651 | (substitute* "cmake/rocprofiler_register_config_packaging.cmake"
|
| 652 | (("set\\(_DESC.*" orig)
|
| 653 | (string-append orig "\ninclude(CPack)\n")))
|
| 654 | (substitute* "source/lib/rocprofiler-register/CMakeLists.txt"
|
| 655 | (("target_link_libraries" orig)
|
| 656 | (string-append
|
| 657 | "find_package(fmt REQUIRED)\n"
|
| 658 | "find_package(glog REQUIRED)\n"
|
| 659 | orig))))))))
|
| 660 | (inputs (list glog-next))
|
| 661 | (native-inputs (list fmt-11))
|
| 662 | (home-page %rocm-systems-url)
|
| 663 | (synopsis "Support library to be used with rocprofiler")
|
| 664 | (description "The rocprofiler-register library coordinates the
|
| 665 | modification of the intercept API table(s) of the HSA/HIP/ROCTx
|
| 666 | runtime libraries by the ROCprofiler (v2) library.")
|
| 667 | (license license:expat)))
|
| 668 |
|
| 669 | (define-public rocm-core
|
| 670 | (package
|
| 671 | (name "rocm-core")
|
| 672 | (version %rocm-version)
|
| 673 | (source (origin
|
| 674 | (method git-fetch)
|
| 675 | (uri (git-reference
|
| 676 | (url "https://github.com/ROCm/rocm-core")
|
| 677 | (commit (string-append "rocm-" version))))
|
| 678 | (file-name (git-file-name name version))
|
| 679 | (sha256
|
| 680 | (base32
|
| 681 | "1a0sp50vql4nl6h19frpf1swka8j2hwmy0iaw8l1lbgvpd3hyr6x"))))
|
| 682 | (build-system cmake-build-system)
|
| 683 | (arguments
|
| 684 | (list
|
| 685 | #:tests? #f |
| 686 | #:configure-flags
|
| 687 | `(list ,(string-append "-DROCM_VERSION=" %rocm-version))))
|
| 688 | (home-page "https://github.com/Rocm/rocm-core")
|
| 689 | (synopsis "Utility to get the ROCm release version")
|
| 690 | (description "Utility to get the ROCm release version")
|
| 691 | (license license:expat)))
|
| 692 |
|
| 693 | (define-public aqlprofile
|
| 694 | (package
|
| 695 | (name "aqlprofile")
|
| 696 | (version %rocm-version)
|
| 697 | (source %rocm-systems-origin)
|
| 698 | (build-system cmake-build-system)
|
| 699 | (arguments
|
| 700 | (list
|
| 701 | #:phases
|
| 702 | '(modify-phases %standard-phases
|
| 703 | (add-after 'unpack 'chdir
|
| 704 | (lambda _
|
| 705 | (chdir "projects/aqlprofile"))))
|
| 706 | |
| 707 | |
| 708 | #:tests? #f))
|
| 709 | (inputs (list rocr-runtime))
|
| 710 | (home-page %rocm-systems-url)
|
| 711 | (synopsis "Architected Queuing Language Profiling Library")
|
| 712 | (description "AQLprofile is an open source library that enables advanced
|
| 713 | GPU profiling and tracing on AMD platforms.")
|
| 714 | (license license:expat)))
|
| 715 |
|
| 716 | (define-public roctracer
|
| 717 | (package
|
| 718 | (name "roctracer")
|
| 719 | (version %rocm-version)
|
| 720 | (source %rocm-systems-origin)
|
| 721 | (build-system cmake-build-system)
|
| 722 | (arguments
|
| 723 | (list
|
| 724 | #:tests? #f |
| 725 | #:build-type "Release"
|
| 726 | #:configure-flags
|
| 727 | #~(list
|
| 728 | (string-append "-DCMAKE_CXX_COMPILER=clang++")
|
| 729 | (string-append "-DCMAKE_C_COMPILER=clang")
|
| 730 | (string-append "-DCMAKE_MODULE_PATH="
|
| 731 | #$(this-package-input "rocm-hip-runtime")
|
| 732 | "/lib/cmake/hip"))
|
| 733 | #:modules '((srfi srfi-1)
|
| 734 | (guix build cmake-build-system)
|
| 735 | (guix build utils))
|
| 736 | #:phases
|
| 737 | #~(modify-phases %standard-phases
|
| 738 | (add-after 'unpack 'chdir
|
| 739 | (lambda _
|
| 740 | (chdir "projects/roctracer")))
|
| 741 | (add-after 'chdir 'fix-experimental
|
| 742 | (lambda _
|
| 743 | (substitute* (list
|
| 744 | "plugin/file/file.cpp"
|
| 745 | "src/hip_stats/hip_stats.cpp"
|
| 746 | "src/roctracer/loader.h"
|
| 747 | "src/tracer_tool/tracer_tool.cpp")
|
| 748 | (("experimental(/|::)") "")))))))
|
| 749 | (inputs (list rocm-hip-runtime))
|
| 750 | (native-inputs
|
| 751 | (list
|
| 752 | rocm-toolchain
|
| 753 | python
|
| 754 | python-cppheaderparser
|
| 755 | rocm-cmake))
|
| 756 | (home-page %rocm-systems-url)
|
| 757 | (synopsis "ROCm performance tracing library")
|
| 758 | (description "The ROCTracer library provides APIs for tracing (also
|
| 759 | asynchronous) runtime calls in an application. It is intended for tracing
|
| 760 | ROCm API calls in GPU applications, such as kernel dispatches and memory
|
| 761 | moves.")
|
| 762 | (license license:expat)))
|
| 763 |
|
| 764 | (define-public rccl
|
| 765 | (package
|
| 766 | (name "rccl")
|
| 767 | (version %rocm-version)
|
| 768 | |
| 769 | |
| 770 | |
| 771 | (source
|
| 772 | (origin
|
| 773 | (method git-fetch)
|
| 774 | (uri (git-reference
|
| 775 | (url "https://github.com/ROCm/rccl")
|
| 776 | (commit (string-append "rocm-" version))))
|
| 777 | (file-name (git-file-name name version))
|
| 778 | (sha256
|
| 779 | (base32
|
| 780 | "0k1k181az3hifripd99srvshq9bw9kj2p77z5nw7zmnydbfc7vny"))))
|
| 781 | (build-system cmake-build-system)
|
| 782 | (arguments
|
| 783 | (list
|
| 784 | #:tests? #f |
| 785 | #:build-type "Release"
|
| 786 | #:configure-flags
|
| 787 | #~(list
|
| 788 | (string-append "-DCMAKE_CXX_COMPILER="
|
| 789 | #$(this-package-native-input "rocm-toolchain")
|
| 790 | "/bin/hipcc")
|
| 791 | (string-append "-DEXPLICIT_ROCM_VERSION=" #$%rocm-version)
|
| 792 | #$(string-append "-DGPU_TARGETS=" (current-amd-gpu-targets-string)))
|
| 793 | #:phases
|
| 794 | #~(modify-phases %standard-phases
|
| 795 | (add-after 'unpack 'patch-rocm-version
|
| 796 | (lambda _
|
| 797 | (substitute* "CMakeLists.txt"
|
| 798 | (("cat \\$\\{ROCM_PATH\\}/\\.info/version")
|
| 799 | (string-append "echo " #$%rocm-version)))))
|
| 800 | (add-after 'unpack 'fix-cmake
|
| 801 | (lambda _
|
| 802 | (substitute* "CMakeLists.txt"
|
| 803 | (("bash.*/etc/os-release.*")
|
| 804 | "echo guix\n")))))))
|
| 805 | (inputs
|
| 806 | (list libdrm
|
| 807 | rocm-hip-runtime
|
| 808 | rocprofiler-register
|
| 809 | (@ (gnu packages rocm-tools) hipify)
|
| 810 | rocm-smi-lib))
|
| 811 | (native-inputs
|
| 812 | (list fmt
|
| 813 | perl
|
| 814 | python
|
| 815 | rocm-cmake
|
| 816 | rocm-core
|
| 817 | rocm-toolchain))
|
| 818 | (properties `((amd-gpu-targets . ,%default-amd-gpu-targets)))
|
| 819 | (home-page %rocm-systems-url)
|
| 820 | (synopsis "ROCm Communication Collectives Library")
|
| 821 | (description "@code{RCCL} (ROCm Communication Collectives Library) is a
|
| 822 | library for collective communication on GPUs, such as reduce, gather or
|
| 823 | scatter operations.")
|
| 824 | (license license:bsd-3)))
|
| 825 |
|
| 826 | (define-public rocm-smi-lib
|
| 827 | (package
|
| 828 | (name "rocm-smi-lib")
|
| 829 | (version %rocm-version)
|
| 830 | (source %rocm-systems-origin)
|
| 831 | (build-system cmake-build-system)
|
| 832 | (arguments
|
| 833 | (list
|
| 834 | #:tests? #f |
| 835 | #:build-type "Release"
|
| 836 | #:configure-flags
|
| 837 | #~(list (string-append "-DCMAKE_INSTALL_LIBEXECDIR="
|
| 838 | #$output:bin "/lib")
|
| 839 | (string-append "-DCMAKE_INSTALL_BINDIR="
|
| 840 | #$output:bin "/bin"))
|
| 841 | #:phases
|
| 842 | #~(modify-phases %standard-phases
|
| 843 | (add-after 'unpack 'setup
|
| 844 | (lambda _
|
| 845 | (chdir "projects/rocm-smi-lib")
|
| 846 | |
| 847 | |
| 848 | |
| 849 | (substitute* "rocm_smi/CMakeLists.txt"
|
| 850 | (("../(\\$\\{CMAKE_INSTALL_LIBEXECDIR\\}/\\$\\{ROCM_SMI\\}/rocm_smi.py)" _ suffix)
|
| 851 | suffix)))))))
|
| 852 | (native-inputs (list pkg-config))
|
| 853 | (inputs (list libdrm python))
|
| 854 | (propagated-inputs (list grep coreutils))
|
| 855 | |
| 856 | |
| 857 | |
| 858 | (outputs '("out" "bin"))
|
| 859 | (home-page %rocm-systems-url)
|
| 860 | (synopsis "The ROCm System Management Interface (ROCm SMI) Library")
|
| 861 | (description "The ROCm System Management Interface Library, or
|
| 862 | ROCm SMI library, is part of the Radeon Open Compute ROCm software
|
| 863 | stack. It is a C library for Linux that provides a user space
|
| 864 | interface for applications to monitor and control GPU applications.")
|
| 865 | (license license:expat)))
|
| 866 |
|
| 867 | (define-deprecated-package rocm-smi rocm-smi-lib)
|