guix/gnu/packages/opencl.scm
Fis Trivial 2a0539e267
gnu: Add ocl-icd.
* gnu/packages/opencl.scm (ocl-icd): New variable.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2018-06-26 23:01:16 +02:00

160 lines
6 KiB
Scheme

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix 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.
;;;
;;; GNU Guix 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 GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages opencl)
#:use-module (guix build-system gnu)
#:use-module (guix build-system cmake)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix packages)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (gnu packages gnupg)
#:use-module (gnu packages python)
#:use-module (gnu packages ruby))
;; 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.
;; Check https://lists.gnu.org/archive/html/guix-devel/2018-04/msg00293.html
(define (make-opencl-headers major-version subversion)
(let ((commit "e986688daf750633898dfd3994e14a9e618f2aa5")
(revision "0"))
(package
(name "opencl-headers")
(version (git-version
(string-append major-version "." subversion ".0")
revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/KhronosGroup/OpenCL-Headers.git")
(commit commit)))
(file-name (string-append name "-" commit))
(sha256
(base32
"176ydpbyws5nr4av6hf8p41pkhc0rc4m4vrah9w6gp2fw2i32838"))))
(build-system gnu-build-system)
(arguments
`(#:phases
(modify-phases %standard-phases
(delete 'configure)
(delete 'build)
(delete 'check)
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(copy-recursively (string-append "./opencl" (string-append
,major-version
,subversion) "/CL")
(string-append
(assoc-ref outputs "out")
"/include/CL")))))))
(synopsis "The Khronos OpenCL headers")
(description
"This package provides the C headers by Khronos for OpenCL
programming.")
(home-page "https://www.khronos.org/registry/OpenCL/")
(license license:expat))))
(define-public opencl-headers-2.2
(make-opencl-headers "2" "2"))
(define-public opencl-headers-2.1
(make-opencl-headers "2" "1"))
(define-public opencl-headers-2.0
(make-opencl-headers "2" "0"))
(define-public opencl-headers-1.2
(make-opencl-headers "1" "2"))
(define-public opencl-headers-1.1
(make-opencl-headers "1" "1"))
(define-public opencl-headers-1.0
(make-opencl-headers "1" "0"))
(define-public opencl-headers opencl-headers-2.2)
(define-public opencl-clhpp
(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"))))
(native-inputs
`(("python" ,python-wrapper)))
(propagated-inputs
`(("opencl-headers" ,opencl-headers)))
(arguments
`(#:configure-flags
(let ((out (assoc-ref %outputs "out")))
(list
"-DBUILD_EXAMPLES=OFF"
"-DBUILD_TESTS=OFF"
(string-append "-DCMAKE_INSTALL_PREFIX="
(assoc-ref %outputs "out")
"/include")))
;; regression tests requires a lot more dependencies
#:tests? #f))
(build-system cmake-build-system)
(home-page "http://github.khronos.org/OpenCL-CLHPP/")
(synopsis "Khronos OpenCL-CLHPP")
(description
"This package provides the @dfn{host API} C++ headers for OpenCL.")
(license license:expat)))
(define-public ocl-icd
(package
(name "ocl-icd")
(version "2.2.12")
(source (origin
(method url-fetch)
(uri (string-append
"https://forge.imag.fr/frs/download.php/836/ocl-icd-"
version ".tar.gz"))
(file-name (string-append name "-" version ".tar.gz"))
(sha256
(base32
"1x2dr8p4dkfds56r38av360i3nv1y3326jmshxvjngaf6mlg6rbn"))
(modules '((guix build utils)))
(snippet
'(delete-file-recursively "khronos-headers"))))
(native-inputs
`(("opencl-headers" ,opencl-headers)
("ruby" ,ruby)))
(inputs
`(("libgcrypt" ,libgcrypt)))
(build-system gnu-build-system)
(arguments
'(#:configure-flags '("DEBUG_OCL_ICD=1")))
(native-search-paths
(list (search-path-specification
(variable "OPENCL_VENDOR_PATH")
(files '("etc/OpenCL/vendors")))))
(search-paths native-search-paths)
(home-page "https://forge.imag.fr/projects/ocl-icd/")
(synopsis "OpenCL loader for Installable Client Drivers (ICDs)")
(description
"OpenCL implementations are provided as ICDs (Installable Client
Drivers). An OpenCL program can use several ICDs thanks to the use of an ICD
Loader as provided by this package.")
(license license:bsd-2)))