tests: Adjust for removal of 'device' field in <bootloader-configuration>.
[jackhill/guix/guix.git] / gnu / packages / opencl.scm
index 644cd95..a90b17c 100644 (file)
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
+;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages libedit)
   #:use-module (gnu packages llvm)
+  #:use-module (gnu packages mpi)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
@@ -38,8 +41,8 @@
   #:use-module (gnu packages xorg))
 
 ;; This file adds OpenCL implementation related packages. Due to the fact that
-;; OpenCL devices are not available during build (store environment), tests are
-;; all disabled.
+;; OpenCL devices like GPU are not available during build (store environment),
+;; tests that require such devices are all disabled.
 ;; Check https://lists.gnu.org/archive/html/guix-devel/2018-04/msg00293.html
 
 (define (make-opencl-headers major-version subversion)
@@ -55,7 +58,7 @@
                 (uri (git-reference
                       (url "https://github.com/KhronosGroup/OpenCL-Headers.git")
                       (commit commit)))
-                (file-name (string-append name "-" commit))
+                (file-name (git-file-name name version))
                 (sha256
                  (base32
                   "176ydpbyws5nr4av6hf8p41pkhc0rc4m4vrah9w6gp2fw2i32838"))))
@@ -100,15 +103,15 @@ programming.")
   (package
     (name "opencl-clhpp")
     (version "2.0.10")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append
-                    "https://github.com/KhronosGroup/OpenCL-CLHPP/archive/v"
-                    version ".tar.gz"))
-              (sha256
-               (base32
-                "0awg6yznbz3h285kmnd47fykx2qa34a07sr4x1657yn3jmi4a9zs"))
-              (file-name (string-append name "-" version ".tar.gz"))))
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/KhronosGroup/OpenCL-CLHPP.git")
+             (commit (string-append "v" version))))
+       (sha256
+        (base32 "0h5kpg5cl8wzfnqmv6i26aig2apv06ffm9p3rh35938n9r8rladm"))
+       (file-name (git-file-name name version))))
     (native-inputs
      `(("python" ,python-wrapper)))
     (propagated-inputs
@@ -122,7 +125,7 @@ programming.")
           (string-append "-DCMAKE_INSTALL_PREFIX="
                          (assoc-ref %outputs "out")
                          "/include")))
-       ;; regression tests requires a lot more dependencies
+       ;; The regression tests require a lot more dependencies.
        #:tests? #f))
     (build-system cmake-build-system)
     (home-page "http://github.khronos.org/OpenCL-CLHPP/")
@@ -172,15 +175,15 @@ Loader as provided by this package.")
   (package
     (name "clinfo")
     (version "2.2.18.04.06")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append
-                    "https://github.com/Oblomov/clinfo/archive/"
-                    version ".tar.gz"))
-              (file-name (string-append name "-" version ".tar.gz"))
-              (sha256
-               (base32
-                "0v7cy01irwdgns6lzaprkmm0502pp5a24zhhffydxz1sgfjj2w7p"))))
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/Oblomov/clinfo.git")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0y2q0lz5yzxy970b7w7340vp4fl25vndahsyvvrywcrn51ipgplx"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("opencl-headers" ,opencl-headers)))
@@ -214,22 +217,21 @@ the system.")
   (package
     (name "beignet")
     (version "1.3.2")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append
-                    "https://github.com/intel/beignet/archive/Release_v"
-                    version
-                    ".tar.gz"))
-              (file-name (string-append name "-" version ".tar.gz"))
-              (sha256
-               (base32
-                "18r0lq3dkd4yn6bxa45s2lrr9cjbg70nr2nn6xablvgqwzw0jb0r"))
-              (patches (search-patches "beignet-correct-file-names.patch"))
-              (modules '((guix build utils)))
-              (snippet
-               ;; There's a suspicious .isa binary file under kernels/.
-               ;; Remove it.
-               '(for-each delete-file (find-files "." "\\.isa$")))))
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/intel/beignet.git")
+             (commit (string-append "Release_v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0lpv3lvi2vrmzb8blflrpbd3jgin76zqmz6jcv17vn9mylqdrfnd"))
+       (patches (search-patches "beignet-correct-file-names.patch"))
+       (modules '((guix build utils)))
+       (snippet
+        ;; There's a suspicious .isa binary file under kernels/.
+        ;; Remove it.
+        '(for-each delete-file (find-files "." "\\.isa$")))))
     (native-inputs `(("pkg-config" ,pkg-config)
                      ("python" ,python)))
     (inputs `(("clang@3.7" ,clang-3.7)
@@ -238,7 +240,7 @@ the system.")
               ("llvm@3.7" ,llvm-3.7)
               ("libdrm" ,libdrm)
               ("libedit" ,libedit)
-              ("libpthread-stubs"libpthread-stubs)
+              ("libpthread-stubs" ,libpthread-stubs)
               ("libsm" ,libsm)
               ("libva" ,libva)
               ("libxfixes" ,libxfixes)
@@ -288,3 +290,53 @@ functions required to initialize the device, create the command queues, the
 kernels and the programs, and run them on the GPU.  The code also contains a
 back-end for the LLVM compiler framework.")
     (license license:lgpl2.1+)))
+
+(define-public pocl
+  (package
+    (name "pocl")
+    (version "1.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/pocl/pocl.git")
+             (commit (string-append "v" version))))
+       (sha256
+        (base32 "0fyiwd9nrqhl0jsac0bx17p9acpfzhyxp50mmp28mzn7psb9qidg"))
+       (file-name (git-file-name name version))))
+    (build-system cmake-build-system)
+    (native-inputs
+     `(("libltdl" ,libltdl)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("clang" ,clang)
+       ("hwloc" ,hwloc-2.0 "lib")
+       ("llvm" ,llvm)
+       ("ocl-icd" ,ocl-icd)))
+    (arguments
+     `(#:configure-flags
+       (list "-DENABLE_ICD=ON"
+             "-DENABLE_TESTSUITES=ON"
+             ;; We are not developers, don't run conformance suite.
+             "-DENABLE_CONFORMANCE=OFF"
+             (string-append "-DEXTRA_HOST_LD_FLAGS=-L"
+                            (assoc-ref %build-inputs "libc") "/lib"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'set-HOME
+           (lambda _
+             (setenv "HOME" "/tmp")
+             #t)))))
+    (home-page "http://portablecl.org/")
+    (synopsis "Portable Computing Language (pocl), an OpenCL implementation")
+    (description
+     "Pocl is a portable implementation of the OpenCL standard (1.2 with some
+2.0 features supported).  This project seeks to improve performance
+portability of OpenCL programs with the kernel compiler and the task run-time,
+reducing the need for target-dependent manual optimizations.
+
+pocl uses Clang as an OpenCL C frontend and LLVM for kernel compiler
+implementation, and as a portability layer.  Thus, if your desired target has
+an LLVM backend, it should be able to get OpenCL support easily by using
+pocl.")
+    (license license:expat)))