gnu: Add ocl-icd.
[jackhill/guix/guix.git] / gnu / packages / opencl.scm
CommitLineData
7f996b4c
FT
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2018 Fis Trivial <ybbs.daans@hotmail.com>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (gnu packages opencl)
20 #:use-module (guix build-system gnu)
f69c1a18
FT
21 #:use-module (guix build-system cmake)
22 #:use-module (guix download)
7f996b4c
FT
23 #:use-module (guix git-download)
24 #:use-module (guix packages)
f69c1a18 25 #:use-module ((guix licenses) #:prefix license:)
2a0539e2
FT
26 #:use-module (gnu packages gnupg)
27 #:use-module (gnu packages python)
28 #:use-module (gnu packages ruby))
7f996b4c
FT
29
30;; This file adds OpenCL implementation related packages. Due to the fact that
31;; OpenCL devices are not available during build (store environment), tests are
32;; all disabled.
33;; Check https://lists.gnu.org/archive/html/guix-devel/2018-04/msg00293.html
34
35(define (make-opencl-headers major-version subversion)
36 (let ((commit "e986688daf750633898dfd3994e14a9e618f2aa5")
37 (revision "0"))
38 (package
39 (name "opencl-headers")
40 (version (git-version
41 (string-append major-version "." subversion ".0")
42 revision commit))
43 (source (origin
44 (method git-fetch)
45 (uri (git-reference
46 (url "https://github.com/KhronosGroup/OpenCL-Headers.git")
47 (commit commit)))
48 (file-name (string-append name "-" commit))
49 (sha256
50 (base32
51 "176ydpbyws5nr4av6hf8p41pkhc0rc4m4vrah9w6gp2fw2i32838"))))
52 (build-system gnu-build-system)
53 (arguments
54 `(#:phases
55 (modify-phases %standard-phases
56 (delete 'configure)
57 (delete 'build)
58 (delete 'check)
59 (replace 'install
60 (lambda* (#:key outputs #:allow-other-keys)
61 (copy-recursively (string-append "./opencl" (string-append
62 ,major-version
63 ,subversion) "/CL")
64 (string-append
65 (assoc-ref outputs "out")
66 "/include/CL")))))))
67 (synopsis "The Khronos OpenCL headers")
68 (description
69 "This package provides the C headers by Khronos for OpenCL
70programming.")
71 (home-page "https://www.khronos.org/registry/OpenCL/")
72 (license license:expat))))
73
74(define-public opencl-headers-2.2
75 (make-opencl-headers "2" "2"))
76(define-public opencl-headers-2.1
77 (make-opencl-headers "2" "1"))
78(define-public opencl-headers-2.0
79 (make-opencl-headers "2" "0"))
80(define-public opencl-headers-1.2
81 (make-opencl-headers "1" "2"))
82(define-public opencl-headers-1.1
83 (make-opencl-headers "1" "1"))
84(define-public opencl-headers-1.0
85 (make-opencl-headers "1" "0"))
86
87(define-public opencl-headers opencl-headers-2.2)
f69c1a18
FT
88
89(define-public opencl-clhpp
90 (package
91 (name "opencl-clhpp")
92 (version "2.0.10")
93 (source (origin
94 (method url-fetch)
95 (uri (string-append
96 "https://github.com/KhronosGroup/OpenCL-CLHPP/archive/v"
97 version ".tar.gz"))
98 (sha256
99 (base32
100 "0awg6yznbz3h285kmnd47fykx2qa34a07sr4x1657yn3jmi4a9zs"))
101 (file-name (string-append name "-" version ".tar.gz"))))
102 (native-inputs
103 `(("python" ,python-wrapper)))
104 (propagated-inputs
105 `(("opencl-headers" ,opencl-headers)))
106 (arguments
107 `(#:configure-flags
108 (let ((out (assoc-ref %outputs "out")))
109 (list
110 "-DBUILD_EXAMPLES=OFF"
111 "-DBUILD_TESTS=OFF"
112 (string-append "-DCMAKE_INSTALL_PREFIX="
113 (assoc-ref %outputs "out")
114 "/include")))
115 ;; regression tests requires a lot more dependencies
116 #:tests? #f))
117 (build-system cmake-build-system)
118 (home-page "http://github.khronos.org/OpenCL-CLHPP/")
119 (synopsis "Khronos OpenCL-CLHPP")
120 (description
121 "This package provides the @dfn{host API} C++ headers for OpenCL.")
122 (license license:expat)))
2a0539e2
FT
123
124(define-public ocl-icd
125 (package
126 (name "ocl-icd")
127 (version "2.2.12")
128 (source (origin
129 (method url-fetch)
130 (uri (string-append
131 "https://forge.imag.fr/frs/download.php/836/ocl-icd-"
132 version ".tar.gz"))
133 (file-name (string-append name "-" version ".tar.gz"))
134 (sha256
135 (base32
136 "1x2dr8p4dkfds56r38av360i3nv1y3326jmshxvjngaf6mlg6rbn"))
137 (modules '((guix build utils)))
138 (snippet
139 '(delete-file-recursively "khronos-headers"))))
140 (native-inputs
141 `(("opencl-headers" ,opencl-headers)
142 ("ruby" ,ruby)))
143 (inputs
144 `(("libgcrypt" ,libgcrypt)))
145 (build-system gnu-build-system)
146 (arguments
147 '(#:configure-flags '("DEBUG_OCL_ICD=1")))
148 (native-search-paths
149 (list (search-path-specification
150 (variable "OPENCL_VENDOR_PATH")
151 (files '("etc/OpenCL/vendors")))))
152 (search-paths native-search-paths)
153 (home-page "https://forge.imag.fr/projects/ocl-icd/")
154 (synopsis "OpenCL loader for Installable Client Drivers (ICDs)")
155 (description
156 "OpenCL implementations are provided as ICDs (Installable Client
157Drivers). An OpenCL program can use several ICDs thanks to the use of an ICD
158Loader as provided by this package.")
159 (license license:bsd-2)))