gnu: Add wlgreet.
[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>
d45cec39 3;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
7f996b4c
FT
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (gnu packages opencl)
21 #:use-module (guix build-system gnu)
f69c1a18 22 #:use-module (guix build-system cmake)
de84dfbe 23 #:use-module (guix build-system copy)
3f1a0f16 24 #:use-module (guix build-system python)
f69c1a18 25 #:use-module (guix download)
d8c63f87 26 #:use-module (guix utils)
7f996b4c 27 #:use-module (guix git-download)
f69c1a18 28 #:use-module ((guix licenses) #:prefix license:)
f19b2630
FT
29 #:use-module (guix packages)
30 #:use-module (gnu packages)
53fc7a09 31 #:use-module (gnu packages autotools)
f19b2630 32 #:use-module (gnu packages gl)
2a0539e2 33 #:use-module (gnu packages gnupg)
f19b2630
FT
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages libedit)
36 #:use-module (gnu packages llvm)
53fc7a09 37 #:use-module (gnu packages mpi)
f19b2630
FT
38 #:use-module (gnu packages ncurses)
39 #:use-module (gnu packages pkg-config)
2a0539e2 40 #:use-module (gnu packages python)
3f1a0f16 41 #:use-module (gnu packages python-xyz)
f19b2630
FT
42 #:use-module (gnu packages ruby)
43 #:use-module (gnu packages video)
44 #:use-module (gnu packages xdisorg)
45 #:use-module (gnu packages xorg))
7f996b4c
FT
46
47;; This file adds OpenCL implementation related packages. Due to the fact that
53fc7a09
FT
48;; OpenCL devices like GPU are not available during build (store environment),
49;; tests that require such devices are all disabled.
7f996b4c
FT
50;; Check https://lists.gnu.org/archive/html/guix-devel/2018-04/msg00293.html
51
ac52d4b9
LDB
52;; If you update either of opencl-headers, opencl-clhpp or opencl-icd-loader
53;; note that they are released together (lockstep) and must be updated
54;; together.
de84dfbe
MM
55(define-public opencl-headers
56 (package
57 (name "opencl-headers")
ac52d4b9 58 (version "2021.06.30")
de84dfbe
MM
59 (source
60 (origin
61 (method git-fetch)
62 (uri (git-reference
63 (url "https://github.com/KhronosGroup/OpenCL-Headers")
64 (commit (string-append "v" version))))
65 (file-name (git-file-name name version))
66 (sha256
ac52d4b9
LDB
67 (base32 "1nrvx0x9r1nz1qpmzbgffnn9h9pn2fwcxsksf101bkpmqziq5lii"))))
68 (build-system cmake-build-system)
69 (arguments `(#:tests? #f)) ; Not enabled during build.
de84dfbe
MM
70 (synopsis "The Khronos OpenCL headers")
71 (description
72 "This package provides the C headers by Khronos for OpenCL programming.")
73 (home-page "https://www.khronos.org/registry/OpenCL/")
74 (license license:asl2.0)))
75
7f996b4c 76(define (make-opencl-headers major-version subversion)
de84dfbe
MM
77 ;; The upstream OpenCL-Headers repository is no longer separating headers by
78 ;; version; instead, you are supposed to #define CL_TARGET_OPENCL_VERSION.
79 (deprecated-package (string-append "opencl-headers-"
80 major-version "."
81 subversion) opencl-headers))
7f996b4c
FT
82
83(define-public opencl-headers-2.2
84 (make-opencl-headers "2" "2"))
85(define-public opencl-headers-2.1
86 (make-opencl-headers "2" "1"))
87(define-public opencl-headers-2.0
88 (make-opencl-headers "2" "0"))
89(define-public opencl-headers-1.2
90 (make-opencl-headers "1" "2"))
91(define-public opencl-headers-1.1
92 (make-opencl-headers "1" "1"))
93(define-public opencl-headers-1.0
94 (make-opencl-headers "1" "0"))
95
f69c1a18
FT
96(define-public opencl-clhpp
97 (package
98 (name "opencl-clhpp")
95a86b9b 99 (version "2.0.15")
d6d9ca10
TGR
100 (source
101 (origin
102 (method git-fetch)
103 (uri (git-reference
b0e7b699 104 (url "https://github.com/KhronosGroup/OpenCL-CLHPP")
d6d9ca10
TGR
105 (commit (string-append "v" version))))
106 (sha256
95a86b9b 107 (base32 "1wycdbvwbdn7lqdd3sby8471qg2zdisr70218ava6cfvxdsqcp83"))
d6d9ca10 108 (file-name (git-file-name name version))))
f69c1a18
FT
109 (native-inputs
110 `(("python" ,python-wrapper)))
111 (propagated-inputs
8394619b 112 (list opencl-headers))
f69c1a18 113 (arguments
95a86b9b 114 `(#:configure-flags (list "-DBUILD_EXAMPLES=OFF" "-DBUILD_TESTS=OFF")
d6d9ca10 115 ;; The regression tests require a lot more dependencies.
f69c1a18
FT
116 #:tests? #f))
117 (build-system cmake-build-system)
c6be7eed 118 (home-page "https://github.khronos.org/OpenCL-CLHPP/")
f69c1a18
FT
119 (synopsis "Khronos OpenCL-CLHPP")
120 (description
121 "This package provides the @dfn{host API} C++ headers for OpenCL.")
122 (license license:expat)))
2a0539e2 123
2c6c1f8d
LDB
124(define-public opencl-icd-loader
125 (package
126 (name "opencl-icd-loader")
127 (version "2021.06.30")
128 (source (origin
129 (method git-fetch)
130 (uri (git-reference
131 (url "https://github.com/KhronosGroup/OpenCL-ICD-Loader.git")
132 (commit (string-append "v" version))))
133 (file-name (git-file-name name version))
134 (sha256
135 (base32
136 "007ws357n1ijrxal1bf9lwy68p0dz1sm9cfcfnnz5f88iwc9xd6m"))))
137 (build-system cmake-build-system)
138 (arguments `(#:tests? #f)) ; Tests need stub loader setup.
139 (native-search-paths
140 (list (search-path-specification
141 (variable "OCL_ICD_VENDORS")
b545d223
LDB
142 (files '("etc/OpenCL/vendors"))
143 ;; Only supports a single directory.
144 (separator #f))))
2c6c1f8d 145 (home-page "https://github.com/KhronosGroup/OpenCL-ICD-Loader")
8394619b 146 (inputs (list opencl-headers))
2c6c1f8d
LDB
147 (synopsis "OpenCL Installable Client Driver")
148 (description
149 "OpenCL defines an Installable Client Driver (ICD) mechanism to allow
150developers to build applications against an Installable Client Driver loader
151(ICD loader) rather than linking their applications against a specific OpenCL
152implementation. The ICD Loader is responsible for:
153
154@itemize
155@item Exporting OpenCL API entry points
156@item Enumerating OpenCL implementations
157@item Forwarding OpenCL API calls to the correct implementation
158@end itemize
159
160This package contains the Khronos official OpenCL ICD Loader.")
161 (license license:asl2.0)))
162
2a0539e2 163(define-public ocl-icd
4d1157fc 164 (deprecated-package "ocl-icd" opencl-icd-loader))
184a214b
FT
165
166(define-public clinfo
167 (package
168 (name "clinfo")
d8c63f87 169 (version "3.0.21.02.21")
d6d9ca10
TGR
170 (source
171 (origin
172 (method git-fetch)
173 (uri (git-reference
b0e7b699 174 (url "https://github.com/Oblomov/clinfo")
d6d9ca10
TGR
175 (commit version)))
176 (file-name (git-file-name name version))
177 (sha256
d8c63f87 178 (base32 "1sfxp6ai83i0vwdg7b05h0k07q6873q1z1avnyksj5zmzdnxya6j"))))
184a214b
FT
179 (build-system gnu-build-system)
180 (native-inputs
8394619b 181 (list opencl-headers))
184a214b 182 (inputs
8394619b 183 (list opencl-icd-loader))
184a214b 184 (arguments
d8c63f87
LDB
185 `(#:make-flags
186 (list ,(string-append "CC=" (cc-for-target))
187 (string-append "PREFIX=" (assoc-ref %outputs "out")))
188 #:phases (modify-phases %standard-phases (delete 'configure))
184a214b
FT
189 #:tests? #f))
190 (home-page "https://github.com/Oblomov/clinfo")
191 (synopsis "Print information about OpenCL platforms and devices")
192 ;; Only the implementation installed via Guix will be detected.
193 (description
194 "This package provides the @command{clinfo} command that enumerates all
195possible (known) properties of the OpenCL platform and devices available on
196the system.")
197 (license license:cc0)))
f19b2630
FT
198
199(define-public beignet
200 (package
201 (name "beignet")
202 (version "1.3.2")
d6d9ca10
TGR
203 (source
204 (origin
205 (method git-fetch)
206 (uri (git-reference
b0e7b699 207 (url "https://github.com/intel/beignet")
d6d9ca10
TGR
208 (commit (string-append "Release_v" version))))
209 (file-name (git-file-name name version))
210 (sha256
211 (base32 "0lpv3lvi2vrmzb8blflrpbd3jgin76zqmz6jcv17vn9mylqdrfnd"))
212 (patches (search-patches "beignet-correct-file-names.patch"))
213 (modules '((guix build utils)))
214 (snippet
215 ;; There's a suspicious .isa binary file under kernels/.
216 ;; Remove it.
217 '(for-each delete-file (find-files "." "\\.isa$")))))
8394619b 218 (native-inputs (list pkg-config python))
f19b2630
FT
219 (inputs `(("clang@3.7" ,clang-3.7)
220 ("clang-runtime@3.7" ,clang-runtime-3.7)
221 ("glu" ,glu)
222 ("llvm@3.7" ,llvm-3.7)
223 ("libdrm" ,libdrm)
224 ("libedit" ,libedit)
b42b5afd 225 ("libpthread-stubs" ,libpthread-stubs)
f19b2630
FT
226 ("libsm" ,libsm)
227 ("libva" ,libva)
228 ("libxfixes" ,libxfixes)
229 ("libxext" ,libxext)
230 ("mesa-utils" ,mesa-utils)
231 ("ncurses" ,ncurses)
4d1157fc 232 ("opencl-icd-loader" ,opencl-icd-loader)
f19b2630
FT
233 ("opencl-headers" ,opencl-headers)
234 ("xextproto" ,xextproto)
235 ("zlib" ,zlib)))
236 (build-system cmake-build-system)
237 (arguments
238 `(#:configure-flags
239 (list (string-append "-DCLANG_LIBRARY_DIR="
240 (assoc-ref %build-inputs "clang@3.7") "/lib")
241 "-DENABLE_GL_SHARING=ON"
242 "-DEXPERIMENTAL_DOUBLE=ON")
243
244 #:phases
245 (modify-phases %standard-phases
246 (add-after 'install 'remove-headers
247 (lambda* (#:key outputs #:allow-other-keys)
248 (let ((out (assoc-ref outputs "out")))
249 (delete-file-recursively
250 (string-append out "/include"))
251 #t)))
252 (add-after 'remove-headers 'install-kernels
253 (lambda* (#:key outputs #:allow-other-keys)
254 (let* ((out (assoc-ref outputs "out"))
255 (builddir (getcwd))
256 (source-dir (string-append
257 builddir
258 "/../beignet-Release_v1.3.2/kernels")))
259 (copy-recursively source-dir
260 (string-append out "/lib/beignet/kernels"))
261 #t))))
262 ;; Beignet tries to find GPU when running tests, which is not available
263 ;; during build.
264 #:tests? #f))
265 (home-page "https://wiki.freedesktop.org/www/Software/Beignet/")
266 (synopsis "OpenCL framework for Intel GPUs")
267 (description
268 "Beignet is an implementation of the OpenCL specification. This code
269base contains the code to run OpenCL programs on Intel GPUs---IvyBridge,
270Haswell, Skylake, Apollolake, etc. It defines and implements the OpenCL host
271functions required to initialize the device, create the command queues, the
272kernels and the programs, and run them on the GPU. The code also contains a
273back-end for the LLVM compiler framework.")
35aa016a
EF
274 ;; Beignet only supports Intel processors.
275 (supported-systems '("x86_64-linux" "i686-linux"))
f19b2630 276 (license license:lgpl2.1+)))
53fc7a09
FT
277
278(define-public pocl
279 (package
280 (name "pocl")
bbad38f4 281 (version "1.4")
d6d9ca10
TGR
282 (source
283 (origin
284 (method git-fetch)
285 (uri (git-reference
b0e7b699 286 (url "https://github.com/pocl/pocl")
d6d9ca10 287 (commit (string-append "v" version))))
d6d9ca10 288 (sha256
bbad38f4 289 (base32 "1c4y69zks6hkq5fqh9waxgb8g4ka7y6h3vacmsm720kba0h57g8a"))
bfb22078 290 (file-name (git-file-name name version))))
53fc7a09
FT
291 (build-system cmake-build-system)
292 (native-inputs
8394619b 293 (list libltdl pkg-config))
53fc7a09 294 (inputs
4ed2b6ac 295 (list clang-9 llvm-9 `(,hwloc-2 "lib") opencl-icd-loader))
53fc7a09
FT
296 (arguments
297 `(#:configure-flags
298 (list "-DENABLE_ICD=ON"
299 "-DENABLE_TESTSUITES=ON"
300 ;; We are not developers, don't run conformance suite.
301 "-DENABLE_CONFORMANCE=OFF"
302 (string-append "-DEXTRA_HOST_LD_FLAGS=-L"
303 (assoc-ref %build-inputs "libc") "/lib"))
304 #:phases
305 (modify-phases %standard-phases
53fc7a09
FT
306 (add-before 'check 'set-HOME
307 (lambda _
308 (setenv "HOME" "/tmp")
309 #t)))))
310 (home-page "http://portablecl.org/")
311 (synopsis "Portable Computing Language (pocl), an OpenCL implementation")
312 (description
313 "Pocl is a portable implementation of the OpenCL standard (1.2 with some
3142.0 features supported). This project seeks to improve performance
315portability of OpenCL programs with the kernel compiler and the task run-time,
316reducing the need for target-dependent manual optimizations.
317
318pocl uses Clang as an OpenCL C frontend and LLVM for kernel compiler
319implementation, and as a portability layer. Thus, if your desired target has
320an LLVM backend, it should be able to get OpenCL support easily by using
321pocl.")
322 (license license:expat)))
3f1a0f16
LC
323
324(define-public python-pytools
325 (package
326 (name "python-pytools")
65a5eec0 327 (version "2021.2.7")
3f1a0f16
LC
328 (source
329 (origin
330 (method url-fetch)
331 (uri (pypi-uri "pytools" version))
332 (sha256
65a5eec0 333 (base32 "1yyr4k6sqx859gjhc02633l2vxwdnj6m2f5blmf7dgq0gzzgcf05"))))
3f1a0f16 334 (build-system python-build-system)
65a5eec0 335 (arguments `(#:tests? #f)) ; Tests depend on packages not present in Guix.
3f1a0f16 336 (propagated-inputs
8394619b 337 (list python-appdirs python-numpy))
3f1a0f16
LC
338 (home-page "https://pypi.org/project/pytools/")
339 (synopsis "Assorted tools for Python")
340 (description
341 "Pytools is a bag of things that are ``missing'' from the Python standard
342library:
343
344@itemize
345@item
346small helper functions such as @code{len_iterable}, @code{argmin},
347tuple generation, permutation generation, ASCII table pretty printing,
348GvR's @code{monkeypatch_xxx} hack, the elusive @code{flatten}, and much more.
349@item
350Michele Simionato's decorator module
351@item
352A time-series logging module, @code{pytools.log}.
353@item
354Batch job submission, @code{pytools.batchjob}.
355@item
356A lexer, @code{pytools.lex}.
357@end itemize\n")
358 (license license:expat)))
01dce79f
LC
359
360(define-public python-pyopencl
361 (package
362 (name "python-pyopencl")
9c7c3f77 363 (version "2021.2.6")
01dce79f
LC
364 (source
365 (origin
01dce79f
LC
366 (method git-fetch)
367 (uri (git-reference
9c7c3f77 368 (url "https://github.com/inducer/pyopencl.git")
01dce79f
LC
369 (commit (string-append "v" version))
370 (recursive? #t)))
371 (file-name (git-file-name name version))
372 (sha256
373 (base32
9c7c3f77 374 "1s2cls7avxvf753zzpx422ikslaxdnm8rz58zg7mal15yak0wv2x"))))
01dce79f
LC
375 (build-system python-build-system)
376 (arguments
9c7c3f77 377 `(#:tests? #f)) ; Tests cannot find pygpu_language_opencl.cpp
01dce79f 378 (inputs
8394619b 379 (list opencl-headers pybind11 opencl-icd-loader)) ;libOpenCL
01dce79f 380 (propagated-inputs
8394619b 381 (list python-appdirs python-numpy python-pytools python-mako))
01dce79f
LC
382 (home-page "http://mathema.tician.de/software/pyopencl")
383 (synopsis "Python wrapper for OpenCL")
384 (description
385 "PyOpenCL lets you access parallel computing devices such as GPUs from
386Python @i{via} OpenCL.")
387 (license license:expat)))