summary refs log tree commit diff
path: root/gnu/packages/rocm.scm
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2021-08-06 08:27:32 +0200
committerLars-Dominik Braun <lars@6xq.net>2021-08-08 16:47:56 +0200
commitc0f10a5dd4be70a990223b707be1067f6982c4ae (patch)
treebc148f8a37719b502345bf2307e2f1ceffff7428 /gnu/packages/rocm.scm
parent7221722dd53e466846ba6467373f7a71b28091e9 (diff)
downloadguix-c0f10a5dd4be70a990223b707be1067f6982c4ae.tar.gz
gnu: Add rocm-opencl-runtime.
* gnu/packages/rocm.scm (rocm-opencl-runtime): New variable.
* gnu/packages/patches/rocm-opencl-runtime-3.10.0-add-rocclr-include-directories.patch,
gnu/packages/patches/rocm-opencl-runtime-4.3-noclinfo.patch,
gnu/packages/patches/rocm-opencl-runtime-4.3-nocltrace.patch,
gnu/packages/patches/rocm-opencl-runtime-4.3-noopencl.patch: New files.
* gnu/local.mk (dist_patch_DATA): Add them.
Diffstat (limited to 'gnu/packages/rocm.scm')
-rw-r--r--gnu/packages/rocm.scm51
1 files changed, 51 insertions, 0 deletions
diff --git a/gnu/packages/rocm.scm b/gnu/packages/rocm.scm
index 631d8336c0..07e395c9f0 100644
--- a/gnu/packages/rocm.scm
+++ b/gnu/packages/rocm.scm
@@ -253,3 +253,54 @@ applications to launch compute kernels to available HSA ROCm kernel agents.")
 interact with to different backends such as ROCr or PAL.  This abstraction
 allows runtimes to work on Windows as well as on Linux without much effort.")
     (license license:ncsa)))
+
+(define-public rocm-opencl-runtime
+  (package
+    (name "rocm-opencl-runtime")
+    (version %rocm-version)
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime.git")
+                    (commit (string-append "rocm-" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1cglpiaj3ny1z74ssmy6j63vj92sfy4q38ix6qsga0mg3b2wvqz3"))
+              (patches
+               (search-patches
+                "rocm-opencl-runtime-3.10.0-add-rocclr-include-directories.patch"
+                ;; Do not install libOpenCL, which ocl-icd provides.
+                "rocm-opencl-runtime-4.3-noopencl.patch"
+                ;; Guix includes a program clinfo already.
+                "rocm-opencl-runtime-4.3-noclinfo.patch"
+                ;; cltrace linking fails, remove it.
+                "rocm-opencl-runtime-4.3-nocltrace.patch"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:tests? #f ; Not sure how to run them.
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'create-icd
+           ;; Manually install ICD, which simply consists of dumping
+           ;; the path of the .so into the correct file.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (vendors (string-append out "/etc/OpenCL/vendors"))
+                    (sopath (string-append out "/lib/libamdocl64.so")))
+               (mkdir-p vendors)
+               (with-output-to-file (string-append vendors "/amdocl64.icd")
+                 (lambda _ (display sopath)))))))))
+    (inputs
+     `(("mesa" ,mesa)
+       ("rocm-comgr" ,rocm-comgr)
+       ("rocr-runtime" ,rocr-runtime)
+       ("rocclr" ,rocclr)
+       ("ocl-icd" ,ocl-icd)
+       ("glew" ,glew)))
+    (native-inputs `())
+    (home-page "https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime")
+    (synopsis "ROCm OpenCL Runtime")
+    (description "OpenCL 2.0 compatible language runtime, supporting offline
+and in-process/in-memory compilation.")
+    (license license:ncsa)))