| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 |
|
| 22 | (define-module (gnu packages opencl)
|
| 23 | #:use-module ((guix licenses) #:prefix license:)
|
| 24 | #:use-module (guix build-system cmake)
|
| 25 | #:use-module (guix build-system gnu)
|
| 26 | #:use-module (guix build-system pyproject)
|
| 27 | #:use-module (guix download)
|
| 28 | #:use-module (guix gexp)
|
| 29 | #:use-module (guix git-download)
|
| 30 | #:use-module (guix packages)
|
| 31 | #:use-module (guix utils)
|
| 32 | #:use-module (gnu packages)
|
| 33 | #:use-module (gnu packages autotools)
|
| 34 | #:use-module (gnu packages check)
|
| 35 | #:use-module (gnu packages cmake)
|
| 36 | #:use-module (gnu packages compression)
|
| 37 | #:use-module (gnu packages gl)
|
| 38 | #:use-module (gnu packages gnupg)
|
| 39 | #:use-module (gnu packages libedit)
|
| 40 | #:use-module (gnu packages llvm)
|
| 41 | #:use-module (gnu packages mpi)
|
| 42 | #:use-module (gnu packages ncurses)
|
| 43 | #:use-module (gnu packages pkg-config)
|
| 44 | #:use-module (gnu packages python)
|
| 45 | #:use-module (gnu packages python-build)
|
| 46 | #:use-module (gnu packages python-science)
|
| 47 | #:use-module (gnu packages python-xyz)
|
| 48 | #:use-module (gnu packages ruby)
|
| 49 | #:use-module (gnu packages video)
|
| 50 | #:use-module (gnu packages vulkan)
|
| 51 | #:use-module (gnu packages xdisorg)
|
| 52 | #:use-module (gnu packages xorg))
|
| 53 |
|
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 |
|
| 59 | |
| 60 | |
| 61 | |
| 62 | (define %opencl-version "2025.07.22")
|
| 63 |
|
| 64 | (define-public opencl-headers
|
| 65 | (package
|
| 66 | (name "opencl-headers")
|
| 67 | (version %opencl-version)
|
| 68 | (source
|
| 69 | (origin
|
| 70 | (method git-fetch)
|
| 71 | (uri (git-reference
|
| 72 | (url "https://github.com/KhronosGroup/OpenCL-Headers")
|
| 73 | (commit (string-append "v" version))))
|
| 74 | (file-name (git-file-name name version))
|
| 75 | (sha256
|
| 76 | (base32 "1rir72cdigwkj3a0k8l066fgzvh41yf6vrczzflwh0h4vq3g7h2x"))))
|
| 77 | (build-system cmake-build-system)
|
| 78 | (arguments `(#:tests? #f)) |
| 79 | (synopsis "The Khronos OpenCL headers")
|
| 80 | (description
|
| 81 | "This package provides the C headers by Khronos for OpenCL programming.")
|
| 82 | (home-page "https://registry.khronos.org/OpenCL/")
|
| 83 | (license license:asl2.0)))
|
| 84 |
|
| 85 | (define-public opencl-headers-2022
|
| 86 | (package
|
| 87 | (inherit opencl-headers)
|
| 88 | (name "opencl-headers")
|
| 89 | (version "2022.09.30")
|
| 90 | (source
|
| 91 | (origin
|
| 92 | (method git-fetch)
|
| 93 | (uri (git-reference
|
| 94 | (url "https://github.com/KhronosGroup/OpenCL-Headers")
|
| 95 | (commit (string-append "v" version))))
|
| 96 | (file-name (git-file-name name version))
|
| 97 | (sha256
|
| 98 | (base32 "0vzzkj5kd0invm5pvzlnhdl21n00jci6131a2cjviyz0vxp7xf2m"))))))
|
| 99 |
|
| 100 | (define-public opencl-clhpp
|
| 101 | (package
|
| 102 | (name "opencl-clhpp")
|
| 103 | (version %opencl-version)
|
| 104 | (source
|
| 105 | (origin
|
| 106 | (method git-fetch)
|
| 107 | (uri (git-reference
|
| 108 | (url "https://github.com/KhronosGroup/OpenCL-CLHPP")
|
| 109 | (commit (string-append "v" version))))
|
| 110 | (file-name (git-file-name name version))
|
| 111 | (sha256
|
| 112 | (base32 "1d7zyf2s2xpa002c36a081gyldai0mph3pjnyvswhx34c2b8yi44"))))
|
| 113 | (build-system cmake-build-system)
|
| 114 | (arguments
|
| 115 | (list #:tests? #f |
| 116 | #:configure-flags
|
| 117 | #~(list "-DBUILD_EXAMPLES=OFF" "-DBUILD_TESTS=OFF")))
|
| 118 | (native-inputs (list python-wrapper))
|
| 119 | (propagated-inputs (list opencl-headers))
|
| 120 | (home-page "https://github.khronos.org/OpenCL-CLHPP/")
|
| 121 | (synopsis "Khronos OpenCL-CLHPP")
|
| 122 | (description
|
| 123 | "This package provides the @dfn{host API} C++ headers for OpenCL.")
|
| 124 | (license license:expat)))
|
| 125 |
|
| 126 | (define-public opencl-icd-loader
|
| 127 | (package
|
| 128 | (name "opencl-icd-loader")
|
| 129 | (version %opencl-version)
|
| 130 | (source (origin
|
| 131 | (method git-fetch)
|
| 132 | (uri (git-reference
|
| 133 | (url "https://github.com/KhronosGroup/OpenCL-ICD-Loader")
|
| 134 | (commit (string-append "v" version))))
|
| 135 | (file-name (git-file-name name version))
|
| 136 | (sha256
|
| 137 | (base32
|
| 138 | "12y5v3ri9dqm3zbhg6axy02hbcb0g23f44m2jvyvc2zv0lvy42wg"))))
|
| 139 | (build-system cmake-build-system)
|
| 140 | (arguments `(#:tests? #f)) |
| 141 | (native-search-paths
|
| 142 | (list (search-path-specification
|
| 143 | (variable "OCL_ICD_VENDORS")
|
| 144 | (files '("etc/OpenCL/vendors"))
|
| 145 | |
| 146 | (separator #f))))
|
| 147 | (home-page "https://github.com/KhronosGroup/OpenCL-ICD-Loader")
|
| 148 | (inputs (list opencl-headers))
|
| 149 | (synopsis "OpenCL Installable Client Driver")
|
| 150 | (description
|
| 151 | "OpenCL defines an Installable Client Driver (ICD) mechanism to allow
|
| 152 | developers to build applications against an Installable Client Driver loader
|
| 153 | (ICD loader) rather than linking their applications against a specific OpenCL
|
| 154 | implementation. The ICD Loader is responsible for:
|
| 155 |
|
| 156 | @itemize
|
| 157 | @item Exporting OpenCL API entry points
|
| 158 | @item Enumerating OpenCL implementations
|
| 159 | @item Forwarding OpenCL API calls to the correct implementation
|
| 160 | @end itemize
|
| 161 |
|
| 162 | This package contains the Khronos official OpenCL ICD Loader.")
|
| 163 | (license license:asl2.0)))
|
| 164 |
|
| 165 | (define-public clinfo
|
| 166 | (package
|
| 167 | (name "clinfo")
|
| 168 | (version "3.0.25.02.14")
|
| 169 | (source
|
| 170 | (origin
|
| 171 | (method git-fetch)
|
| 172 | (uri (git-reference
|
| 173 | (url "https://github.com/Oblomov/clinfo")
|
| 174 | (commit version)))
|
| 175 | (file-name (git-file-name name version))
|
| 176 | (sha256
|
| 177 | (base32 "136fx14hcxfk3dab6jhk78j9l0f43zb3qap19mnzdrlqk532njaj"))))
|
| 178 | (build-system gnu-build-system)
|
| 179 | (native-inputs
|
| 180 | (list opencl-headers))
|
| 181 | (inputs
|
| 182 | (list opencl-icd-loader))
|
| 183 | (arguments
|
| 184 | (list
|
| 185 | #:make-flags
|
| 186 | #~(list (string-append "CC=" #$(cc-for-target))
|
| 187 | (string-append "CXX=" #$(cxx-for-target))
|
| 188 | (string-append "PREFIX=" #$output))
|
| 189 | #:phases
|
| 190 | #~(modify-phases %standard-phases (delete 'configure))
|
| 191 | #:tests? #f))
|
| 192 | (home-page "https://github.com/Oblomov/clinfo")
|
| 193 | (synopsis "Print information about OpenCL platforms and devices")
|
| 194 | |
| 195 | (description
|
| 196 | "This package provides the @command{clinfo} command that enumerates all
|
| 197 | possible (known) properties of the OpenCL platform and devices available on
|
| 198 | the system.")
|
| 199 | (license license:cc0)))
|
| 200 |
|
| 201 | (define-public ocl-icd
|
| 202 | (package
|
| 203 | (name "ocl-icd")
|
| 204 | (version "2.3.4")
|
| 205 | (source
|
| 206 | (origin
|
| 207 | (method git-fetch)
|
| 208 | (uri (git-reference
|
| 209 | (url "https://github.com/OCL-dev/ocl-icd")
|
| 210 | (commit (string-append "v" version))))
|
| 211 | (file-name (git-file-name name version))
|
| 212 | (sha256
|
| 213 | (base32 "119xr73anh1kqj3mndlplx65bq1cpq06pypc837hyc0ngbgpxbpf"))))
|
| 214 | (build-system gnu-build-system)
|
| 215 | (native-inputs
|
| 216 | (list autoconf automake libtool ruby))
|
| 217 | (home-page "https://github.com/OCL-dev/ocl-icd")
|
| 218 | (synopsis "Generic OpenCL @acronym{ICD, Installable Client Driver} loader")
|
| 219 | (description
|
| 220 | "This package provides an OpenCL @acronym{ICD, Installable Client Driver}
|
| 221 | loader. It maintains a YAML database of all known and guessed function pointers
|
| 222 | from vendor-specific drivers. It also delivers a skeleton of bindings to
|
| 223 | incorporate inside an OpenCL implementation to give it ICD functionalities.")
|
| 224 | (license license:bsd-2)))
|
| 225 |
|
| 226 | (define-public pocl
|
| 227 | (package
|
| 228 | (name "pocl")
|
| 229 | (version "6.0")
|
| 230 | (source
|
| 231 | (origin
|
| 232 | (method git-fetch)
|
| 233 | (uri (git-reference
|
| 234 | (url "https://github.com/pocl/pocl")
|
| 235 | (commit (string-append "v" version))))
|
| 236 | (sha256
|
| 237 | (base32
|
| 238 | "0darr71kj21scavikbm7if1d4nz5vca77y0q5hw6nf9f1c4axlkp"))
|
| 239 | (file-name (git-file-name name version))
|
| 240 | (modules '((guix build utils)))
|
| 241 | (snippet
|
| 242 | #~(begin
|
| 243 | |
| 244 | |
| 245 | |
| 246 | |
| 247 | |
| 248 | |
| 249 | (substitute* "tests/kernel/CMakeLists.txt"
|
| 250 | (("NOT ENABLE_POCL_FLOAT_CONVERSION") "false"))))))
|
| 251 | (build-system cmake-build-system)
|
| 252 | (arguments
|
| 253 | (list
|
| 254 | #:configure-flags
|
| 255 | #~(let* ((libdir (string-append #$output "/lib")))
|
| 256 | (list "-DENABLE_ICD=ON"
|
| 257 | "-DENABLE_TESTSUITES=ON"
|
| 258 | |
| 259 | "-DENABLE_CONFORMANCE=OFF"
|
| 260 | (string-append "-DEXTRA_HOST_LD_FLAGS=-L"
|
| 261 | (assoc-ref %build-inputs "libc") "/lib")
|
| 262 | |
| 263 | (string-append "-DCMAKE_INSTALL_RPATH="
|
| 264 | libdir ";" libdir "/pocl")))
|
| 265 | #:phases
|
| 266 | #~(modify-phases %standard-phases
|
| 267 | (add-before 'check 'set-HOME
|
| 268 | (lambda _
|
| 269 | (setenv "HOME" "/tmp")
|
| 270 | |
| 271 | |
| 272 | (setenv "HWLOC_SYNTHETIC" "4"))))))
|
| 273 | (inputs
|
| 274 | (list clang-toolchain-18 |
| 275 | `(,hwloc "lib")
|
| 276 | opencl-icd-loader))
|
| 277 | (native-inputs
|
| 278 | (list pkg-config
|
| 279 | spirv-llvm-translator
|
| 280 | spirv-tools
|
| 281 | python-minimal-wrapper))
|
| 282 | (home-page "http://portablecl.org/")
|
| 283 | (synopsis "Portable Computing Language (pocl), an OpenCL implementation")
|
| 284 | (description
|
| 285 | "Pocl is a portable implementation of the OpenCL standard (1.2 with some
|
| 286 | 2.0 features supported). This project seeks to improve performance
|
| 287 | portability of OpenCL programs with the kernel compiler and the task run-time,
|
| 288 | reducing the need for target-dependent manual optimizations.
|
| 289 |
|
| 290 | pocl uses Clang as an OpenCL C frontend and LLVM for kernel compiler
|
| 291 | implementation, and as a portability layer. Thus, if your desired target has
|
| 292 | an LLVM backend, it should be able to get OpenCL support easily by using
|
| 293 | pocl.")
|
| 294 | (license license:expat)))
|
| 295 |
|
| 296 | (define-public python-pytools
|
| 297 | (package
|
| 298 | (name "python-pytools")
|
| 299 | (version "2025.2.5")
|
| 300 | (source
|
| 301 | (origin
|
| 302 | (method git-fetch)
|
| 303 | (uri (git-reference
|
| 304 | (url "https://github.com/inducer/pytools")
|
| 305 | (commit (string-append "v" version))))
|
| 306 | (file-name (git-file-name name version))
|
| 307 | (sha256
|
| 308 | (base32 "1sym2vbkw068ldkjqi3qj1dkbvd047bk5ir028qqbv0g7z3dwk31"))))
|
| 309 | (build-system pyproject-build-system)
|
| 310 | |
| 311 | (native-inputs
|
| 312 | (list python-hatchling
|
| 313 | python-pytest))
|
| 314 | (propagated-inputs
|
| 315 | (list python-platformdirs
|
| 316 | python-siphash24
|
| 317 | python-typing-extensions))
|
| 318 | (home-page "https://github.com/inducer/pytools")
|
| 319 | (synopsis "Assorted tools for Python")
|
| 320 | (description
|
| 321 | "Pytools is a bag of things that are ``missing'' from the Python standard
|
| 322 | library:
|
| 323 |
|
| 324 | @itemize
|
| 325 | @item
|
| 326 | small helper functions such as @code{len_iterable}, @code{argmin},
|
| 327 | tuple generation, permutation generation, ASCII table pretty printing,
|
| 328 | GvR's @code{monkeypatch_xxx} hack, the elusive @code{flatten}, and much more.
|
| 329 | @item
|
| 330 | Michele Simionato's decorator module
|
| 331 | @item
|
| 332 | A time-series logging module, @code{pytools.log}.
|
| 333 | @item
|
| 334 | Batch job submission, @code{pytools.batchjob}.
|
| 335 | @item
|
| 336 | A lexer, @code{pytools.lex}.
|
| 337 | @end itemize\n")
|
| 338 | (license license:expat)))
|
| 339 |
|
| 340 | (define-public python-pyopencl
|
| 341 | (package
|
| 342 | (name "python-pyopencl")
|
| 343 | (version "2026.1")
|
| 344 | (source
|
| 345 | (origin
|
| 346 | (method git-fetch)
|
| 347 | (uri (git-reference
|
| 348 | (url "https://github.com/inducer/pyopencl")
|
| 349 | (commit (string-append "v" version))))
|
| 350 | (file-name (git-file-name name version))
|
| 351 | (sha256
|
| 352 | (base32 "11r7rbqnaqf9hwzzmqilsnf45x461mikkrrq0ybc2869cdb6rvqm"))))
|
| 353 | (build-system pyproject-build-system)
|
| 354 | (arguments
|
| 355 | (list
|
| 356 | |
| 357 | |
| 358 | |
| 359 | #:tests? #f
|
| 360 | #:phases
|
| 361 | #~(modify-phases %standard-phases
|
| 362 | (add-before 'build 'pre-build
|
| 363 | (lambda* (#:key inputs #:allow-other-keys)
|
| 364 | (setenv "CL_INC_DIR"
|
| 365 | (string-append #$(this-package-input "opencl-headers")
|
| 366 | "/include"))
|
| 367 | (setenv "CL_LIB_DIR"
|
| 368 | (string-append #$(this-package-input "ocl-icd") "/lib"))
|
| 369 | (setenv "CL_LIBNAME"
|
| 370 | "libOpenCL.so"))))))
|
| 371 | (native-inputs
|
| 372 | (list cmake-minimal
|
| 373 | pocl
|
| 374 | pybind11-2
|
| 375 | python-mako
|
| 376 | python-nanobind
|
| 377 | python-pytest
|
| 378 | python-scikit-build-core))
|
| 379 | (inputs
|
| 380 | (list opencl-headers
|
| 381 | ocl-icd))
|
| 382 | (propagated-inputs
|
| 383 | (list python-numpy
|
| 384 | python-platformdirs
|
| 385 | python-pytools
|
| 386 | python-typing-extensions))
|
| 387 | (home-page "https://mathema.tician.de/software/pyopencl/")
|
| 388 | (synopsis "Python wrapper for OpenCL")
|
| 389 | (description
|
| 390 | "PyOpenCL lets you access parallel computing devices such as GPUs from
|
| 391 | Python @i{via} OpenCL.")
|
| 392 | (license license:expat)))
|