hara.runtime.jocl.env
added in 4.1
Environment helpers for the JOCL runtime.
The functions here deliberately avoid importing org.jocl.CL so that this namespace can be loaded even when the native OpenCL library is not installed on the host.
See: https://github.com/zcaudate-xyz/foundation-base/actions/runs/28710051629/job/85142005252
cl-field
added in 4.1
(cl-field name)Reflectively reads a static field from org.jocl.CL.
Useful in test namespaces that need CL constants but must not import org.jocl.CL (because that would trigger class initialization on machines without OpenCL).
opencl-available?
added in 4.1
(opencl-available?)Returns true when the OpenCL library can be loaded and at least one platform can be enumerated.
This is used by code.test skips so that JOCL tests are reported as skipped rather than errored on machines without OpenCL.
when-available
macro
added in 4.1
(when-available & body)Executes body only when the OpenCL native library is available.
This is used in test namespaces around top-level (l/script- ...) and defn.c forms. When OpenCL is missing the body is dropped entirely, so the script macros never see the unavailable runtime.
with-script-stubs
macro
added in 4.1
(with-script-stubs)Provides no-op defn.c and define.c macros when OpenCL is not available. Test namespaces call this before any script forms so the file can compile even when the JOCL runtime is not loaded.
with-stubs
macro
added in 4.1
(with-stubs & syms)Defines no-op vars for syms when OpenCL is not available.
Test namespaces use this so they can still compile on machines that do not have the native OpenCL library installed. When OpenCL is available the macro expands to nothing and the real functions are used instead.